accessing SubmitSm optional parameters

.NET library for SMPP protocol
Locked
hamid
Posts: 2
Joined: Thu Jul 21, 2011 11:13 am

accessing SubmitSm optional parameters

Post by hamid » Thu Jul 21, 2011 12:27 pm

Hi,

My Company is intrested in pourchasing your dll, so I spent some time, testing it.
I came up with the following question:
how can I access the optional fields of the SubmitSm (like, the payload field)? (For what I've seen so far, theese fields are implemented as non public members.)

Hope this is possible and that you would be so like to answer me, as soon as poosible.

Regards, Hamid
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: accessing SubmitSm optional parameters

Post by alt » Wed Jul 27, 2011 6:19 pm

Hi Hamid,

you can use code

Code: Select all

submitSm.Optional.AddMessagePayload(bytearray);
or

Code: Select all

submitSm.Optional[OptionalTags.MessagePayload] = new TLV(...);
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: accessing SubmitSm optional parameters

Post by alt » Wed Jul 27, 2011 7:12 pm

since version 1.0.11 you can try code

Code: Select all

submitSm.Optional[OptionalTags.MessagePayload] = client.GetMessageBytes("test", DataCodings.Default);

Easiest way to send concatenated message in payload parameter is to use method SendText

Code: Select all

client.SubmitText(SubmitMode.Payload, srcTon, srcNpi, srcAddr, destTon, destNpi, destAddr, DataCodings.Default, "test");
hamid
Posts: 2
Joined: Thu Jul 21, 2011 11:13 am

Re: accessing SubmitSm optional parameters

Post by hamid » Sat Dec 03, 2011 8:52 am

Hello,

we have buy the DLL and the source code, i would like to ask to how from the server of SMPP can i take the value of Payload .. the code you have posted in the forum only show the way for set Payload in client.
Hamid Mehmood
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: accessing SubmitSm optional parameters

Post by alt » Sat Dec 03, 2011 9:18 am

On the server side you can use code:

Code: Select all

        void server_evClientSubmitSm(object sender, SmppServerClient client, Inetlab.SMPP.PDU.SubmitSm data)
        {
            if (data.Optional[OptionalTags.MessagePayload] != null)
            {
                string text = client.GetMessageText(data.Optional[OptionalTags.MessagePayload], data.DataCoding);
                AddToLog(string.Format("Client {0}:{1} Received message Src:{2}, Dst:{3}, Text: {4}",
                    client.RemoteIP, client.RemotePort, data.DestAddr, data.SrcAddr, text));
            }
            else
            {
                AddToLog(string.Format("Client {0}:{1} Received message Src:{2}, Dst:{3}, Text: {4}",
                                       client.RemoteIP, client.RemotePort, data.DestAddr, data.SrcAddr,
                                       data.ShortMessage));
            }
        }
Locked