Page 1 of 1

how van i read Message part header

Posted: Sun Mar 02, 2014 10:39 am
by mohdis
hello

i want to read message part header(UDH) .

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


how can i do that ?

Re: how van i read Message part header

Posted: Sun Mar 02, 2014 10:41 am
by mohdis
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

Re: how van i read Message part header

Posted: Wed Mar 05, 2014 6:25 am
by mohdis
any help ???

Re: how van i read Message part header

Posted: Sat Mar 08, 2014 7:16 am
by mohdis
heeeeeeelp !!!! :(

Re: how van i read Message part header

Posted: Fri Mar 21, 2014 9:30 am
by alt
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));
}

Re: how van i read Message part header

Posted: Wed Mar 26, 2014 9:42 am
by mohdis
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

Re: how van i read Message part header

Posted: Sun Mar 30, 2014 6:51 pm
by alt
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.