The library has an example for each PDU on SMPP-3.4 protocol. The applications are executed without parameters and the idea is to test the API functions through a serie of steps.
To declare two variables of the same type and to assign values to one of them.
Apply a PDU dump to the first data structure. It will show all data components of de object data.
Pack the structure into a buffer and dump it.
Unpack this buffer over the second variable defined in the first point.
Do a dump of the second structure.
We have added a little ESME that submits a message. The sintax to run the ESME is.
[rtremsal@localhost bin]$ ./esme Error in parameters usage: ./esme -c file.xml [-h] -c /path/to/file.xml: config file path. -h : Help, show this message. [rtremsal@localhost bin]$ more esme.xml <?xml version="1.0"?> <config> <conn_tcp host="127.0.0.1" port="9090"/> <conn_smpp system_id="sytem" password="asdfg34" system_type="type01"/> <smpp_msg src="5565" dst="0911110000" msg="Este es un ejemplo 01"/> </config> |
The config file has parameters to made the connection tcp, the connection smpp and the parameters to send a message. This application is ejecuted by:
[rtremsal@localhost bin]$ ./esme -c esme.xml Error in connect(127.0.0.1:9090) Error in tcp connect. [rtremsal@localhost bin]$ ./esme -c esme.xml ----------------------------------------------------------- SENDING PDU command_length [00000029] - [41] command_id [00000002] - [BIND_TRANSMITTER] command_status [00000000] - [ESME_ROK] : : : ----------------------------------------------------------- RECEIVE BUFFER 00 00 00 10 80 00 00 06 00 00 00 00 00 00 00 03 ........ ........ RECEIVE PDU command_length [00000010] - [16] command_id [80000006] - [UNBIND_RESP] command_status [00000000] - [ESME_ROK] sequence_number [00000003] - [3] |
In the first case, a smpp server is not present, then there was an error in the tcp level. In the second case, helped by a test smpp client program sctt - (SMPP Client Test Tool). available in SMS Forum (http://www.smsforum.com).
In the second case, the internal operations that allow sending a message are:
Connect the ESME in TCP level.
Connect the ESME in SMPP level through PDU BIND with validation parameters (We connect in TRANSMITTER mode), wait for a confirmation through PDU BIND_TRANSMITER_RESP.
Send the message (SUBMIT_SM PDU) and receive the confirmation in SUBMIT_SM_RESP PDU.
Disconnect the ESME in SMPP level sending UNBIND PDU, we wait for a confirmation UNBIND_RESP PDU.
Disconnect the ESME in TCP level closing the socket.
Although this example is very basic it allow us to see in detail the function of the library inside an ESME.