{"id":808,"date":"2020-03-05T21:06:46","date_gmt":"2020-03-05T21:06:46","guid":{"rendered":"https:\/\/mobiletidings.com\/?p=808"},"modified":"2020-03-05T21:06:46","modified_gmt":"2020-03-05T21:06:46","slug":"combining-sms-messages","status":"publish","type":"post","link":"https:\/\/techsofar.com\/combining-sms-messages\/","title":{"rendered":"Combining SMS Messages: The Complete Guide"},"content":{"rendered":"
As discussed in a previous post, many features of SMS messages become available if you can set the User Data Header (UDH) field.<\/p>\n
When using a GSM modem in text mode you can\u2019t send a UDH, so you need to use PDU mode.<\/p>\n
There are 2 things you need to do:<\/p>\n
The confusing part here is that the\u00a0UDHL<\/strong> in octets, but the User Data Length (UDL<\/strong>) is in septets (in the case of a GSM-7 encoded text message). Here is what a payload would look like:<\/p>\n If the text is UCS-2 encoded it would look simpler:<\/p>\n <\/p>\n The UDH itself consists of one or more\u00a0information elements (IE)<\/em><\/strong>. An item is encoded in 3 fields:<\/p>\n <\/p>\n There can be many information elements present in a UDH. The one IE we need to construct a big SMS message from several smaller messages is the IE with identifier (IEI) 0\u00d700.<\/p>\n This IEI has 3 values as part of its data:<\/p>\n So in more detail, if an SMS message is number 2 of 3, this information element should be in the UDH field:<\/p>\n <\/p>\n Here is a complete set of AT commands to send a message consisting of 3 parts:<\/p>\n <\/p>\n <\/p>\n <\/p>\n Note that the other fields of the PDU remain the same, with the exception of the \u2018message reference\u2019 (which is the octet after the PDU type). The message reference should be different with each SMS-SUBMIT PDU sent.<\/p>\n\n\n
\n Size<\/strong><\/td>\n Field<\/strong><\/td>\n Description<\/strong><\/td>\n<\/tr>\n \n 1 octet<\/td>\n UDL<\/td>\n size in\u00a0septets<\/strong><\/em>\u00a0(counting UDHL + UDH + text)<\/td>\n<\/tr>\n \n 1 octet<\/td>\n UDHL<\/td>\n size in\u00a0octets<\/strong><\/em>\u00a0(counting only UDH)<\/td>\n<\/tr>\n \n n octets<\/td>\n UDH<\/td>\n <\/td>\n<\/tr>\n \n 6 or fewer bits<\/td>\n filler<\/td>\n to assure the UD septets that follow are on a septet boundary.<\/td>\n<\/tr>\n \n m septets<\/td>\n text<\/td>\n GSM-7 encoded characters
\nGSM-7 encoded charcaters always start on a septet boundary, so if you have a UDH you might have to add some padding bits to have you text start at a septet boundary.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n\n
\n Size<\/strong><\/td>\n Field<\/strong><\/td>\n Description<\/strong><\/td>\n<\/tr>\n \n 1 octet<\/td>\n UDL<\/td>\n size in\u00a0octets<\/strong><\/em>\u00a0(counting UDHL + UDH + text). Each character in the text occupies a short (=2 octets).<\/td>\n<\/tr>\n \n 1 octet<\/td>\n UDHL<\/td>\n size in\u00a0octets<\/strong><\/em>\u00a0(counting only UDH)<\/td>\n<\/tr>\n \n n octets<\/td>\n UDH<\/td>\n <\/td>\n<\/tr>\n \n m shorts<\/td>\n text<\/td>\n UCS-2 encoded characters.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n What is in a UDH?<\/h3>\n
\n\n
\n Size<\/strong><\/td>\n Field<\/strong><\/td>\n Description<\/strong><\/td>\n<\/tr>\n \n 1 octet<\/td>\n IEI<\/td>\n Information element identifier<\/td>\n<\/tr>\n \n 1 octet<\/td>\n IEDL<\/td>\n Information element data length<\/td>\n<\/tr>\n \n n octets<\/td>\n IED<\/td>\n Information element data<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n \n
\n\n
\n Size<\/strong><\/td>\n Field<\/strong><\/td>\n Value<\/strong><\/td>\n Description<\/strong><\/td>\n<\/tr>\n \n 1 octet<\/td>\n IEI<\/td>\n 0\u00d700<\/td>\n Information element identifier for a concatenated short message<\/td>\n<\/tr>\n \n 1 octet<\/td>\n IEDL<\/td>\n 0\u00d703<\/td>\n Information element data length<\/td>\n<\/tr>\n \n 1 octet<\/td>\n <\/td>\n 0xa1<\/td>\n A reference number (must be the same for all parts of the same larger messages)<\/td>\n<\/tr>\n \n 1 octet<\/td>\n <\/td>\n 0\u00d703<\/td>\n This message has 3 parts<\/td>\n<\/tr>\n \n 1 octet<\/td>\n <\/td>\n 0\u00d702<\/td>\n This is part 2.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n First part:<\/h4>\n
AT+CMGS=153<crlf>\n0041000B915121551532F40000A0050003000301986F79B90D4AC3E7F53688FC66BFE5A0799A0\nE0AB7CB741668FC76CFCB637A995E9783C2E4343C3D4F8FD3EE33A8CC4ED359A079990C22BF41\nE5747DDE7E9341F4721BFE9683D2EE719A9C26D7DD74509D0E6287C56F791954A683C86FF65B5\nE06B5C36777181466A7E3F5B0AB4A0795DDE936284C06B5D3EE741B642FBBD3E1360B14AFA7E7\n<ctrl-Z><\/pre>\n<\/div>\n
\n\n
\n Field<\/strong><\/td>\n Value<\/strong><\/td>\n Description<\/strong><\/td>\n<\/tr>\n \n PDU-TYPE<\/td>\n 0\u00d741<\/td>\n SMS-SUBMIT + UDH bit<\/td>\n<\/tr>\n \n UDL<\/td>\n 0xA0<\/td>\n Total payload length in septets (160)<\/td>\n<\/tr>\n \n UDHL<\/td>\n 0\u00d705<\/td>\n User data header length<\/td>\n<\/tr>\n \n UDH<\/td>\n 0\u00d70003000301<\/td>\n Concatenated message IE:<\/p>\n \n
Second part:<\/h4>\n
AT+CMGS=153<crlf>\n0041010B915121551532F40000A005000300030240EEF79C2EAF9341657C593E4ED3C3F4F4DB0\nDAAB3D9E1F6F80D6287C56F797A0E72A7E769509D0E0AB3D3F17A1A0E2AE341E53068FC6EB7DF\nE43768FC76CFCBF17A98EE22D6D37350B84E2F83D2F2BABC0C22BFD96F3928ED06C9CB7079195\nD7693CBF2341D947683EC6F761D4E0FD3CB207B999DA683CAF37919344EB3D9F53688FC66BFE5\n<ctrl-Z><\/pre>\n<\/div>\n
\n\n
\n Field<\/strong><\/td>\n Value<\/strong><\/td>\n Description<\/strong><\/td>\n<\/tr>\n \n PDU-TYPE<\/td>\n 0\u00d741<\/td>\n SMS-SUBMIT + UDH bit<\/td>\n<\/tr>\n \n UDL<\/td>\n 0xA0<\/td>\n Total payload length in septets (160)<\/td>\n<\/tr>\n \n UDHL<\/td>\n 0\u00d705<\/td>\n User data header length<\/td>\n<\/tr>\n \n UDH<\/td>\n 0\u00d70003000302<\/td>\n Concatenated message IE:<\/p>\n \n
Third part:<\/h4>\n
AT+CMGS=139<crlf>\n0041020B915121551532F4000090050003000303CAA0721D64AE9FD3613AC85D67B3C32078589\nE0ED3EB7257113F2EC3E9E5BA1C344FBBE9A0F7781C2E8FC374D0B80E4F93C3F4301DE47EBB41\n70F93B4D2EBBE92CD0BCEEA683D26ED0B8CE868741F17A1AF4369BD3E37418442ECFCBF2BA9B0\nE6ABFD9EC341D1476A7DBA03419549ED341ECB0F82DAFB75D<ctrl-Z><\/pre>\n<\/div>\n
\n\n
\n Field<\/strong><\/td>\n Value<\/strong><\/td>\n Description<\/strong><\/td>\n<\/tr>\n \n PDU-TYPE<\/td>\n 0\u00d741<\/td>\n SMS-SUBMIT + UDH bit<\/td>\n<\/tr>\n \n UDL<\/td>\n 0\u00d790<\/td>\n Total payload length in septets (144)<\/td>\n<\/tr>\n \n UDHL<\/td>\n 0\u00d705<\/td>\n User data header length<\/td>\n<\/tr>\n \n UDH<\/td>\n 0\u00d70003000303<\/td>\n Concatenated message IE:<\/p>\n \n