how van i read Message part header

.NET library for SMPP protocol
Locked
mohdis
Posts: 7
Joined: Thu Jan 23, 2014 9:27 am

how van i read Message part header

Post by mohdis » Sun Mar 02, 2014 10:39 am

hello

i want to read message part header(UDH) .

and get it in string variable like :
050003CC0201
050003CC0202


how can i do that ?
mohdis
Posts: 7
Joined: Thu Jan 23, 2014 9:27 am

Re: how van i read Message part header

Post by mohdis » Sun Mar 02, 2014 10:41 am

i send message in this way

Code: Select all

Dim resp As IList(Of SubmitSmResp)

resp = _client.Submit(SMS.ForSubmit().From(srcAdr, srcTon, srcNpi).To(dstAdr, dstTon, dstNpi).Coding(coding).Text(msg.Message).ExpireIn(TimeSpan.FromDays(1)).DeliveryReceipt())

  For Each msg_Status As SubmitSmResp In resp


                            Dim m As New UserDataHeader
                            m = msg_Status.Request.UserDataPdu.Headers(0)
Next
mohdis
Posts: 7
Joined: Thu Jan 23, 2014 9:27 am

Re: how van i read Message part header

Post by mohdis » Wed Mar 05, 2014 6:25 am

any help ???
mohdis
Posts: 7
Joined: Thu Jan 23, 2014 9:27 am

Re: how van i read Message part header

Post by mohdis » Sat Mar 08, 2014 7:16 am

heeeeeeelp !!!! :(
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: how van i read Message part header

Post by alt » Fri Mar 21, 2014 9:30 am

Hello mohdis,

Sorry for late response.

UserDataHeaderCollection has implicit conversion operator to byte array. So you can just assign UserDataPdu.Headers to byte array variable and then convert this array to hex string.

var req = SMS.ForSubmit().From(srcAdr, srcTon, srcNpi).To(dstAdr, dstTon, dstNpi).Coding(coding).Text(msg.Message).ExpireIn(TimeSpan.FromDays(1)).DeliveryReceipt().Create(_client);

foreach (var submitSm in req)
{
byte[] header = submitSm.UserDataPdu.Headers;

Console.WriteLine(ByteArray.ToHexString(header));
}
mohdis
Posts: 7
Joined: Thu Jan 23, 2014 9:27 am

Re: how van i read Message part header

Post by mohdis » Wed Mar 26, 2014 9:42 am

thank you .

another last Question :

is this correct way to send long message by syncmode to check if any part failed and try to send again ?


Dim pduBuilder As Inetlab.SMPP.Builders.ISubmitSmBuilder

pduBuilder = SMS.ForSubmit() _
.From(srcAdr, srcTon, srcNpi) _
.To(dstAdr, dstTon, dstNpi) _
.Coding(coding) _
.Text(msg.Message) _
.ExpireIn(TimeSpan.FromDays(1)) _
.DeliveryReceipt()



For Each xpdu In pduBuilder.Create(_client)
x += 1

Dim m_resp As SubmitSmResp = _client.Submit(xpdu)

If m_resp.Status = CommandStatus.ESME_ROK Then

FinalMessageStatus = True
' m_MsgId = xpdu.
m_MsgStatus = Int(m_resp.Status)
Thread.Sleep(10)
Else
Thread.Sleep(50)
m_resp = _client.Submit(xpdu) 'another try to failed part

End If



Next
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: how van i read Message part header

Post by alt » Sun Mar 30, 2014 6:51 pm

It depends on the response status.
For ESME_RTHROTTLED it will likely work, but could be possible that you need longer delay.

Also you need to take next xpdu.Sequence before repeat.
Locked