how to send deliver_sm request from SMSC

user778900 picture user778900 · Jul 18, 2011 · Viewed 10.7k times · Source

i am creating an application where my mechine will act like a SMSC. And from there i need to send only deliver_sm. The server will send the bind request. I need to bind my mechine with the server. My application will work like a smpp client. I have logica smpp.jar. But i am confused how to send only deliver_sm. Please give me some ideas and code. can anybdy please tell me how to send outbound request,,that will also be very helpful for me. thanks koushik.

Answer

Wahid Sadik picture Wahid Sadik · Jul 30, 2011

Your question cannot be answered the way it is presented now. I explained two possible setups below and then solutions you are seeking. My answers are based on SMPP 3.4 spec.

Setup

Setup-1: You are creating a SMPP client

  1. You are creating a SMPP client. Clients usually initiate connections. Clients are also known as ESME (External Short Message Entity).
  2. Your client will connect to a SMSC. SMSC are servers and they usually wait for connections.
  3. An ESME can send messages via "submit_sm" or "data_sm" PDU.

Setup-2: You are creating a SMSC

  1. A SMSC can send messages via "deliver_sm" or "data_sm" PDU.

Initiating connection

Usually ESME will send a bind request to SMSC. A bind request can be send via one of "bind_transmitter", "bind_receiver" or "bind_transceiver" PDU.

The SMSC can be eager and invite an ESME to send bind request via "outbind" PDU. In this case, the SMSC has to know the IP/port of the ESME. It is rarely used.

Here a snippet of sending outbind request

//you will need these classes
import org.smpp.Session;
import org.smpp.pdu.Outbind;

Session session = .... ;//Assuming you created a session instance
Outbind outbind = new Outbind(...);//assuming you created a outbind instance

session.outbind(outbind);//send outbind

Sending messages

I already discussed this in the setup part. Repeating here,

  1. An ESME can send messages via "submit_sm" or "data_sm" PDU. data_sm is not frequently used.
  2. A SMSC can send messages via "deliver_sm" or "data_sm" PDU. data_sm is not frequently used.

I am not sure why sending only "deliver_sm" is so important. As coder, you have control over the kind of PDU you are going to send.

Here a snippet of sending deliver_sm request

//you will need these classes
import org.smpp.Session;
import org.smpp.pdu.DeliverSM;

DeliverSM pdu = new DeliverSM();
pdu.setSequenceNumber(1);//set unique numbers
pdu.setSourceAddr(new Address(1, 1, "12120001234"));//TON, NPI, source number
pdu.setDestAddr(new Address(1, 1, "12120004321"));//TON, NPI, destination number
pdu.setShortMessage("Hello world");
session.deliver(pdu);