如何从 SMSC 发送 Deliver_sm 请求

发布于 2024-11-24 20:45:17 字数 193 浏览 3 评论 0原文

我正在创建一个应用程序,我的机器将充当 SMSC。从那里我只需要发送 Deliver_sm。服务器将发送绑定请求。我需要将我的机器与服务器绑定。我的应用程序将像 smpp 客户端一样工作。我有logica smpp.jar。但我很困惑如何只发送 Deliver_sm。请给我一些想法和代码。 任何bdy都可以告诉我如何发送出站请求吗,这对我也很有帮助。 谢谢 库希克。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

烟若柳尘 2024-12-01 20:45:17

你的问题无法以现在的方式得到解答。我在下面解释了两种可能的设置,然后解释了您正在寻求的解决方案。我的答案基于 SMPP 3.4 规范

设置

设置-1:您正在创建 SMPP 客户端

  1. 您正在创建 SMPP 客户端。客户端通常会发起连接。客户端也称为 ESME(外部短消息实体)。
  2. 您的客户端将连接到 SMSC。 SMSC 是服务器,它们通常等待连接。
  3. ESME 可以通过“submit_sm”或“data_sm”PDU 发送消息。

设置 2:您正在创建 SMSC

  1. SMSC 可以通过“deliver_sm”或“data_sm”PDU 发送消息。

发起连接

通常ESME会向SMSC发送绑定请求。绑定请求可以通过“bind_transmitter”、“bind_receiver”或“bind_transceiver”PDU之一发送。

SMSC 可以急切地邀请 ESME 通过“outbind”PDU 发送绑定请求。在这种情况下,SMSC 必须知道 ESME 的 IP/端口。它很少被使用。

的片段,

//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

这是发送出站请求发送消息

我已经在设置部分讨论过这一点。此处重复,

  1. ESME 可以通过“submit_sm”或“data_sm”PDU 发送消息。 data_sm 不经常使用。
  2. SMSC 可以通过“deliver_sm”或“data_sm”PDU 发送消息。 data_sm 不经常使用。

我不知道为什么只发送“deliver_sm”如此重要。作为编码员,您可以控制要发送的 PDU 类型。

这是发送 Deliver_sm 请求的片段

//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);

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);
煮酒 2024-12-01 20:45:17

我已按照@Wahid的回答创建从SMSC服务器到SMPP收发器的deliver_sm请求。我对创建/获取会话实例感到困惑。
我通过从 PDUProcessorGroup 获取会话实例来完成此操作,我们在启动 SMSC 会话期间实例化该实例,遍历它以获取 SimulatorPDUProcessor 实例并从中获取会话实例。

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;

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;
熊抱啵儿 2024-12-01 20:45:17

如果您想提供这样的解决方案,请检查 Ozeki 的内置 SMPP 服务器。它正是这样做的。要查看通过网络发送的 SMPP 传递 sm pdu,最好使用的工具是 Wireshark,因为它可以让您在字节级别上查看 pdu。 ozeki 短信网关 SMPP 模拟器 的功能你想要的。它首先打开一个侦听器 TCP/IP 套接字,让 SMPP 客户端绑定到它,然后当模拟传入的 SMS(或从移动网络接收到)时,它会对其进行处理并将其作为 SMPP Deliver_sm 请求发送。

免责声明:我为 Ozeki 工作。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文