Sending a message from SMSC Simulator to WSO2 ESB using SMPP Transport

Photo by Adem AY on Unsplash

This post describes how a proxy service deployed in WSO2 ESB can be invoked using a SMS message sent from a SMSC.

Following steps will guide you through this process.

1) Please use the following SMS transport receiver in the <ESB_HOME>/repository/conf/axis2/axis2.xml to enable SMS receiving in the ESB.

<transportReceiver name="sms"
class="org.apache.axis2.transport.sms.SMSMessageReciever">

2) Download axis2 SMPP transport jar from here and copy it to <ESB_HOME>/repository/components/lib folder.

3) Download JSMPP from [1] unzip it and copy the jsmpp-2.1.0.jar to <ESB_HOME>/repository/components/lib folder. JSMPP is a java implementation of the SMPP protocol which provides and API to communicate with the SMSC.

Now when you start the ESB server it is ready accept messages coming via the SMS trasnport on port 2775. Let’s have a look at how a SMSC simulator can be used to send SMS to the ESB.

4) Checkout open smpp source from [2] and build it with maven.

5) Create a new directory called SMSC and copy <OPENSMPP_SOURCE_HOME>/sim/target/opensmpp-sim-3.0.1-SNAPSHOT.jar and <OPENSMPP_SOURCE_HOME>/core/target/opensmpp-core-3.0.1-SNAPSHOT.jar into it.

6) Create a new directory SMSC/etc and copy the <OPENSMPP_SOURCE_HOME>/sim/users.txt into it.

7) Execute the following command from within the SMSC directory to start the SMSC.

java -cp ./opensmpp-core-3.0.1-SNAPSHOT.jar:opensmpp-sim-3.0.1-SNAPSHOT.jar org.smpp.smscsim.Simulator

8) you will get a command line program interface like the following when you run the simulator.

- 1 start simulation
— 2 stop simulation
— 3 list clients
— 4 send message
— 5 list messages
— 6 reload users file
— 7 log to screen off
— 0 exit
>

9) Start the simulator on port 2775 by selecting option 1.

10) Start the ESB and in the server startup logs you will see “[Axis2] bind and connect to localhost : 2775 on SMPP Transport” log if your ESB was able to successfully connect to the SMSC.

11) Create a passthrough proxy called smsTest and tick the sms transport from the Transports section in the proxy creation page.

12) Send message by selecting option 4 from the simulator. The message format is as follows according to [3].

SMS message format: proxy_service_name:action:name1=value1:name2=value2

e.g. smsTest:mediate

13) You can see that the proxy is triggered from the ESB logs.

You can build a message and send to any endpoint that you prefer from within the proxy.

[1] https://jsmpp.googlecode.com/files/jsmpp-2.1.0-bin.zip
[2] https://github.com/OpenSmpp/opensmpp
[3] https://axis.apache.org/axis2/java/transports/sms.html

Originally published at http://gayanlggd.wordpress.com on December 19, 2014.