Inetlab SMPP SMS-无法获取交货状态

时间:2018-07-28 18:56:23

标签: .net

我正在尝试获取使用Inetlab SMPP发送SMS的传递状态。实际上,我想要获取交货状态的异步功能。当我搜索时,我找不到像异步函数之类的东西。因此,我确实尝试了从Inetlab授权站点获得的以下代码。但是,即使通过电话收到了SMS,我仍然无法获得其发送状态。而且我无法在evDeliverSm事件上达到断点。

注意:
1.如何使用异步功能获取交货状态。
2.为什么无法触发evDeliverSm事件。
3.如何使用同步子请求获得实际的交付状态。

版本:InetSMPP版本1.2.6779.26484。


_client.evDeliverSm += new Inetlab.SMPP.Common.DeliverSmEventHandler(client_evDeliverSm);
            IList<SubmitSmResp> respList = _client.Submit(Inetlab.SMPP.SMS.ForSubmit()
                 .Text(message)
                 .From(from)
                 .To(to)
                 .Coding(coding)
                 .DeliveryReceipt()
                 );


private void client_evDeliverSm(object sender, DeliverSm data)
    {
        try
        {
            //Check if we received Delivery Receipt
            if (data.MessageType == MessageTypes.SMSCDeliveryReceipt)
            {
                //Get MessageId of delivered message
                string messageId = data.Receipt.MessageId;
                MessageState deliveryStatus = data.Receipt.State;
            }
            else
            {
                // Receive incoming message and try to concatenate all parts
                if (data.Concatenation != null)
                {
                    _composer.AddMessage(data);
                    _log.Info(string.Format(
                         "DeliverSm part received : Sequence : {0} SourceAddr : {1}" +
                         " Concatenation ( {2} ) Coding : {3} Text : {4}",
                         data.Sequence, data.SourceAddr, data.Concatenation, data.DataCoding, data.MessageText));
                    if (_composer.IsLastSegment(data))
                    {
                        string fullMessage = _composer.GetFullMessage(data);
                        _log.Info("Full message: " + fullMessage);
                    }
                }
                else
                {
                    _log.Info("DeliverSm received : "
                          + " Sequence : " + data.Sequence
                          + " SourceAddr : " + data.SourceAddr
                          + " Coding : " + data.DataCoding
                          + " MessageText : " + data.MessageText);
                }
            }
        }
        catch (Exception ex)
        {
            data.Response.Status = CommandStatus.ESME_RX_T_APPN;
            _log.Error("Failed to process DeliverSm", ex);
        }
    }

0 个答案:

没有答案