1. Introduction to SMPP and SMSC
SMPP - Short Message Peer to Peer protocol is an open, industry standard protocol designed to provide a flexible data communications interface for transfer of short message data between a Message Center, such as a Short Message Service Centre (SMSC), GSM Unstructured Supplementary Services Data (USSD) Server or other type of Message Center and a SMS application system, such as a WAP Proxy Server, EMail Gateway or other Messaging Gateway.The advantage of supporting SMPP protocol with the Axis2 SMS Transport is it can be use to send receive high volume of Short messages very fast.SMPP protocol is a Application layer protocol which can be used over TCP. There are many SMPP gateways available in the world.and now almost all the Message centers support SMPP.
Use case 01
There is HTTP SMS API and user can invoke it with http call with JSON. API is able to send a SMS for the request number in JSON request with message in JSON
2. Pre-requirement
- JSMPP lib
JSMPP is a java implementation of SMPP protocol. It provides an API to communicate with a SMSC and JSMPP can be download from here (http://central.maven.org/maven2/com/googlecode/jsmpp/jsmpp/)
- A SMSC Simulator
SMSC Simulator is an application which can be act like a SMSC. Using a simulator we can test our scenario without having access to a real SMSC. For the real production servers we have to use a real SMSC. In here we will be using OpenSmpp (https://github.com/OpenSmpp/opensmpp)
- SMPP connector for ESB
It can be download from here. (https://store.wso2.com/store/assets/esbconnector/details/1f5ca0e2-3fe0-42e5-ae9b-05af1f8e361b)
3. Setting the SMSC Simulator
3.1. Get Git clone on OpenSmpp and build it.
3.2. Create the ‘users.txt’ file in ‘etc’
3.3. Add following contain for the file
name=wso2esb
password=passesb
timeout=unlimited
3.4. Start the simulator with below command
java -cp opensmpp-core-3.0.3-SNAPSHOT.jar;opensmpp-sim-3.0.3-SNAPSHOT.jar;opensmpp-charset-3.0.3-SNAPSHOT.jar org.smpp.smscsim.Simulator
3.5. Enter ‘1’ to ‘start simulation’ and give the port number as ‘2775’.
Then it will start a listener and it is notified with log message as below
4. Setting up the ESB
4.1 Add the ‘jsmpp_2.1.0.jar’ to lib directory in ESB or EI
4.2 Add the SMPP Connector to the WSO2 ESB from web console or developer studio
5. Creating API
5.1 Create API in wso2 ESB with “POST” method.
5.2 You can get full WSO2 ESB API from here.
5.3 Here is JSON request to pass for that newly created API.
6. Testing API with OpenSmpp
6.1 Send the JSON request from post-man (You will get 202 status respond)
6.2 You will able to see some logs in you simulator as below, such as ‘Connection accepted’
6.3 In simulator when you press ‘5’ You should see SMS you send from API on ESB.
References
[1] https://docs.wso2.com/display/ESBCONNECTORS/Sending+SMS+Message#SendingSMSMessage-Overview
View comments