Text formatting with EMS

This entry is part 12 of 17 in the series Sending out an SMS

We have seen how you can use the User Data Header (UDH) in an SMS message to combine several SMS messages into one bigger one. Here is an other application of the UDH:

Text formatting in SMS

Remember that the UDH consists of Information Elements (IE) that each have the following structure

Length Value Description
1 octet IEI Information Element Identifier. This determines what this IE is about.
1 octet IE length The length of the data belonging to this IE in octets.
n octets IE data Meaning of the content varies per IEI.


The text formatting is controlled by just one IE. Here is a description:

Read More…

EMS and WAP Push support

This entry is part 9 of 17 in the series Sending out an SMS

As I have been writing about EMS and WAP Push, I am sure your ask yourself: “Does my phone support this?”. Again we dig into the WURFL database and we see that WAP Push is widely supported, but EMS a little less so.

This is understandable, because WAP Push is a protocol used in MMS (or picture messaging). Since most phones nowadays are camera phones and support picture messaging, they’re very likely to support WAP Push.

Here is a list of devices that support EMS and/or WAP Push, according to WURFL:

Read More…

Combining SMS messages

This entry is part 6 of 17 in the series Sending out an SMS

As discussed in a previous post, many features of SMS messages become available if you can set the User Data Header (UDH) field.

When using a GSM modem in text mode you can’t sent a UDH, so you need to use PDU mode.

How do you add a UDH?

There are 2 things you need to do:

  • Set the UDH bit in the first octet of the PDU. For an SMS-SUBMIT PDU (the only one we’ve been using so far) the value is normally 0×01. To indicate that a UDH is present we need to set bit 6 (0×40). So for an SMS-SUBMIT with UDH present we set the PDU type to 0×41.
  • With the UDH bit set, this first octet of the payload (or User Data = UD) needs to indicate the length of the UDH in octets. This field is known as UDHL.

Read More…

What are EMS messages?

This entry is part 5 of 17 in the series Sending out an SMS

EMS stands for Enhance Message Services. EMS messages are just SMS messages with a twist.

EMS messages make use of the User Data Header to add some meta data to the SMS message being sent. This meta data is separate from the actual text and devices that don’t understand some or any of the EMS features will easily skip over them and just render the text.

The uses of EMS are many:

Read More…

Sending out an SMS in PDU mode

This entry is part 1 of 17 in the series Sending out an SMS

PDU mode is a lot more interesting than text mode. There are all kinds of things that can be done with SMS messages, all leveraging special formatting that is only available if you use PDU mode:

The formatting of these PDU’s is a little more complicated and requires some bit manipulations that are hard to do by hand.

The GSM modem is put into PDU mode with the command ‘AT+CMGF=0’. Once in PDU mode a PDU can be sent using the ‘AT+CMGS’ command:
Read More…