Im using Inetlab SMPP to forward SMPP messages to an HTTP service. The HTTP service sends an unstructured delivery receipt response which I need to convert into a valid SMPP delivery receipt and send to the connected client, however, I cant find documentation on how to construct a delivery receipt for sending to client. From various information I have gathered, I created the code below:
Code: Select all
var dlrs = sms.Select(d => new DeliverSm
{
Header = new SmppHeader(CommandSet.DeliverSm) {Status = CommandStatus.ESME_ROK},
DestinationAddress = new SmeAddress(d.Recipient, AddressTON.International, AddressNPI.Unknown),
Receipt = new Receipt
{
Delivered = d.Message.CountedParts,
DoneDate = d.Delivered,
ErrorCode = d.ErrorCode,
SubmitDate = d.Submitted,
MessageId = d.Message.MessageId,
State = MessageState.Delivered,
Text = d.Message.Body,
Submitted = d.Message.CountedParts
}
});
var response = client.Deliver(dlrs.ToArray()).Result;
Code: Select all
System.AggregateException: One or more errors occurred. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: String
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseUInt32(String value, NumberStyles options, NumberFormatInfo numfmt)
at System.UInt16.Parse(String s, NumberStyles style, NumberFormatInfo info)
at System.UInt16.Parse(String s)
at Inetlab.SMPP.Parameters.NetworkErrorCodeParameter.???
??????(Object )
at Inetlab.SMPP.Parameters.NetworkErrorCodeParameter..ctor(Byte networkType, String errorCode)
at Inetlab.SMPP.Parameters.NetworkErrorCodeParameter.GSM(String errorCode)
at Inetlab.SMPP.Common.SmppWriter.???
??????(Object )
at Inetlab.SMPP.Common.SmppWriter.Write(DeliverSm pdu)
at Inetlab.SMPP.Common.SmppWriter.WritePDU(SmppPDU pdu)
at Inetlab.SMPP.SmppClientBase.???
??????.???
?????(Object , Object )
at Inetlab.SMPP.SmppClientBase.???
??????.???
??????()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Inetlab.SMPP.SmppClientBase.<SendRequestAsync>d__89`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Inetlab.SMPP.SmppServerClient.<Deliver>d__51.MoveNext()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at SMPPtoHTTP.Program.ShareDeliveryReports(SmppServerClient client)
---> (Inner Exception #0) System.ArgumentNullException: Value cannot be null.
Parameter name: String
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseUInt32(String value, NumberStyles options, NumberFormatInfo numfmt)
at System.UInt16.Parse(String s, NumberStyles style, NumberFormatInfo info)
at System.UInt16.Parse(String s)
at Inetlab.SMPP.Parameters.NetworkErrorCodeParameter.???
??????(Object )
at Inetlab.SMPP.Parameters.NetworkErrorCodeParameter..ctor(Byte networkType, String errorCode)
at Inetlab.SMPP.Parameters.NetworkErrorCodeParameter.GSM(String errorCode)
at Inetlab.SMPP.Common.SmppWriter.???
??????(Object )
at Inetlab.SMPP.Common.SmppWriter.Write(DeliverSm pdu)
at Inetlab.SMPP.Common.SmppWriter.WritePDU(SmppPDU pdu)
at Inetlab.SMPP.SmppClientBase.???
??????.???
?????(Object , Object )
at Inetlab.SMPP.SmppClientBase.???
??????.???
??????()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Inetlab.SMPP.SmppClientBase.<SendRequestAsync>d__89`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Inetlab.SMPP.SmppServerClient.<Deliver>d__51.MoveNext()<---