How to configure the SMPP phone number fields
SMPP (Short Message Peer-to-Peer) is a protocol used by telecom systems to exchange SMS messages between SMSC (Short Message Service Centers) and ESMEs (External Short Messaging Entities). A key component of the protocol is how it encodes phone numbers (source and destination addresses) in the SMPP PDU (Protocol Data Unit).
Address Parameters in SMPP
The key fields used to define a phone number in SMPP are:
- addr_ton (Type of Number)
- addr_npi (Numbering Plan Indicator)
- address_range or source_addr/destination_addr
Type of Number (TON)
This field defines the format of the number. Common values include:
Value | TON | Description |
---|---|---|
0 | Unknown | Unknown format |
1 | International | Number includes country code |
2 | National | Local number format |
5 | Alphanumeric | Used for sender names like "MyCompany" |
Numbering Plan Indicator (NPI)
This field indicates the numbering format. Common values:
Value | NPI | Description |
---|---|---|
0 | Unknown | Unknown format |
1 | ISDN (E.164) | Standard international phone number format |
3 | Data | Data network (X.121) |
Encoding an Address
When encoding a phone number in SMPP, the system sends the number as a null-terminated string in ASCII, accompanied by the appropriate TON and NPI values.
Example:
Phone number: +14155552671 TON: 1 (International) NPI: 1 (ISDN/E.164) Encoded as: 31 34 31 35 35 35 35 32 36 37 31 00 (ASCII "14155552671" + NULL)
Example SMPP PDU
Below is an example of a submit_sm PDU that includes a destination number:
0000003F // Command Length (63 bytes) 00000004 // Command ID (submit_sm) 00000000 // Command Status 00000001 // Sequence Number 74657374 // service_type: "test" 01 // source_addr_ton: International 01 // source_addr_npi: ISDN 31323334 // source_addr: "1234" (ASCII) 00 // NULL terminator 01 // dest_addr_ton: International 01 // dest_addr_npi: ISDN 2B393138 // destination_addr: "+918123456789" (ASCII, without +) 31323334 35363738 3900 // NULL terminator 00 // esm_class 00 // protocol_id 00 // priority_flag 00 // schedule_delivery_time (null) 00 // validity_period (null) 00 // registered_delivery 00 // replace_if_present_flag 00 // data_coding (default GSM) 00 // sm_default_msg_id 0D // sm_length (13) 48656C6C // Short message ("Hello, World!") 6F2C2057 6F726C64 2100
Alphanumeric Sender Example
When using an alphanumeric sender name (common for one-way bulk SMS):
Sender: "MyBrand" TON: 5 (Alphanumeric) NPI: 0 (Unknown or irrelevant) Encoded: ASCII string "MyBrand" + NULL terminator
Important Notes
- Alphanumeric sender IDs must be 11 characters or fewer.
- Alphanumeric addresses are not supported in all countries.
- Always match TON and NPI correctly with your address format to avoid routing issues.
Conclusion
SMPP number encoding is critical for ensuring proper message delivery. By setting the correct TON
, NPI
, and encoding the address correctly in ASCII (null-terminated), developers can ensure compatibility with SMSCs and mobile networks.
More information
- How to configure the SMPP Service Type field
- How to configure the SMPP Phone Number fields
- How to configure the SMPP ESM Class field
- How to configure the SMPP PID field
- How to configure the SMPP Prioirity field
- How to configure the SMPP Scheduled Time field
- How to configure the SMPP Validity Period field
- How to configure the SMPP Registered Delivery field
- How to configure the SMPP Replace if Present field
- How to configure the sm_default_msg_id field
- How to configure the SMPP DCS field
- How to calculate the SMPP SM Length field
- How to put data into the SMPP SM field