SMPP Examples(4.1)
This section contains SMPP Receiver and Transmitter agent examples.
Â
Receiver Agent
Workflow example for the SMPP Receiver agent:
Receiver workflow example
The SMPP Receiver agent sends DELIVER_SM UDRs to the Analysis agent, which contains the following code:
consume { DELIVER_SM_RESP deliver_sm_resp = udrCreate(DELIVER_SM_RESP); if ((input.sequence_number % 2) == 0) { deliver_sm_resp.command_status = 2; } else { deliver_sm_resp.command_status = 0; } udrRoute(deliver_sm_resp); }
With this code, the Analysis agent will:
Create a UDR of
DELIVER_SM_RESP
type called deliver_sm_resp.Check whether the sequence number in the incoming
DELIVER_SM
UDR is even or odd.If the sequence number is even, theÂ
command_status
 field in the deliver_sm_resp UDR is set to two (2), and if it is odd, the field is set to zero (0).The deliver_sm_resp UDR is then routed back to the SMPP Receiver agent.
Transmitter Agent
Workflow example for the SMPP Transmitter agent:
Transmitter workflow example
The TCP/IP agent sends TCP_TI UDRs into the workflow using a decoder that defines this UDR type.
The Analysis agent contains the following code:
import ultra.SMPP; consume { if (instanceOf(input, TCP_TI)) { TCP_TI tcp_udr = udrCreate(TCP_TI); tcp_udr = (TCP_TI) input; strToBA(tcp_udr.response, "message=" + tcp_udr.message + "\r\n"); SUBMIT_SM submit_sm = udrCreate(SUBMIT_SM); bytearray sm; strToBA(sm, "MESSAGE", "UTF-16BE"); submit_sm.short_message = sm; submit_sm.data_coding = 8; submit_sm.source_addr = "555123456"; submit_sm.destination_addr = "555987654"; udrRoute(tcp_udr, "OUT_TCP"); udrRoute(submit_sm, "OUT_SMPP"); } } }Â
This code will:
Import the SMPP Ultra formats.
If the received UDR is of the TCP_TI type, the UDR is named tcp_udr, and theÂ
response
 field in the UDR is populated with the text "message=<contents of the message field>" in bytearray format.Create a UDR of type SUBMIT_SM called submit_sm.
Create a bytearray object called sm, and populate this bytearray with the text "MESSAGE" in bytearray format with UTF-16BE encoding.
Populate theÂ
short_message
 field in the submit_sm UDR with the new bytearray.Set the data coding to eight (8), which equals the UTF-16BE encoding according to the specification.
Set the source address to 555123456 and the destination address to 555987654.
Route the submit_sm UDR to the SMPP transmitter agent, and the tcp_udr UDR to the TCP/IP agent.
The SMPP Transmitter agent then sends SUBMT_SM_RESP
UDRs back to the Analysis agent when receiving the corresponding SUBMIT_SM_RESP
UDRs from the SMSC. The SUBMIT_SM_RESP
UDRs contain the original SUBMIT_SM
for which the SMSC has responded.