How to configure the sm_default_msg_id field
The sm_default_msg_id
field is part of the submit_sm
and deliver_sm
PDUs in the SMPP (Short Message Peer-to-Peer) protocol. It is used to reference pre-defined (built-in) short messages stored on the SMSC, typically by a numeric ID.
Field Details
- Field Name: sm_default_msg_id
- Size: 1 byte (unsigned integer)
- Range: 0–255
- Usage: Indicates which default message to send (if any)
Usage Description
The sm_default_msg_id
field allows a user to request that the SMSC send a pre-defined message from its internal message store. This can be useful in constrained environments or for sending standard system messages without transmitting the full text each time.
Default Behavior
- If
sm_default_msg_id = 0
, then the user-defined message content inshort_message
is used instead. - If
sm_default_msg_id > 0
, then the message with that ID is used, and theshort_message
field should typically be empty or ignored by the SMSC.
Common Practice
In most modern SMS systems and APIs, sm_default_msg_id
is not used and is typically set to 0
. The actual message content is sent via the short_message
field.
Example PDU with Default Value
0000003B // Command Length (59 bytes) 00000004 // Command ID: submit_sm 00000000 // Command Status 00000001 // Sequence Number 00 // service_type 01 // source_addr_ton 01 // source_addr_npi 31323334 // source_addr ("1234") 00 01 // dest_addr_ton 01 // dest_addr_npi 35363738 // destination_addr ("5678") 00 00 // esm_class 00 // protocol_id 00 // priority_flag 00 // schedule_delivery_time 00 // validity_period 00 // registered_delivery 00 // replace_if_present_flag 00 // data_coding 00 // sm_default_msg_id = 0 (use short_message) 05 // sm_length 48656C6C6F // short_message = "Hello"
Example PDU with Predefined Message ID
... 00 // sm_default_msg_id = 1 (use predefined message 1) 00 // sm_length (empty) // short_message is empty or ignored
When to Use
While rare, you might use sm_default_msg_id
when:
- Working with legacy SMSC implementations that support predefined messages
- Sending high-volume, repetitive system alerts or templates stored on the SMSC
- You are advised by your SMS provider to use this feature
Important Considerations
- If
sm_default_msg_id > 0
, some SMSCs may ignoreshort_message
entirely. - If both are used, the behavior is implementation-specific. Always test or check documentation.
- Setting a non-zero value without a valid predefined message ID may result in delivery failure or message rejection.
Conclusion
The sm_default_msg_id
field is a legacy feature of the SMPP protocol that allows referencing default message templates stored on the SMSC. While it's largely unused in modern systems, understanding its role helps ensure compatibility when working with legacy gateways or custom SMSC implementations.
References
- SMPP 3.4 Protocol Specification
- Vendor-specific SMPP SMSC documentation
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