failed to read delivery receipt

.NET library for SMPP protocol
Locked
faizalmzain
Posts: 1
Joined: Thu Aug 02, 2012 4:40 am

failed to read delivery receipt

Post by faizalmzain » Thu Aug 02, 2012 5:08 am

i have problem in reading delivery receipt data, it can capture the messagetype correctly but failed at reading. Please find the log below:

12:58:40 PM: Sending Data: 000000890000000400000000090c22740000003431313134000101363031303534323432333000000000003132303830343132353834303030302b000100000048524d303a20496e76616c6964204b6579776f72642c20706c6561736520636f6e746163742030332d323136323237323820666f72206675727468657220696e666f726d6174696f6e
12:58:41 PM: Received Data: 0000001a8000000400000000090c227435383135373337343600
12:58:41 PM: SubmitSmResp received. Status: 0, Message Id: 581573746, Sequence: 151790196
12:58:41 PM: QuerySm for message 581573746
12:58:41 PM: Sending Data: 0000001d0000000300000000090c227535383135373337343600000000
12:58:41 PM: Received Data: 000000238000000300000000090c227535383135373337343600286e756c6c29000100
12:58:41 PM: QuerySmResp received. Status: 0, Message Id: 581573746, Sequence: 151790197, Message State: 1
12:58:43 PM: Received Data: 00000044000000050000000022aa1ca10001013630313035343234323330000000343131313400040000000000000000000427000102001e000a35383135373337343600
12:58:43 PM: ERROR:Application exception.
12:58:43 PM: Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at WindowsApplication1.frmLog.client_evDeliverSm(Object sender, DeliverSm data) in C:\Website\SERVER 54\SMPP\TuneTalkSMPP\frmLog.vb:line 494
at Inetlab.SMPP.SmppClient.DYwde1Pbas(DeliverSm )
at Inetlab.SMPP.SmppClient.ProcessSmppMessage(SmppPDU packet)
at Inetlab.SMPP.Common.SmppClientBase.F9cr3VolK(List`1 packets)


it failed at the bold line, messageid can captured perfectly using thid method client.GetMessageText(data.Optional(OptionalTags.ReceiptedMessageId), data.DataCoding) but i need to know the delivery status.

Code: Select all

  If data.MessageType = MessageTypes.SMSCDeliveryReceipt Then

        
            Dim msgid As String = ""
            Dim errorCode As String = ""
            Dim statusCode As String = ""
            Dim drText As String = ""
            Dim submitdate As String = ""

            msgid = client.GetMessageText(data.Optional(OptionalTags.ReceiptedMessageId), data.DataCoding)
           [b] statusCode = data.Receipt.State[/b]
                    


        End If
alt
Site Admin
Posts: 918
Joined: Tue Apr 25, 2006 9:45 am

Re: failed to read delivery receipt

Post by alt » Thu Aug 16, 2012 8:14 am

Hi,

NullReferenceException happened due to lack of message text for delivery receipt. In version 1.1 it is already fixed.

You can take message state with following code

Code: Select all

var state = (MessageState)data.Optional[OptionalTags.MessageState][0];
Locked