Of course sending an SMS via an attached phone or GSM modem using AT commands in PDU mode is fun . Sometimes you just want to send a plain text message from your application and you don’t want to bother with phones, SIM cards, data plans, PDU mode and so on.
In these cases the easiest solution would be to use an SMTP to SMS gateway. SMTP is the protocol used to send email (Simple Mail Transfer Protocol). What such a gateway does:
- is receive an email
- look at the intended recipient
- figure out a phone-number from/for that recipient
- send the text of the email as an SMS to the recipient’s phone
You could send an SMS message this way using any SMTP library (they come with .NET, JDK and many open source libraries are available to do this from C or C++).
There is a really simple way to test this: just send an email from your email client.
Of course there are some limitations:
As shown in an earlier post, the Data Coding Scheme (DCS) octet in the SMS PDU can be used to turn a regular text message into a flash message.
Another feature of SMS that is enabled through use of the DCS is the Message Waiting Indication:
- When someone leaves you a voicemail, the voicemail system communicates with the SMSC to send your phone a special SMS message that turns on the little icon on your phone that indicates that you have a new voicemail.
- When you listen to your voicemail, the voicemail system also communicates with the SMSC to send your phone a SMS message that turns the little icon off again.
Using the DCS you can turn the voicemail icon on or off yourself.
This is an example PDU to set a voicemail indication:
Here is what the individual octets represent:
I have added a page with references to the official 3GPP, Open Mobile Alliance (formerly WAP Forum) and other specifications that are relevant for the topics in this blog so far.
I’ll keep that page up-to-date.
Once we have our text in the GSM-7 character set, we’re ready to write the septets. As is show before, the mapping is kind of awkward, see 3GPP TS 23.038.
Here is the algorithm I use to achieve this: Read More…
To produce the GSM-7 encoded text that is needed for SMS text messages sent with a GSM modem in PDU mode we need 2 steps.
First we need to convert our text to the GSM-7 character set.
The GSM-7 character set is described in 3GPP TS 23.038.
I’ve always been a fan of the GNU iconv library (libiconv). This library lets you convert practically any character set to any other character set. It does this by internally:
- converting the source character set to Unicode and
- converting from Unicode to the destination character set
Unfortunately libiconv does not have support for the GSM-7 character set, so I have added it myself. Read More…