Wednesday, August 18, 2010

UDH in Binary SMS / Multipart SMS messsages

Multipart SMS messaging

By design, SMS is developed to send up to 140 bytes of user data. All user data is send in the 'User Data' part of the SMS packet. Because SMS text messages are encoded using 7-bit characters you can send up to 160 characters in a single SMS message. When sending Unicode text, you can only send 70 characters per single SMS message.
It is however possible to split up text and data messages and send them using multiple SMS messages. The receiving party will be able to combine the messages to the original message. This is called Segmentation and Reassembly (SAR). When sending multipart SMS messages you will be charged for every single SMS message sent.

Sending Multipart Messages through a GSM phone or modem

To send enhanced content, a so called user data header (UDH) is added add the beginning of the user data block of the SMS. When using an UDH, there is less data left for user data in the User Data field (140 - length of UDH).
An UDH can be used to send multipart messages, smart messaging (ringtones, WAP push, pictures etc), voicemail indications and other services. In this article we will only discuss the use of UDH to send multipart text messages.
The UDH for message concatenation will only take 5 bytes, so there are 135 bytes left for the user data. When sending concatenated text messages, you can send 153 characters when using 7-bit text, when using Unicode 67 characters per part.

Byte Value Description
01 00 Information Element Identifier: Concatenated short message, 8bit reference number
02 03 Information Element Data Length (always 03 for this UDH)
03 A4 Information Element Data: Concatenated short message reference, should be same for all parts of a message
04 03 Information Element Data: Total number of parts
05 01 Information Element Data: Number of this part (1/3)
Example of a multipart message consisting of 3 parts containing 300 bytes:
SMS 1 User Data: 00 03 A4 03 01 [ 135 bytes of message data ]
SMS 2 User Data: 00 03 A4 03 02 [ 135 bytes of message data ]
SMS 3 User Data: 00 03 A4 03 03 [   30 bytes of message data ]
Source and Full Info

User Data Header (UDH)

The SMS that make up a concatenated SMS are related together by using the User Data Header (UDH) of an SMS. The UDH is a collection of bytes which can be put at the start of the SMS content. It can be used to control what happens to the rest of the content. For instance, it was used to send the older style of Nokia picture messages.
To indicate that the content contains a UDH, a flag on the SMS called the UDH Indicator (UDHI) must be turned on. This tells the phone that it must separate the UDH from the rest of the content.



Figure:Format of an SMS with a UDH
The phone separates the UDH by reading the first byte of the content. The number in this byte is the length of the rest of UDH and is called the User Data Header Length (UDHL). The phone then knows how many bytes make up the UDH and can separate it from the rest of the message.
As already stated, a UDH can control various things and so can contain various commands. These commands are called Information Elements (IE's). These IE's always take the following format: an Identity Element Identifier (IEI) followed by the Length of the IE Data (IEDL) followed by the IE Data (IED). A UDH can contain 1 or more of these IE's.

Resources
1)Parameters with Definitions for Sending SMS and MMS

2)Sending Binary Messages using NowSMS

No comments: