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.
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
- You are creating a SMPP client. Clients usually initiate connections. Clients are also known as ESME (External Short Message Entity).
- Your client will connect to a SMSC. SMSC are servers and they usually wait for connections.
- An ESME can send messages via "submit_sm" or "data_sm" PDU.
Setup-2: You are creating a SMSC
- 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,
- An ESME can send messages via "submit_sm" or "data_sm" PDU. data_sm is not frequently used.
- 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);
I have followed @Wahid's answer to create deliver_sm request from SMSC server to SMPP Transceiver. I was confused about creating/getting session instance. I did it by getting session instance from PDUProcessorGroup , which we instantiated during starting SMSC session, traversed it to get SimulatorPDUProcessor instance and got session instance from that.
int procCount = processors.count();
SimulatorPDUProcessor proc;
SMSCSession session=null;
for (int i = 0; i < procCount; i++) {
proc = (SimulatorPDUProcessor) processors.get(i);
session = proc.getSession();
}
return session;
If you want to deliver such a solution, check the built in SMPP server of Ozeki. It does exactly this. To view the SMPP deliver sm pdu when it is sent over the network the best tool to use is Wireshark, because it lets you see the pdu on a byte level basis. The ozeki sms gateway SMPP simulator does what you want. It first opens a listener TCP/IP socket, and it lets SMPP clients bind to it, then when an incoming SMS is simulated (or received rom the mobile network), it covnerts it and sends it as an SMPP deliver_sm request.
Disclaimer: I work for Ozeki.
© 2022 - 2024 — McMap. All rights reserved.