Skip to main content

smpp-connector — Domain Model

Status: populated | Last updated: 2026-04-18

1. Aggregates & Entities

1.1 SmppSession (Aggregate Root)

Represents a single persistent SMPP 3.4 TCP connection to one MNO operator.

AttributeTypeDescription
operatorIduuidLinks to operator in operator-management-service
bindModeBindModeTRANSCEIVER / TRANSMITTER / RECEIVER
stateSessionStateDISCONNECTED / CONNECTING / BOUND / UNBOUND / FAILBACK
hoststringMNO SMPP server hostname
portnumberMNO SMPP server port
systemIdstringSMPP bind credential (username)
tpsLimitnumberOperator-assigned TPS cap
isPrimarybooleanTrue = primary operator; False = backup
reconnectAttemptsnumberCount of consecutive failed reconnect attempts
nextReconnectAtDateScheduled next reconnect attempt
lastBoundAtDate | nullTimestamp of last successful bind
lastUnboundAtDate | nullTimestamp of last unbind

1.2 MessageCorrelation (Entity)

Maps the MNO-assigned message_id (from submit_sm_resp) back to the internal messageId used by sms-orchestrator and dlr-processor.

AttributeTypeDescription
iduuidInternal primary key
messageIduuidInternal message ID from sms-orchestrator
operatorMessageIdvarchar(64)MNO-assigned ID from submit_sm_resp
operatorIduuidWhich operator was used
tovarchar(20)Destination E.164 (masked in logs)
submittedAttimestampWhen submit_sm was sent
expiresAttimestampTTL for DLR correlation (default: 72 h)

1.3 DispatchCommand (Value Object — from NATS)

The inbound instruction to transmit an SMS, consumed from smpp.operator.{operatorId}.

FieldTypeDescription
messageIduuidInternal message identifier
tostringDestination E.164 number
fromstringSource address (sender ID)
textstringMessage text (UTF-8)
encodingSmsEncodingGSM7 / UCS2
operatorIduuidTarget operator (resolved by routing-engine)
accountIduuidAccount sending the message
messageTypeMessageTypeSMS / FLASH
longMessageStrategyLongMessageStrategyCSMS / TLV

2. Value Objects

Value ObjectFieldsDescription
SubmitSmPduserviceType, sourceAddr, destAddr, dataEncoding, shortMessage, messageParts[]Immutable representation of a PDU to be sent
DeliverSmPdumessageId, sourceAddr, destAddr, shortMessage, receiptedMessageId, messageStateReceived DLR PDU from MNO
TpsWindowoperatorId, windowStart, countSliding-window TPS state (Redis-backed)

3. Enumerations

enum SessionState {
DISCONNECTED = 'DISCONNECTED',
CONNECTING = 'CONNECTING',
BOUND = 'BOUND',
UNBINDING = 'UNBINDING',
UNBOUND = 'UNBOUND',
FAILBACK = 'FAILBACK',
}

enum BindMode {
TRANSCEIVER = 'TRANSCEIVER', // bind_transceiver (preferred)
TRANSMITTER = 'TRANSMITTER', // bind_transmitter (TX-only fallback)
RECEIVER = 'RECEIVER', // bind_receiver (RX-only, used with TRANSMITTER pair)
}

enum SmsEncoding {
GSM7 = 0x00, // GSM 7-bit default alphabet
UCS2 = 0x08, // Unicode (UCS-2)
}

enum LongMessageStrategy {
CSMS = 'CSMS', // Concatenated SMS headers (SAR UDH)
TLV = 'TLV', // message_payload optional parameter
}

enum DlrMessageState {
ENROUTE = 'ENROUTE',
DELIVERED = 'DELIVERED',
EXPIRED = 'EXPIRED',
DELETED = 'DELETED',
UNDELIVERABLE = 'UNDELIVERABLE',
ACCEPTED = 'ACCEPTED',
UNKNOWN = 'UNKNOWN',
REJECTED = 'REJECTED',
}

4. Session State Machine

DISCONNECTED

│ connect()

CONNECTING ──── TCP error / timeout ──────────────────────┐
│ │
│ TCP connected → send bind_transceiver │
▼ │
[awaiting bind_resp] │
│ ▼
│ bind_resp OK bind_resp error DISCONNECTED
▼ (increment reconnectAttempts,
BOUND ◄───── FAILBACK schedule backoff)
│ ▲
│ enquire_link │ MNO reconnects
│ timeout / TCP │ successfully
│ disconnect │
▼ │
UNBOUND ───────────┘

│ schedule reconnect (exponential backoff)
└──► CONNECTING

5. Reconnection Backoff Schedule

AttemptDelay
15 s
210 s
320 s
440 s
5+60 s (capped)

On successful bind, reconnectAttempts is reset to 0 and state transitions to BOUND.