Send and Receive Concatenated SMS in PDU mode

In TEXT mode(AT+CMGF = 1)its not possible to send concatenated sms .In order to send SMS with more than 140 characters we have to encode the message along with header information in PDU(Protocol Description Unit) format.Following examples give a detailed information on sending /receiving concatenated sms in PDU mode.

Sending Concatenated SMS

AT+CMGS=153
0041_00_0C911999083196770000_A005_0003000301_986F79B90D4AC3E7F53688FC66BFE5A0799A0E0AB7CB741668FC76CFCB637A995E9783C2E4343C3D4F8FD3EE33A8CC4ED359A079990C22BF41E5747DDE7E9341F4721BFE9683D2EE719A9C26D7DD74509D0E6287C56F791954A683C86FF65B5E06B5C36777181466A7E3F5B0AB4A0795DDE936284C06B5D3EE741B642FBBD3E1360B14AFA7E70041000C911999083196670000A0050003000301986F79B90D4AC3E7F53688FC66BFE5A0799A0E0AB7CB741668FC76CFCB637A995E9783C2E4343C3D4F8FD3EE33A8CC4ED359A079990C22BF41E5747DDE7E9341F4721BFE9683D2EE719A9C26D7DD74509D0E6287C56F791954A683C86FF65B5E06B5C36777181466A7E3F5B0AB4A0795DDE936284C06B5D3EE741B642FBBD3E1360B14AFA7E7

Parts of PDU format

153   –>    Total message length  = (strlen(0041000C911999083196670000A005000300…)/2 – 1)

00   –>   Length of SMSC information. Here the length is 0, which means that the SMSC stored in the phone should be used. Note: This octet is               optional. On some phones this octet     should be omitted! (Using the SMSC stored in phone is thus implicit)

0×41 –>   PDU-TYPE    SMS-SUBMIT + UDH bit
00      –>   TP-Message-Reference. The “00” value here lets the phone set the message reference number itself.
0C      –>   Address-Length. Length of phone number (11)
91      –>   Type-of-Address. (91 indicates international format of the phone number).if 0xDO it means alphanum(Typically it would be                     website names and name should be encoded without padding)
199908319677 –> Real number is 919980136977 .The phone number in semi octets .If the length of the phone number (46708251358) is odd (11),  a trailing F has to be added, as if the phone number were “46708251358F”. Using the unknown format (i.e. the Type-of-Address 81 instead of 91) would yield the phone number octet sequence 7080523185 (0708251358). Note that this has the length 10 (A), which is even.
00 –>    TP-PID. Protocol identifier
00 –>    TP-DCS. Data coding scheme.This message is coded according to the 7bit default alphabet. Having “04” instead of “00” here,   would indicate that the TP-User-Data field of this message should be interpreted as 8bit rather than 7bit (used in e.g. smart messaging, OTA provisioning etc).

0xA0 –> UDL (User-Data-Length)    Total payload length in septets (160)TP-User-Data-Length. Length of message. The TP-DCS field indicated 7-bit data, so the length here is the number of septets(10). If the TP-DCS field were set to 8-bit data or Unicode, the length would be the number of octets.UDL = ((strlen(050003000301986F79B90D4AC3E7F53688F…))*4)/7

0x05 –> UDHL (User data header length)
0×0003000301 –> IE    Concatenated message IE:

* IEI = 0×00
* IEDL = 0×03
* Ref nr = 0×00
* Total  = 0×03
* This part = 0×01

Example of PDU encoding is shown here

Example:
With a message of “hello world”, the [message] is encoded as

D0 65 36 FB 0D BA BF E5 6C 32 (We use this)

whereas without padding, the [message] would be

E8 32 9B FD 06 DD DF 72 36 19 [(E8)<<1 = D0)]

and the UDL is 7 (header septets) + 11 (message septets) = 18 septets.

Try for yourself
(Send the following data from your modem)

Chunk Message 1:

AT+CMGS=153(CR/LF)
0041000C911999083196770000A0050003000301986F79B90D4AC3E7F53688FC66BFE5A0799A0E0AB7CB741668FC76CFCB637A995E9783C2E4343C3D4F8FD3EE33A8CC4ED359A079990C22BF41E5747DDE7E9341F4721BFE9683D2EE719A9C26D7DD74509D0E6287C56F791954A683C86FF65B5E06B5C36777181466A7E3F5B0AB4A0795DDE936284C06B5D3EE741B642FBBD3E1360B14AFA7E7

Chunk message 2:

AT+CMGS=153(CR/LF)
0041010C911999083196770000A005000300030240EEF79C2EAF9341657C593E4ED3C3F4F4DB0DAAB3D9E1F6F80D6287C56F797A0E72A7E769509D0E0AB3D3F17A1A0E2AE341E53068FC6EB7DFE43768FC76CFCBF17A98EE22D6D37350B84E2F83D2F2BABC0C22BFD96F3928ED06C9CB7079195D7693CBF2341D947683EC6F761D4E0FD3CB207B999DA683CAF37919344EB3D9F53688FC66BFE5

Chunk message 3:

AT+CMGS=139(CR/LF)
0041020C91199908319677000090050003000303CAA0721D64AE9FD3613AC85D67B3C32078589E0ED3EB7257113F2EC3E9E5BA1C344FBBE9A0F7781C2E8FC374D0B80E4F93C3F4301DE47EBB4170F93B4D2EBBE92CD0BCEEA683D26ED0B8CE868741F17A1AF4369BD3E37418442ECFCBF2BA9B0E6ABFD9EC341D1476A7DBA03419549ED341ECB0F82DAFB75D

The sms message is

“Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.”

Receiving a Concatenated SMS

Decoding a concatenated messages and non concatenated messages in PDU mode

Concatenated message(1 chunk)
07_91198954800710_44_0C_91199920512899_0000_01302251431522_A005_0003080201_94E775FA8D5687CFEAF0FADC3EBFCFEDB3FBEC3EB7CFEDB31BDD3EB7D1ED73FBEC46BBCFEE73FBDC3EBBD1EDB31BED3EB7CFEDB3FBDC3EBBCFED73FBDC3EBBCFEDB3FAAC3EABCFEBF3FAAC3EABCFEBB3FAAC3EAFCFEAB31ADD3EB7CFEDB31BDD46BBCF6DB4FBDC3EBBCF6D741BED3EB7CFED73FBDC46B7CFEE731BDD3EBBCFED73FBEC3EB7CF
4 – indicates its a concatenated message
01302251431522 – 10/03/22,15:34:51+22: Date and Time information
0003080201 – IE
Data is encoded with padding.

Non concatenated message
07_91198954800710_04_0C_91199920512899_0000_01302251034122_09_CA305A7D5E9FD761
0-indicates its a single message
Data is encoded without padding.

One thought on “Send and Receive Concatenated SMS in PDU mode

Leave a comment