Get MessageId of SubmitAsync
Posted: Tue Aug 09, 2016 1:36 pm
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) ?
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) ?