Tuesday 28 February 2017

SMPP PDU



I think you know about what is SMPP, Purpose of SMPP and what are the various PDU available. If not, You can refer my previous post (by clicking here) to get an idea about it. Now, I am going about explain Bind PDU or SMPP session establishing PDU. Okay lets start....,


SMPP Bind or Session Management PDU :


Bind PDU is the initial one, Which is sent by ESME to SMSC through established network connection (socket connection using TCP) for creating SMPP session between ESME and SMSC.
Once, Connection request received from ESME, SMSC validates such as ESME is authorized access SMSC or not. If authorized, SMSC sends success response to ESME and establishes the SMPP session for further communication. If not authorized, SMSC sends failure response and discard the established network connection (socket connection using TCP) between SMSC and ESME.


Types of Session Management PDU :
  • Bind Trasmitter
  • Bind Receiver
  • Bind Transceiver

Bind Transmitter : (Half duplex)


A connected ESME sends transmitter bind request (using bind_transmitter PDU) to SMSC and receives response from SMSC for sent transmitter bind request. As I said early, Response can be success or failed. In success case, ESME transmitter can send short message (SMS) to SMSC and gets response for sent SMS from SMSC. ESME transmitter can send short message using submit_sm or replace_sm or query_sm PDU to SMSC. In failed case, SMSC closes the connection and will not allow communicating further.





Bind Receiver : (Haf duplex)


A connected ESME sends receiver bind request (using bind_receiver PDU) to SMSC and receives response from SMSC for sent receiver bind request. In success response, ESME receiver can receive PDU from SMSC such as deliver_sm or short messages (If SMSC needs to send SMS ESME). In failed response, SMSC closes the connection and will not allow communicating further.



Bind Transceiver : (Full duplex)


A connected ESME sends transceiver bind request (using bind_transceiver PDU) to SMSC and receives response from SMSC for sent transceiver bind request. In success response, ESME has access for send to SMSC and receive from SMSC on same connection. Such as submit_sm, deliver_sm, replace_sm, query_sm and others.


Parameters of Session PDU :


Header : Fixed for all SMPP PDUs


  • command_length
  • command_id
  • command_status
  • sequence_number
command_length :


It defines total length of the PDU packet including length field. The command_legth is type of integer and size is 4 octets. In this case, Overall length of bind_trasmitter or bind_receiver or bind_transceiver PDU.


command_id :
It is used to identify the what kind of SMPP PDU packet such as bind_transmitter, bind_receiver, bind_transceiver, bind_transmitter_resp, bind_receiver_resp, bind_transceiver_resp. The command_id is type of integer and size is 4 octets.


command_status :


It indicates the success or failure of sent SMPP request PDU. It is applicable for SMPP response PDU and It has to be NULL for SMPP request PDU. The command_status is type of integer and size is 4 octets.


sequence_number :


The sequence number contains unique transaction id and It is common factor in both request and response PDU of same transactions. The sequence_number field is generates by requester (request PDU) and response will be sent with same sequence_number from response (response PDU). Integer type and size is 4 octets.


Body :


Body contains mandatory and optional parameters and each PDU's body parameters may be different. Now, I am listing bind PDU's body parameters.
  • system_id
  • password
  • system_type
  • interface_version
  • addr_ton
  • addr_npi
  • address_range

system_id :


It allows SMSC to identify ESMS's system id and It is unique. Usally system_id generated by SMSC and provided to ESME for ensuring that the ESME is authorized to access SMSC. The system_id is type of C-style characters and size can be variable but max allowed upto 16 characters.


password :


Each system id has own password and It is used by SMSC to authenticate ESME bind request. The password is type of C-style characters and size can be variable but mac allowed upto 9 characters.

system_type :


To identify about bind requested ESME system such as what kind of system and purpose of system. The system_type is type of C-style character and max size can be 13 characters.


interface_version :
In denotes SMPP protocol version used by ESME such as 3.3 or 3.4 or 4.0 or 5.0. The interface_type is type of integer and size is 1 octet.


addr_ton :


Indicates Type of Number of ESME address and If not known can set as 0. Integer type and size is 1 octet.


addr_npi :


Indicates Numbering Plan Indicator of EMSE address and If unknown , Set as 0. Integer type and size is 1 octet.


address_range :


It contains ESME address, If not known set as NULL. Type of C-style character and max size allowed is 41 characters.


Example packet format :

00 00 00 2F 00 00 00 09 00 00 00 00 00 00 00 00 01 62 75 6c 6b 73 6d 73 00 62 75 6c 6b 31 32 33 00 53 4d 50 50 00 03 01 01 00


Header :


00 00 00 2F command_length 0x0000002F
00 00 00 09 command_id 0x00000009 (bind_transceiver)
00 00 00 00 command_status 0x00000000 (Usally request PDU contains 0)
00 00 00 01 sequence_number 0x00000001 (Unique number to identify)


Body :


62 75 6c 6b 73 6d 73 00 system_id bulksms padded with 0
62 75 6c 6b 31 32 33 00 password bulk123 padded with 0
53 4d 50 50 00 system_type SMPP padded with 0
03 interface_version 3
01 addr_ton 1
01 addr_npi 1
00 address_range 0

Response PDU for Bind request PDU :


Each bind request has it's own response PDU, Which is sentd by SMSC to ESME. All the bind response PDU has same structure and parameters in header and body portion.  Find the below list of response PDU,
  • bind_transmitter_resp
  • bind_receiver_resp
  • bind_transceiver_resp

Header parameters:
  • command_length
  • command_id
  • command_status
  • sequence_number

Body parameter :

system_id :


You can refer meaning of all parameter on above, Which i have mentioned in Request PDU of bind request.


Important note : The body portion of SMPP bind response PDU is not returned if the command_status parameter contains a non zero value. If there is any error in request PDU formation, SMSC will response with corresponding SMPP error code.

Example PDU for response :


00 00 00 2D 08 00 00 09 00 00 00 00 01 00 00 00 01 62 75 6c 6b 73 6d 73 00


Header :


00 00 00 2D command_length 0x0000002D
08 00 00 09 command_id 0x80000009 (bind_transceiver_resp)
00 00 00 01 command_status 0x00000001
00 00 00 01 sequence_number 0x00000001 (Unique number to identify)


Body :

62 75 6c 6b 73 6d 73 00 system_id bulksms



I hope it has been useful. If anything required, Please ping in comment section , I can help for your queries. Thank you for visiting!!!. I will explain little bit more about PDU and It's uses.