Here I am writing about most awaited post of my blog with great excitement. In this post I will explain you , how to send long SMS or multipart SMS or concatenated SMS. Before I explain you I want to share my experience during searching for the secret of long SMS. When I started searching on internet about “how to send concatenated sms”, I found resource on wiki which explains the basic of long SMS and PDU format for sending long SMS. But this page (wiki) contains link at bottom of the page and this link (trust me) one of the best resource on the internet to learn about concatenated SMS. Here is the link if you want to read this blog : http://mobiletidings.com/2009/02/18/combining-sms-messages/. But still I was having same problem not able to send long SMS using AT command. But reading this blog I was sure that I was missing something in my PDU which cause problem. Then I thought of taking help from someone who is master in this so I did contact Franco (owner of http://www.franco7777.net/), who is one of the commenter on “http://mobiletidings.com/2009/02/18/combining-sms-messages/” blog. He gave me very nice response and explained me where my mistake was. And after that I had got the clear idea about sending long SMS over network.
Now I want to show you how you can send long SMS. But before reading this post further I will strongly recommend you to read http://www.dreamfabric.com/sms/ and grab basic idea about SMS PDU structure. When you send single SMS ( <= 160 Character) there is not UDH exist in the message but when you try to send long SMS ( > 160 Character) you need to add this UDH field into the message PDU. So the basic question is how to add this header in to the message. One more thing you should know to send concatenated SMS, and the thing is when you send single SMS there is no User Data Header so little less confusion and you don’t need to add padding bit to encode your message into GSM 7-bit encoding scheme but if you are going to send concatenated SMS, UDHL is exist and it is in septets so you need to add one padding bit compulsory to encode your SMS. Read http://mobiletidings.com/2009/02/18/combining-sms-messages/ blog to get the clear idea because I don’t want to post same content again in this post.
So basically there are 2 secret to send long SMS
- Add User Data Header
- Add Padding bit to encode your message.
If I want to send
Message:
- Message 1: “This is Part 1.”
- Message 2: “This is Part 2. “
Message PDU should be
That’s it , you are done !!
Things to know before sending Long SMS is , UDH will occupy 6 octets so original message size should be reduce.
Please let me know if I am missing something so I can update this post.
Update:
I am getting lot or queries regarding Message PDU for single message and concatenated message. So What I have done is I have created a quick sample to generate PDU for single message and for multipart SMS.
Go to my new website www.hiteshagja.com to download sample code
Send Long SMS/Multipart SMS/Concatenated SMS
Send Long SMS/Multipart SMS/Concatenated SMS
Here I am writing about most awaited post of my blog with great excitement. In this post I will explain you , how to send long SMS or multipart SMS or concatenated SMS. Before I explain you I want to share my experience during searching for the secret of long SMS. When I started searching on internet about “how to send long sms”, I found resource on wiki which explains the basic of long SMS and PDU format for sending long SMS. But this page (wiki) contains link at bottom of the page and this link (trust me) one of the best resource on the internet to learn about concatenated SMS. Here is the link if you want to read this blog : “http://mobiletidings.com/2009/02/18/combining-sms-messages/”. But still I am having same problem not able to send long SMS using AT command. But reading this blog I am sure that I am missing something in my PDU which cause problem. What I have done is I have contacted Franco (owner of “http://www.franco7777.net/”), who is one of the commenter on “http://mobiletidings.com/2009/02/18/combining-sms-messages/” blog. He gave me very nice response and explains me where my mistake is. And after that I have got the clear idea about sending long SMS over network.
Now I want to show you how you can send long SMS. But before reading this post further I will strongly recommend you to read “http://www.dreamfabric.com/sms/” and grab basic idea about SMS PDU structure. When you send single SMS ( <= 160 Character) there is not UDH exist in the message but when you try to send long SMS ( > 160 Character) you need to add this UDH field into the message PDU. So the basic question is how to add this header in to the message. One more thing you should know to send concatenated SMS, and the thing is when you send single SMS there is no User Data Header so little less confusion and you don’t need to add padding bit to encode your message into GSM 7-bit encoding scheme but if you are going to send concatenated SMS, UDHL is exist and it is in septets so you need to add one padding bit compulsory to encode your SMS. Read “http://mobiletidings.com/2009/02/18/combining-sms-messages/” blog to get the clear idea because I don’t want to post same content again in this post.
So basically there are 2 secret to send long SMS
- Add User Data Header
- Add Padding bit to encode your message.
If I want to send
Message:
Message 1: “This is Part 1.”
Message 2: “This is Part 2. “
Message PDU should be
******Image*******
That’s it , you are done !!
Things to know before sending Long SMS is , UDH will occupy 6 octets so original message size should be reduce.
Please let me know if I am missing something so I can update this post.
cool story.
robes
Hey i tried a different PDU.
I have a concatenated message with PDU
906136FB4D4E97E7E939BD9C7653CB737A43810CB3D96F72BA3C4FCFE9E5B49B5A9ED31B0A6498CD7E93D3E5797A4E2FA7DDD4F29CDE5020C36CF69B9C2ECFD3737A39EDA696E7F486021966B3DFE474799E9ED3CB6937B53CA73714C8309BFD26A7CBF3F49C5E4EBBA9E539BDA14086D9EC37395D9EA7E7F472DA4D2DCFE90D0532CC66BFC9
and UDH
050003360201
and the second one with
D2E5797A4E2FA7DDD4F29CDE5020C36CF69B9C2ECFD3737A39EDA696E7F486021966B3DFE474799E9ED3CB6937B53CA703
and UDH
050003360202
both messages together should be
HallodiesisteinTest
HallodiesisteinTest
HallodiesisteinTest
HallodiesisteinTest
HallodiesisteinTest
HallodiesisteinTest
HallodiesisteinTest
HallodiesisteinTest
HallodiesisteinTest
HallodiesisteinTest
can you help me on this. i get this from an SMSC Server through a get request.
best regards
Michael
i try ur PDU.and change to my phone number:
0041000C91265836208081000016050003030201A8E8F41C949E83A061391D147301
it still eror:
AT+CMGS=33
>041000C91265836208081000016050003030201A8E8F41C949E83A061391D147301
ERROR
can u help me?
seng me an email at classix16@yahoo.com
best regard. matt
Your PDU seems to be write, can you tell me error code ?
One more thing I want to clarify with you.
Your pdu is “041000C91265836208081000016050003030201A8E8F41C949E83A061391D147301” , which should be “0041000C91265836208081000016050003030201A8E8F41C949E83A061391D147301”.
Hi Guys!
How did you come up with the PDU message A8E8F41C949E83A061391D147301 that is equivalent to “This is Part 1.”
Im using VB6, can you give/suggest something I have to know about this.
Or Can you give me a function to do it…
Thanks!
Hi Hiteshagja,
A big bravo for your interesting blog and also this post that guided me into the right direction!
I’ve managed to get rid of a lot of little problems but there are still two things I don’t completely understand: How do you calculate the number after the AT+CMGS command and more importantly how do you exactly calculate the UDL (16 in your example)?
Best regards,
Olivier
Hi Olivier,
1. Number after the AT+CMGS command is [(total number of octets in your pdu/2)-1].
2. In my pdu total length of MESSAGE (please note I am talking about Message), is 15 Character (Count : “This is Part 1.”) + 7 (Length of Header), so in total its 22 characters length and when you convert 22 into Hex it will return 16 value.
Let me know if you have any problem…:)
To give you an example:
When I send “This is Part 1.” I generate
AT+CMGF=0
OK
AT+CMGS=32
>
0041000A814056084656000016050003080101A8E8F41C949E83A061391D147301
+CMGS: 12
OK
and it works but when I send “This is.” I generate AT+CMGF=0
OK
AT+CMGS=25
>
0041000A81405608465600000F050003050101A8E8F41C949EBB
ERROR
and get an error.
Thanks for you help,
Olivier
I have studied your PDU , there is problem in your User Data which you are sending. Please try this “0041000A81405608465600000F050003050101A8E8F41C949EBB00”.
Thanks Hiteshagja for helping me!
It works with the extra “00” at the end.
But do you have any idea when I should add the “00” or what the problem might be in my code?
Olivier
I’ve run some tests. When I send a pdu without a UDH “This is.” becomes “0001000A81405608465600000854747A0E4ACF5D”.
This seems to work fine. When I calculate it manually, it also seems to be correct.
When I send a pdu with a UDH I do this:
message = “0000000” + message;
String temp = strtopdu(message.c_str());
String padding = strtopdu(“0000000”);
message = temp.Delete(temp.Pos(padding), padding.Length());
generating this 0041000A81405608465600000F050003050101A8E8F41C949EBB
thus without “00” at the end.
Am I forgetting something or doing something wrong?
Thanks,
Olivier
Just check one thing, does your function return “A8E8F41C949EBB00” for message “This is.” ? If not then there is a problem in your function.
Hey, I read a lot of blogs on a daily basis and for the most part, people lack substance but, I just wanted to make a quick comment to say GREAT blog!…..I”ll be checking in on a regularly now….Keep up the good work! 🙂
I still wanted to thank you for helping me!
After rewriting my function and another minor tweak everything works perfectly! xD
Thanks again,
Olivier
Hello friend
I am thankful for your post but can you please guide me that I am able to send messages without UDH but when I want to send concatenated sms I am am stuck of how to add pdu with a padding bits , can you tell me manually that how this happens? I am looking forward for your reply please ,
I am using java as my application tool , please help me out I so need your help , I have seen this blog is just awesome !!!
I am going to reveal algorithm of how to generate “PDU” from text and when to add padding bit. Please wait till I post next article.
Thanks Man!
I will wait for that.. BTW, do you have a copy of that algorithm written in vb?
on CellId.ru you can download free library for working with GSM modem! (for .NET) with C# sample.
You can send and receive SMS messages, USSD.
support GSM and UCS2 coding format and
PDU and Text format!!!
You can download from cellid.ru
Really nice work man , keep it up 🙂
Thanks Dear !
Hi
Can anyone send me the source code.. i m using Vb.net or ASP.net
i am able to send single sms but i dont know how i will send long sms … i m new in programming….so plz help me
Regrads,
Zeeshan Saleem
+92-333-4503424
I have code in C#. Which I will share with you all soon. Right now busy in one of the projects so…
Thx… i will be waiting…. 🙂
Dear hiteshagja,
I am still waiting for your code. i m new in programming so i need ur help i want to send long sms using my mobile phone.
i need code in VB please help me. thx
Regards,
Zeeshan Saleem
SAKZ Solutions
sakzsolutions@gmail.com
my email add: sakzsolutions@gmail.com
Thx
Hello sir ,
Ur blog is very useful, thanks a lot. I want to know abt GSM 7 bit encoding
I would suggest you go and read this post http://mobiletidings.com/2009/07/06/gsm-7-encoding-gnu-libiconv/.
Because I have also taken reference from this blog so I don’t to replicate same thing here. 🙂
Hi buddy, I read your blog, it’s really useful, but i got a problem that I can’t solve it. I’ll send a tow pages length message, I generated pdu by ATSMS lib, it returned this pdu:
Page1: len:150
00510006812113320008FF8B060804888E02010622003100320033003400350036003700380039003006280031003200330034003500360037003800390030067E0031003200330034003500360037003800390030062B0031003200330034003500360037003800390030062C003100320033003400350036003700380039003006860031003200330034003500360037003800390030
Page2: len:84
00510006812113320008FF49060804888E0202062D0031003200330034003500360037003800390030062E0031003200330034003500360037003800390030062F0031003200330034003500360037003800390030
Second pdu works as well but when I try to send first page it returns an error with no error code.
Thank you for help, Alireza
How add the paddind ??
Need Code en Vb.net. Plis..
Dear Boris,
I have already mentioned link from where you can easily download VB6 source code. You can easily convert it into language you want.
To add padding bit into this code you need to read my post https://hiteshagja.wordpress.com/2010/06/27/encode-text-message-to-pdu/
Thanks,
Thank before, i have problem for different encoding PDU i used, can’t u give me solution what u use to convert text to pdu. i’m use VB, thank…..
hello….
I am learning asp.net with language c#.
I am developing a website for SMS, need some source code in c# for sending sms also how to add emoticons or smiley’s while sending messages.
Help me………please
You can definitely send smiley’s over SMS. Say for example if you send “:-)” as a message and if mobile handset supports smiley feature , then it will be shown as smiley face. Alike, I think all handsets support standard smiley codes (ex. “:-)”). Do google for smiley code and you can definitely do this.
thank you…….
the text “This is Part 1.” for pdu message shown as “A8E8F41C949E83A061391D147301”
Plz. tell me Vb Function for do this.
Dear Anil,
I have already mentioned link for code in VB6 in my other post.
I hope it will help !
how can i send unicode in pdu message
plz. tell me header command and unicode conversion in pdu message hex.
I have not tried sending unicode ever but you could definitely send it using AT commands.
Please refer : http://www.smssolutions.net/tutorials/gsm/sendsmsat/
code for sending pdu mode message
in vb6 use i have solution u send me u r email addresss i will send u code file to u
Hi hiteshagja,
i try to send single and mulipart SMS :
Single SMS
text : This is Part 1.
pdu : 0011000d91x6581744178yF70000FF0f54747a0e4acf41d0b09c0e8ab900
Multipart SMS
text : This is Part 1.
pdu : 0041000d91x6581744178yF7000016050003030201a8e8f41c949e83a061391d147301
at single SMS we found 0f54747a0e4acf41d0b09c0e8ab900 and
at multipart SMS we found a8e8f41c949e83a061391d147301.
i think that is result from encode text to pdu for text(This is Part 1.).
why is there difference between single SMS PDU and SMS Multipart PDU for text (This is Part 1.) ??
Yes you are correct it is different in case of single SMS and in case of Multipart SMS. Why it is different because of UDH header’s existance in Multipart SMS. Basically we need to send some information which GSM modem can understand to merge each part of long sms (>160). We can do this using header part. So, Header part is nothing but the information about rest of the PDU. 🙂
okay.. 🙂
when I insert 0f54747a0e4acf41d0b09c0e8ab900
(This is Part 1.) into 0041000d91x6581744178yF7000016050003030201
0f54747a0e4acf41d0b09c0e8ab900
then I send it, but I received a different text, not (This is Part 1.)
how to make 0f54747a0e4acf41d0b09c0e8ab900 (at mulitipart sms) can received as (This is Part 1.) ?
Hi there,
This is a inquiry for the webmaster/admin here at hiteshagja.wordpress.com.
May I use some of the information from your blog post above if I provide a link back to this website?
Thanks,
Harry
Yes
Oh my god. I find this things so intersting, but i have much problems to relize them! I am using vba. Can you explain more things (and examples) about it??? thanks!
Hey, I have not much idea about VBA but yes you may do this in VBA too. I did google for you and I found http://dev.emcelettronica.com/serial-port-communication-excel-vba link for you. It might helpful to you.
Wonderfull! I made it!!! and it’s all ok! Thanks man!
One (last) thing…
When i send a long sms with char (ex. “[“, “]“, “àèìòù”) i find some problems in my sms). Why?? I thinks its an error in some conversion functions. What do you think about?
You can send those character? (ex. “[“, “]“, “àèìòù”)
Thank you!
Hey i tried a different PDU.
I have a concatenated message with PDU
906136FB4D4E97E7E939BD9C7653CB737A43810CB3D96F72BA3C4FCFE9E5B49B5A9ED31B0A6498CD7E93D3E5797A4E2FA7DDD4F29CDE5020C36CF69B9C2ECFD3737A39EDA696E7F486021966B3DFE474799E9ED3CB6937B53CA73714C8309BFD26A7CBF3F49C5E4EBBA9E539BDA14086D9EC37395D9EA7E7F472DA4D2DCFE90D0532CC66BFC9
and UDH
050003360201
and the second one with
D2E5797A4E2FA7DDD4F29CDE5020C36CF69B9C2ECFD3737A39EDA696E7F486021966B3DFE474799E9ED3CB6937B53CA703
and UDH
050003360202
both messages together should be
HallodiesisteinTest
HallodiesisteinTest
HallodiesisteinTest
HallodiesisteinTest
HallodiesisteinTest
HallodiesisteinTest
HallodiesisteinTest
HallodiesisteinTest
HallodiesisteinTest
HallodiesisteinTest
can you help me on this. i get this from an SMSC Server through a get request.
best regards
Michael
Are you getting any error ? If yes then what is it ?
My problem is when i try to decode this messge everytime the first “H” is missing. The message i posted only contains the User Data without any phone number. This is something i’m getting in the URL.
If i understood it correctly the pdu string is 90 + udh + messge without the 90 i think.
hiteshagja
dear i submit code in vb6 like
MSComm1.Output = “AT” & vbCrLf
Sleep 500
MSComm1.Output = “AT+CMGF=0” & Chr$(13) & Chr(10) ‘This line can be removed if your modem will always be in Text Mode…
Sleep 500
MSComm1.Output = “AT+CMGS=23” & Chr$(13) & Chr(10)
Sleep 1000
MSComm1.Output = “0011000B911988718908250000AA0AE8329BFD4697D9EC37” & Chr$(26)
it work correctly but my reciver mobile number is 918817988052 in india to india and messege send to other number but which one i donot konw pls help me
Can anyone send me the source code.. i m using Vb.net.Thanks.
mail: atomy130@yahoo.com
I have already given a link to VB 6 code, which you can easily convert it to VB.net or C#.
Hi, can u advise the reason why the sms-es sent out from my program is limited to 130 characters per sms? Anything more than 130 will be split into a 2nd sms. I’ve read everywhere and all says that the limit is 160. Although there’s some who says that it is 130, but there’s no explanation why… thanks for your help!
No idea why this is happening to you. I will search on this and will let you know.
How do I send a multipart sms? I am able to send an sms that is 160 or less, but anything greater than that returns CMS ERROR 305.
Here is what I am doing:
AT+CMGF=1
AT+CMGS=”xxxx” – where xxxx is the number I am sending to
>Text that exceeds 160 characters in length
What command am I missing?
P.S. This modem is able to send multipart SMS. The dashboard installed for the modem is able to do it.
Thanks for the help
Hello all,
I desperatly try to found explanations about how to build the message part in mode PDU when the format is multi part message.
so,
The message is like this
0061000B913356307508F3000001050003000101[Message].
Do you know where I can find explanation about how to build the [message] part ?
Thanks,
PS: I tried this with 7 bit encoding alphabet: http://www.dreamfabric.com/sms/hello.html
But this is not the correct format.
Thanks a lot,
Please can u tell me how can i send long message in text mode in asp.net??
I’ve no idea about asp.net but you can use some paid payment gateways.
hiteshagja thaks for your advice.
i can send long sms now.
but there is problem
some character like “^” “{” “}” “[” “]”
cannot seen by the receive sms.
can you help me?
please send me an email for your answer.
😀
hello hiteshagja.. thanks for the tutorials..
btw.. i want ask about byte REF.NO. in UDH, is this byte can fill with any hex ?
thx before..
warm regards..
Hi hiteshagja thanks for the awsome tutorial.
this for my contribution
some VB6 applications that might can help for convert SMS to PDU (Concatenated SMS support) ,
you can download in website link below & free of use it
http://www.kaskus.us/showthread.php?p=565762572
Regards
Achmad Subechi
From Indonesia
Thank you !
I go to the website you referred but the password for downloading that software may be changed so I can’t download that. Please if you downloaded that software previously please can you send me the file.
Thanks
akash
May be be the password for the mediafire file is changed. Please can you send me the file if you had downloaded it previously. Email: windstorm@live.com
Thanks
Akash
Hi hiteshagja plz share or send me the source code in C#. i’m very very thankful to u.
my email address is fahim_bilwani72@hotmail.com
Hey Guys,
I have spared some time and searched project from my backup folder to send receive SMS. Basically I have attached ZIP/RAR file containing class files to encode decode PDU.
Please refer my new blog to download file: http://hiteshagja.com
Thanks,
Hitesh
I m sending sms in TEXT mode through c# application, how can i send it in PDU mode?
Please refer http://hiteshagja.com/send-sms-using-at-commands/
I m using this code but this code is good for text mode when CMGF=1 but not working for PDU, how can i correct it, any idea?
public bool sendMsg(SerialPort port,string p, string p1)
{
bool isSend = false;
string recievedData = ExecCommand(port, “AT”, 300, “No phone connected”);
recievedData = ExecCommand(port, “AT+CMGF=0”, 300, “Failed to set message format.”);
string command =”AT+CMGS=\”” + p + “\””;
recievedData = ExecCommand(port, command, 300, “Failed to accept phoneNo”);
string command1 = “AT+CMGS=14\”” + p1 + char.ConvertFromUtf32(26) + “\r”;
recievedData = ExecCommand(port,command1, 5000, “Failed to send message”); //3 seconds
if (recievedData.EndsWith(“\r\nOK\r\n”))
{
isSend = true;
}
else if (recievedData.Contains(“ERROR”))
{
isSend = false;
}
return isSend;
}
I have read text and pdu structure and at command but problem is in my coding:-(((
I would suggest you open https://hiteshagja.wordpress.com/2010/04/04/send-long-sms/ (my new blog address) and find download link at bottom of the post content. These are the files which will help you to send single as well as long sms (>160 Char).
I m sending sms in pdu mode through flowing command, “length” is a label which shows pdu length, my code is working when i write AT+CMGS=20 or whatever the length is but i want that code take value of label insted of writing static value in code, i m using it below mention way but it is not working. can anyone help me about how can i write in code if i m doing in wrong way?
string recievedData = ExecCommand(port, “AT”, 500000, “No phone connected”);
recievedData = ExecCommand(port, “AT+CMGF=0”, 500000, “Failed to set message format.”);
string command = “AT+CMGS=\””+ length +” \””;
recievedData = ExecCommand(port, command, 500000, “Failed to accept phoneNo”);
command = p1 + char.ConvertFromUtf32(26) + “\r”;
recievedData = ExecCommand(port, command, 5000, “Failed to send message”);
Hi hiteshagja plz help me how to send long sms(above 160 chars) in C#
plz share or send me the source code in C#. i’m very very thankful to u.
my email address is fahim_bilwani72@hotmail.com
Plzzz can any one help me about how to replace previous sms with new incoming sms in pdu format…… i have tried this code but it is not working this code is sending sms in normal way not replacing previous one.
plzzz help me.
byte[] encodedtext = encodetext(message, out datalength);
string encodedsmsc = smscaddress(smscnumber, smsctype);
StringBuilder builder = new StringBuilder();
builder.Append(IntToHex(0x11));
builder.Append(IntToHex(0x44));
builder.Append(desaddress(usenumber, numbertype));
builder.Append(IntToHex(0x42));
builder.Append(IntToHex(0x00));
builder.Append(IntToHex(0x00));
builder.Append(IntToHex(datalength));
builder.Append(IntToHex(encodedtext));
length = builder.Length / 2;
builder.Insert(0, encodedsmsc);
return builder.ToString();
Anyone who knows of any VB6 API that I can use to send sms? Like the one from http://www.smsco.it (SMSLibX)? Please drop a line murimij@gmail.com
I am try to send message contains @ character ex: hello@hello
AT+CMGS=24
>0011000C917951901053760004AA0AE8329BFD06A2CB6CF61B
its recieve rubish
but if send
0011000C917951901053760000AA09E8329BFD06A2CB6CF61B
it recieve helloihello (not hello@hello)
please help me to solve this problem
795190105376 this the phone num in sem octets
Hi,
I’ve issues with some type of mobile.
Iphone, Nokia X7, Nokia X2 can’t receive multipart sms. It’s only display when received all part.
And how to change “Receiving Text” at the end of sms’s part?
Thanks for help.
Hello
I used for testing this URL:
http://www.diafaan.com/sms-tutorials/gsm-modem-tutorial/online-sms-pdu-decoder/
the following string gives SMS output as “jb)*”
0041000C9119994432324300000B050003000101D4E2940A
But If I add padding “00” in front of D4E2290A and 0B as 0C:
0041000C9119994432324300000C05000300010100D4E2940A
The result SMS is as “@TEST”
Please help me to find out where is the problem?
Note: I have to study about how to add padding and where and when. If you have any article please let me know this also.
advance thanks
pmk