请问在接收短信时,能获取到发送者的手机号码吗

分享

现在有一个业务需求是这样的,业务系统通过短信猫发送短信通知给用户,用户根据提示回复一个数字表示是否收到通知,这个时候,业务系统在收到短信后需要根据手机号来判断是谁回复的。
我看了一下接收消息的示例程序,好像没有看到发送者的手机号信息:


以下是二次开发包里的示例程序:

public class InboundNotification implements IInboundMessageNotification
        {
                public void process(String gatewayId, MessageTypes msgType, InboundMessage msg)
                {
                        if (msgType == MessageTypes.INBOUND) System.out.println(">>> New Inbound message detected from Gateway: " + gatewayId);
                        else if (msgType == MessageTypes.STATUSREPORT) System.out.println(">>> New Inbound Status Report message detected from Gateway: " + gatewayId);
                        System.out.println(msg);
                        try
                        {
                                // Uncomment following line if you wish to delete the message upon arrival.
                                // srv.deleteMessage(msg);
                        }
                        catch (Exception e)
                        {
                                System.out.println("Oops!!! Something gone bad...");
                                e.printStackTrace();
                        }
                }
        }


短信设备二次开发 2022-04-06 0 0

admin

  • 注册时间 : 2022-03-30 04:08:47
  • 邮箱地址 : admin@tenghengkeji.com
  • 此页面用于展示用户的基本上资料信息

回帖 ( 0 )