Understanding the SMPP PID Field

What is the SMPP PID Field?

The Protocol Identifier (PID) in SMPP (Short Message Peer-to-Peer Protocol) is a 1-byte field within SMPP PDUs (Protocol Data Units). It identifies the protocol used by the originating system or provides special instructions for message handling. The PID field is defined in the submit_sm, deliver_sm, and data_sm operations and is critical for:

  • Specifying higher-layer protocols (e.g., X.400, Telnet)
  • Triggering special message types (e.g., voice mail notifications)
  • Handling message replacement (e.g., overwriting existing messages)

PID Structure and Bitmask

The PID is a bitmask where specific bits control protocol behavior. Its structure aligns with GSM 03.40 specifications:

Bits Description
7-5 Protocol Type: Indicates the protocol (e.g., GSM, Telex, or SMS).
4-0 Instructions/Flags: Special handling (e.g., replace message, voice mail).

Key PID Values and Interpretation

PID (Hex) Binary Description
0x00 00000000 Default (no special protocol)
0x01 00000001 Telex (obsolete)
0x03 00000011 X.400 (obsolete)
0x40 01000000 Return call message (SIM card handling)
0x41 01000001 Replace Short Message (overwrite existing)
0x42 01000010 Voice mail notification
0x7F 01111111 Reserved for future use
Note: Values like 0x40–0x7F are network-specific and may vary by SMSC. Always verify with your provider.

Use Cases and Scenarios

1. Message Replacement (PID=0x41)

Used to overwrite an existing message stored on the recipient's device. Common in OTP (One-Time Password) systems where a new password replaces the old one.

2. Voice Mail Notification (PID=0x42)

Triggers a visual/audible alert on the recipient's device for a new voice mail. The SMS body is often empty, as the PID itself is the trigger.

3. SIM Data Download (PID=0x40)

Instructs the SIM card to process the message (e.g., updating preconfigured settings).

Example SMPP PDUs with PID

Example 1: Default PID (0x00)

0000001D  // Command Length (29 bytes)
00000004  // Command ID (SubmitSM)
00000001  // Sequence Number
00        // Source TON
00        // Source NPI
736F7572636500  // Source Address ("source")
00        // Dest TON
00        // Dest NPI
36353433323100  // Destination Address ("654321")
00        // ESM Class
00        // Protocol ID (PID=0x00)
00        // Priority Flag
00        // Schedule Delivery Time
00        // Validity Period
00        // Registered Delivery
00        // Replace-if-Present
00        // Data Coding Scheme (DCS=0x00)
00        // SM Default Message ID
07        // SM Length (7 septets)
C8329BFD06DDDF72  // Payload ("Hello!")
    

Example 2: Voice Mail Notification (PID=0x42)

0000001D  // Command Length (29 bytes)
00000004  // Command ID (SubmitSM)
00000002  // Sequence Number
00        // Source TON
00        // Source NPI
736F7572636500  // Source Address ("source")
00        // Dest TON
00        // Dest NPI
36353433323100  // Destination Address ("654321")
00        // ESM Class
42        // Protocol ID (PID=0x42: Voice Mail)
00        // Priority Flag
00        // Schedule Delivery Time
00        // Validity Period
00        // Registered Delivery
00        // Replace-if-Present
00        // Data Coding (DCS=0x00)
00        // SM Default Message ID
00        // SM Length (0 bytes: No payload)
    

Example 3: Replace Existing Message (PID=0x41)

0000001D  // Command Length (29 bytes)
00000004  // Command ID (SubmitSM)
00000003  // Sequence Number
00        // Source TON
00        // Source NPI
736F7572636500  // Source Address ("source")
00        // Dest TON
00        // Dest NPI
36353433323100  // Destination Address ("654321")
00        // ESM Class
41        // Protocol ID (PID=0x41: Replace)
00        // Priority Flag
00        // Schedule Delivery Time
00        // Validity Period
01        // Registered Delivery (receipt requested)
00        // Replace-if-Present
00        // Data Coding (DCS=0x00)
00        // SM Default Message ID
07        // SM Length (7 septets)
C8329BFD06DDDF72  // Payload ("New OTP: 1234")
    

PID Interaction with TP-Protocol-Identifier (GSM)

In GSM networks, the PID maps to the TP-Protocol-Identifier in SMS TPDUs. Key mappings include:

  • 0x41: Replace Command (GSM 03.40 TP-PID=0x41)
  • 0x42: Voice Mail (GSM 03.40 TP-PID=0x42)

Common Pitfalls

  • Using reserved PID values (e.g., 0x7F) without SMSC support.
  • Mismatching PID and DCS (e.g., using UCS2 encoding for SIM data).
  • Ignoring network-specific rules (e.g., PID=0x40 may require special SMSC configuration).

Conclusion

The PID field is essential for advanced SMS routing and handling. While often set to 0x00 (default), its specialized values enable features like message replacement, SIM updates, and voice mail alerts. Always test PID configurations with your SMSC and refer to the GSM 03.40 or SMPP v5.0 specifications for precise behavior.

More information