Page 1 of 1

Get MessageId of SubmitAsync

Posted: Tue Aug 09, 2016 1:36 pm
by ACTEL_SMPP_SMPP
We are encountering a problem and we need you support in order to solve it. We had complaints from some mobile operators that the end user is receiving multiple MT’s on his handset as we have only one registered record into our database as outgoing SMS.
They asked us to disable the retry mode in case we didn’t get an ACK from the SMPP server. So the only way to solve this issue is by submitting the SMS using the Async mode.

Used Code :
ISubmitSmBuilder Asyncbuilder = SMS.ForSubmit()
.To(drmessage["destination"].ToString(), byte.Parse(drmessage["DestAdrTON"].ToString()), byte.Parse(drmessage["DestAdrNPI"].ToString()))
.From(drmessage["originator"].ToString(), byte.Parse(drmessage["SrcAdrTON"].ToString()), byte.Parse(drmessage["SrcAdrNPI"].ToString()))
.Text(drmessage["smstextfull"].ToString())
.Set(delegate(SubmitSm sm) { sm.Sequence = _client.SequenceGenerator.NextSequenceNumber(); })
.Set(delegate(SubmitSm sm) { gatewayresponse = sm.Status.ToString(); });

if (drmessage["smsdlr"].ToString() == "1") { Asyncbuilder.DeliveryReceipt(); }
if (drmessage["MessageSubmitMode"].ToString().ToLower() == "payload") { Asyncbuilder.MessageInPayload(); };
if (drmessage["Encoding"].ToString() == "unicode") { Asyncbuilder.Coding(DataCodings.UCS2); };
try
{
if (!string.IsNullOrEmpty(drmessage["extra"].ToString()))
{
string[] tlvlist = Globals.SplitString(drmessage["extra"].ToString(), ";");
foreach (string par in tlvlist)
{
string[] subtlvlist = Globals.SplitString(par, "->");
Asyncbuilder.AddParameter(ushort.Parse(subtlvlist[0].ToString().Substring(2), System.Globalization.NumberStyles.HexNumber), Globals.FromUInt(uint.Parse(subtlvlist[1].ToString())));

}
}

}
catch { }
_client.SubmitAsync(Asyncbuilder);

But the main purpose here is to get the same messageid submitted in order to update the incoming DLR based on this messageid. How can we detect it upon sms submission in order to save it directly and solve this issue ? Or is there solution to disable the retry mode using the normal _client.Submit(builder) ?

Re: Get MessageId of SubmitAsync

Posted: Wed Aug 10, 2016 12:27 pm
by alt
You should use evSubmitComplete event in order to get MessageId from SubmitSmResp when you send with SubmitAsync method.

Try to avoid reading the same message from database before library get response (or responses for concatenated messages) from SMSC.