SMPP Examples

This section contains one example each for the SMPP Receiver and Transmitter agents.
 

Receiver Agent

In this 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 will be set to 2, and if it is odd, the field will be set to 0.

  • The deliver_sm_resp UDR will then be routed back to the SMPP receiver agent.

Transmitter agent

In this 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"); } } } 

which will:

  • Import the SMPP Ultra formats

  • If the received UDR is of the TCP_TI type, the UDR will be named tcp_udr, and the response field in the UDR will be 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 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 will then send 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.