Receive delivery message from SMSC InteLab SMPP

1.3k views Asked by At

I have tried this weeks and still I couldn't figure out how to get delivery messages after sent SMS from SMSC. I have used Intelab SMPP and developed a sms system. I have used following codes to get Delivery receipt and I got the receipt successfully with MessageId.

public static IList<SubmitSmResp> ConnectToInet(string sourceAddress, string DestinationAddress, string Message)
    {
        try
        {
            SmppClient client = new SmppClient();
            IList<SubmitSmResp> respList = null;
            client.Connect(#SMSSeverIP, #PORT);

            if (client.Status == Inetlab.SMPP.Common.ConnectionStatus.Open)
            {
                client.Bind("USERNAME", "Password", Inetlab.SMPP.Common.ConnectionMode.Transceiver);

                if (client.Status == Inetlab.SMPP.Common.ConnectionStatus.Bound)
                {
                    client.AddrTon = 5;

                    respList = client.Submit(
                        SMS.ForSubmit().From(sourceAddress).To(DestinationAddress).Text(Message).DeliveryReceipt().Coding(DataCodings.Default)
                        );


                    //client.Submit(SMS.ForSubmit().Text(Message).From(sourceAddress).To(DestinationAddress).DeliveryReceipt().Coding(DataCodings.Default));

                    client.evDeliverSm += new Inetlab.SMPP.Common.DeliverSmEventHandler(OnDeliverSm);




                    client.UnBind();
                }

                client.Disconnect();
            }
            return respList;
        }
        catch (Exception ex)
        {
            throw ex;
        }


    }

And I the DeliverSm method is using to get delivery receipt which I have able to receive delivery receipt successfully.

private static void OnDeliverSm(object sender, DeliverSm data)
    {
        string messageText = data.Client.GetMessageText(data.UserDataPdu.ShortMessage, data.DataCoding);
    }

I have stored the received MessageId from each SMSC response and I need to use it to get the corresponding delivery report of each message with delivery status, delivered date and submitted date. Can someone help me to figure this out. Thank you for the help!

0

There are 0 answers