PDU Types

smpp-core implements all standard SMPP 3.4 PDU types.

Bind PDUs

Used to establish SMPP sessions.

PDU Description

BindTransmitter

Bind as transmitter (send only)

BindTransmitterResp

Response to bind transmitter

BindReceiver

Bind as receiver (receive only)

BindReceiverResp

Response to bind receiver

BindTransceiver

Bind as transceiver (send and receive)

BindTransceiverResp

Response to bind transceiver

BindTransceiver bind = BindTransceiver.builder()
    .systemId("myesme")
    .password("secret")
    .systemType("SMS")
    .interfaceVersion((byte) 0x34)
    .build();

Message PDUs

SubmitSm

Submit a message to the SMSC for delivery.

SubmitSm submitSm = SubmitSm.builder()
    .sourceAddress(new Address((byte) 1, (byte) 1, "12345"))
    .destAddress(new Address((byte) 1, (byte) 1, "67890"))
    .shortMessage("Hello World!".getBytes())
    .dataCoding(DataCoding.DEFAULT)
    .registeredDelivery(RegisteredDelivery.SMSC_DELIVERY_RECEIPT_REQUESTED)
    .validityPeriod("000001000000000R")  // 1 hour relative
    .build();

DeliverSm

Message delivered from SMSC to ESME (mobile-originated or delivery receipt).

// Handle incoming DeliverSm
DeliverSmResult handleDeliverSm(SmppClientSession session, DeliverSm deliverSm) {
    if (deliverSm.esmClass().isDeliveryReceipt()) {
        // This is a delivery receipt
        String messageId = extractMessageId(deliverSm);
    } else {
        // Mobile-originated message
        String message = new String(deliverSm.shortMessage());
    }
    return DeliverSmResult.success();
}

Session Management PDUs

PDU Description

EnquireLink

Keep-alive ping

EnquireLinkResp

Response to enquire_link

Unbind

Graceful session termination

UnbindResp

Response to unbind

GenericNack

Negative acknowledgment for invalid PDUs

Optional TLV Parameters

PDUs support optional TLV (Tag-Length-Value) parameters:

import io.smppgateway.smpp.pdu.tlv.Tlv;
import io.smppgateway.smpp.pdu.tlv.TlvTag;

SubmitSm pdu = SubmitSm.builder()
    .sourceAddress(source)
    .destAddress(dest)
    .shortMessage(message)
    // Add TLV for SAR (segmented message)
    .addTlv(new Tlv(TlvTag.SAR_MSG_REF_NUM, refNum))
    .addTlv(new Tlv(TlvTag.SAR_SEGMENT_SEQNUM, segNum))
    .addTlv(new Tlv(TlvTag.SAR_TOTAL_SEGMENTS, totalSegments))
    .build();

Command Status

All responses include a command status:

SubmitSmResp response = session.submitSm(pdu);

if (response.commandStatus().isSuccess()) {
    System.out.println("Message ID: " + response.messageId());
} else {
    System.out.println("Error: " + response.commandStatus());
    // CommandStatus.ESME_RINVDSTADR, ESME_RTHROTTLED, etc.
}

Common Status Codes

Status Code Description

ESME_ROK

0x00

Success

ESME_RINVMSGLEN

0x01

Invalid message length

ESME_RINVCMDID

0x03

Invalid command ID

ESME_RINVBNDSTS

0x04

Invalid bind status

ESME_RINVPASWD

0x0E

Invalid password

ESME_RTHROTTLED

0x58

Throttling error