Access Custom Parameter ID In client_evSubmitComplete

.NET library for SMPP protocol
Locked
vineet
Posts: 28
Joined: Sat May 06, 2017 7:06 pm

Access Custom Parameter ID In client_evSubmitComplete

Post by vineet » Tue May 16, 2017 3:53 pm

Hi,

I want to send message using SubmitAsync() function is there way i can fetch the custom id like 34455 in client_evSubmitComplete
so i can relate this id with the db and update the messageid in the db. if possible please provide a sample.
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Access Custom Parameter ID In client_evSubmitComplete

Post by alt » Tue May 16, 2017 4:08 pm

Each SmppPDU has Tag property where you can store any state. In complete method you can get it with data.Request.Tag property.
vineet
Posts: 28
Joined: Sat May 06, 2017 7:06 pm

Re: Access Custom Parameter ID In client_evSubmitComplete

Post by vineet » Tue May 16, 2017 4:34 pm

Please show a code snippet how to set a tag property i am unable to find it.

here is the code

DataCodings coding = GetDataCoding();

byte srcTon = byte.Parse(tbSrcAdrTON.Text);
byte srcNpi = byte.Parse(tbSrcAdrNPI.Text);
string srcAdr = tbSrcAdr.Text;

byte dstTon = byte.Parse(tbDestAdrTON.Text);
byte dstNpi = byte.Parse(tbDestAdrNPI.Text);
string dstAdr = tbDestAdr.Text;

ISubmitSmBuilder builder = SMS.ForSubmit()
.From(srcAdr, srcTon, srcNpi)
.To(dstAdr, dstTon, dstNpi)
.Coding(coding)
.Text(tbSend.Text)
.ExpireIn(TimeSpan.FromDays(2))
.DeliveryReceipt();

_client.SubmitAsync(builder);

how to set tag value example 35467.

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

Re: Access Custom Parameter ID In client_evSubmitComplete

Post by alt » Tue May 16, 2017 4:51 pm

Code: Select all

ISubmitSmBuilder builder = SMS.ForSubmit()
.From(srcAdr, srcTon, srcNpi)
.To(dstAdr, dstTon, dstNpi)
.Coding(coding)
.Text(tbSend.Text)
.ExpireIn(TimeSpan.FromDays(2))
.DeliveryReceipt()
.Set(s=>s.Tag = "myId");
Please note that myId represents tbSend.Text and in case of long text it will be spitted to several small parts where each part receives own SubmitSmResp with different MessageId from the server but with the same myId.
vineet
Posts: 28
Joined: Sat May 06, 2017 7:06 pm

Re: Access Custom Parameter ID In client_evSubmitComplete

Post by vineet » Tue May 16, 2017 4:59 pm

Thanks a lot for help. there is no issue if it receives same tag for each message part as in db design it is the main message id connected with message parts tables so it will be real easy to implement thanks a lot for the help.
Locked