Page 1 of 1

accessing SubmitSm optional parameters

Posted: Thu Jul 21, 2011 12:27 pm
by hamid
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

Re: accessing SubmitSm optional parameters

Posted: Wed Jul 27, 2011 6:19 pm
by alt
Hi Hamid,

you can use code

Code: Select all

submitSm.Optional.AddMessagePayload(bytearray);
or

Code: Select all

submitSm.Optional[OptionalTags.MessagePayload] = new TLV(...);

Re: accessing SubmitSm optional parameters

Posted: Wed Jul 27, 2011 7:12 pm
by alt
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");

Re: accessing SubmitSm optional parameters

Posted: Sat Dec 03, 2011 8:52 am
by hamid
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

Re: accessing SubmitSm optional parameters

Posted: Sat Dec 03, 2011 9:18 am
by alt
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));
            }
        }