Page 2 of 2

Posted: Wed Nov 11, 2009 1:07 pm
by prog019
I am tring to sent Long SMS(length=320) with our SMPP client, where
Data Coding=Default
and receive sms message with invalid characters.


When I am tring to sent same text in DataCoding=UCS2, I am receive Correct message with normal text.

Are You sure, when you split message text in SUBMIT_SM method, you set encoding in 7 bit?.

Posted: Wed Nov 11, 2009 1:15 pm
by prog019
I have the same problem in SUBMIT_SM and in DELIVER_SM

Posted: Wed Nov 11, 2009 1:29 pm
by BenEllis
It might help if you copy and paste the code you're using to create your submitsm and read your deliversm?

Sounds like you're setting the .ShortMessage property to an encoded Hex String instead of a standard string.

Also, I believe the .Default option requires different encodings depending on the SMSC as it is SMSC specific.

Posted: Wed Nov 11, 2009 2:31 pm
by prog019
Dears, I have one question: can I prepare SUBMIT_SM in DataCodings.ASCII

Posted: Wed Nov 11, 2009 3:08 pm
by BenEllis
See http://www.inetlab.ru/support/viewtopic.php?t=631

If you set the Encoding to ASCII then use that algorithm to generate your ShortMessageBytes it should work.

I'm using this currently.

If you want to concatenated messages, it gets a bit more complicated. I can post this algorithm also if you want.

Posted: Wed Nov 11, 2009 3:09 pm
by prog019
Dear BenEllis,

Please sent me the algorithm

Thanks a lot

Sending Concatenate ASCII / GSM 03.38 messages

Posted: Wed Nov 11, 2009 3:28 pm
by BenEllis
Below is close to what I am using, so far I've had no problems with it.

Code: Select all

                // Encode as GSM 03.38
                byte[] data = GsmEncode(/* Put Plain Text here */);

		List<SubmitSm> reqs = new List<SubmitSm>();

                // If message needs to be concatenated (140 bytes (160 Gsm characters))
                if (data.Length > 160)
                {
                    byte concatMsgRef = // Generate new unique concatMsgRef here (0/1-255) for each long message you send. Once the operation is complete you can re-use the same id again.
                    byte seqNum = 0;
                    const int concatPartLength = 153;
                    int bytes = data.Length;
                    while (bytes > 0)
                    {
                        // Create Message
                        SubmitSm req = new SubmitSm(/* Service Type */, /* Source TON */, /* Source NPI */, /* Source Address*/, /* Dest TON */, /* Dest NPI */, /* Dest Addr */);

                        // Load Data
                        req.DataCoding = DataCodings.ASCII;
                        int bytesLeft = data.Length - bytes;
                        byte[] toSend = new byte[concatPartLength < bytes ? concatPartLength : bytes];
                        for (int i = 0; i < toSend.Length; i++)
                            toSend[i] = data[bytesLeft + i];
                        req.UserDataPdu.Headers.AddConcatenatedShortMessages8bit(concatMsgRef, (byte)((data.Length / concatPartLength) + 1), ++seqNum);
                        int r = req.UserDataPdu.Headers[0].Length;
                        req.UserDataPdu.ShortMessage = toSend;
                        reqs.Add(req);

                        bytes = bytes - concatPartLength;
                    }
                }
                else
                {
                    SubmitSm req = new SubmitSm(/* Service Type */, /* Source TON */, /* Source NPI */, /* Source Address*/, /* Dest TON */, /* Dest NPI */, /* Dest Addr */);
                    req.DataCoding = DataCodings.ASCII;
                    req.ShortMessageBytes = data;
		    reqs.Add(req);
                }

		SubmitSmResp[] resps = client.Submit(reqs.ToArray());

Posted: Wed Nov 11, 2009 4:42 pm
by prog019
Dears,

please, look to this:

I am send long message with 355 length via SUBMIT_SM

1. when DataCoding is UCS2, the result is OK
2. when DataCoding is DataCodings.Default or DataCongs.Latin1, the result is unreadable text

Code: Select all

SubmitSm[] req = client.PrepareSubmit(
                    mode,
					byte.Parse(tbSrcAdrTON.Text),
					byte.Parse(tbSrcAdrNPI.Text),
					tbSrcAdr.Text,
					byte.Parse(tbDestAdrTON.Text),
					byte.Parse(tbDestAdrNPI.Text),
					tbDestAdr.Text,
                    coding,
					tbSend.Text);

                    SubmitSmResp[] resp = client.Submit(req);
What is a problem?

Posted: Wed Nov 11, 2009 4:47 pm
by BenEllis
What text are you trying to send? Is it alphanumeric characters only?

Also, what mode are you using? Payload/Shortmessage?

Posted: Wed Nov 11, 2009 4:50 pm
by prog019
And I have other problem too,

when I am tring sent large SMS with payload, then I receive multiple separated SMSs.

Posted: Wed Nov 11, 2009 4:51 pm
by prog019
I am sending alphanumeric characters in ShortMessage mode

Posted: Wed Nov 11, 2009 5:00 pm
by BenEllis
Is this payload problem a seperate problem?

Since you aren't suppose to use Payload and ShortMessage at the same time, this can cause problems.

I've used Latin-1 and ASCII in ShortMessage mode and both work fine with my SMSC. So alt is possibly right and it may be a problem with your SMSC.

Posted: Thu Nov 12, 2009 10:15 am
by prog019
Dears,
I found the froblem, it is folowing:

When I am ting to send large message with SUBMIT_SMS,
then SMPP client DLL splits the messahe in parts and send it.

And message encoding of each part is 8 bit, but my DCS: is 7 bit

Posted: Thu Nov 12, 2009 12:00 pm
by prog019
Dear BenEllis,

You sent to me example for sending multiple smses and you are using AddConcatenatedShortMessages8bit.
Question: how Add Concatenated Short Messages in 7 bit.
I have the big problem with this.

Posted: Wed Dec 09, 2009 9:06 am
by BenEllis
My SMSC takes 7bit encoding with 8 bit characters (the 8th bit is always 0). As far as I know this is standard.

If your SMSC isn't following this, then you'll need to write an algorithm to concatenate the 7bit characters in a binary stream.