Page 1 of 1

own messageID issue on long (multipart) Messages

Posted: Mon Jul 19, 2021 3:25 am
by jesripurba
I generate my own messageID, but it doesn't work for multipart messages. The server always sends the messageID generated by InetLab.
But for a single message, which is created on server_evClientSubmitSm, the above method works well.

Why does OnFullMessageReceived own messageID not work, while in server_evClientSubmitSm it works fine?

I am using InetLab.SMPP v2.9.12

Here is my code, saveMessage function returns id from database.

Code: Select all

private void OnFullMessageReceived(object sender, MessageEventHandlerArgs args)
        {
            Inetlab.SMPP.PDU.SubmitSm mySMSData = new Inetlab.SMPP.PDU.SubmitSm();
            mySMSData = args.GetFirst<SubmitSm>();

            string MobNo = mySMSData.DestinationAddress.Address;
            string SMSContent = args.Text;
            string SenderID = mySMSData.SourceAddress.Address;
            string userID = mySMSData.Client.SystemID; 
            string IPAddr = IPAddress.Parse(((IPEndPoint)mySMSData.Client.RemoteEndPoint).Address.ToString()).ToString();
            string msgID;
            string status;
            MessageState msgStatus;
            CommandStatus ErrCode= CommandStatus.ESME_ROK;

            if (mySMSData.Concatenation == null)
                return;
            
           
            msgID = saveMessage(userID, MobNo, SenderID, SMSContent, IPAddr);


                msgStatus = MessageState.Accepted;
                mySMSData.Response.MessageId = msgID
                mySMSData.Response.Header.Status = CommandStatus.ESME_ROK;
                ErrCode = CommandStatus.ESME_ROK;
      

Re: own messageID issue on long (multipart) Messages

Posted: Mon Jul 19, 2021 9:33 am
by alt
In the server_evClientSubmitSm event handler method the property submitSm.Response defines the response on the SubmitSm request. Library sends this response after the method is executed. For the MessageComposer this doesn't work.

You can disable automatically response sending and send it with SendResponseAsync method.

https://docs.inetlab.com/smpp/v2.9/arti ... onses.html

Re: own messageID issue on long (multipart) Messages

Posted: Mon Jul 19, 2021 12:54 pm
by jesripurba
alt wrote:
Mon Jul 19, 2021 9:33 am
In the server_evClientSubmitSm event handler method the property submitSm.Response defines the response on the SubmitSm request. Library sends this response after the method is executed. For the MessageComposer this doesn't work.

You can disable automatically response sending and send it with SendResponseAsync method.

https://docs.inetlab.com/smpp/v2.9/arti ... onses.html
The problem is not at server_evClientSubmitSm, but at OnFullMessageReceived event. How to replace mesageID with own mesageID on OnFullMessageReceived.

data.Response.MessageId = msgID --> this way not work on OnFullMessageReceived event.

Re: own messageID issue on long (multipart) Messages

Posted: Mon Jul 19, 2021 4:34 pm
by alt
If you want to set MessageId for the SubmitSmResp in the method OnFullMessageReceived you need:
1. to disable response sending as it described in the link above in the server_evClientSubmitSm method;

Code: Select all

 submitSm.Response = null;
2. to create responses in the OnFullMessageReceived method for each args.Parts and send them to the client.

Code: Select all

 foreach (var part in args.Parts)
            {
                if (part is SubmitSm submitSm) {
                    SubmitSmResp  resp = new SubmitSmResp(submitSm);
                    resp.MessageId = msgID;
                    submitSm.Client.SendResponseAsync(resp);
                }
            }
Please note that each SubmitSmResp must have its own MessageId for the multi-part concatenated message text.