Understanding SMS


SMS or Short Message Service is the ability to send and receive short messages or 'texts' between mobile phones. When you put it like this, it doesn't sound like such a big deal, but in the 10 odd years since the first SMS message was sent, these small text messages have rapidly grown to be a huge part of the mobile market. In Europe alone, there are in excess of two billion text messages sent every month.

Where does ColdFusion fit in here? At the moment, to create an SMS-based application takes a specialized application server and a ton of custom programming. In the same manner that ColdFusion has been making it simple to create dynamic Web pages for the last 10 years, it is now easy to create SMS based applications in ColdFusion.

What kinds of applications can be built with this new interface to ColdFusion? Well the possibilities are almost endless. A few that jump to mind include: voting for your favorite character on the latest round of reality TV shows, getting your new password for a Web application or even monitoring the health of your ColdFusion server. This could be as important to your Web applications as <cfmail> is today.

The gateway in ColdFusion does some amazing things for you when it comes to IM-it is able to keep track of sessions for you. Even though there is not a Web browser as such, it is very helpful to be able to apply the same concepts we use for our Web development to a series of text messages, thus allowing us to take our existing applications and convert them to SMS applications without much code refactoring.

Secondly the SMS gateway is also able to authenticate the phone itself, so you know which user is using your application. This does not mean that you don't need to implement some kind of user authentication or verification at some point. I would still like to know that if I lose my phone someone can't just pick it up and find out my bank balance.

The GSM (Global System for Mobile communications) standard provides for encrypted traffic between the SMSC (Short Message Service Center) and the mobile phone so this gives us a secure environment without having to program in security.

Lastly, as your application will be leaving the confines of the internet, you will need a way to get your SMS messages from your ColdFusion server out onto the mobile phone network. Nowadays this is not that hard but it does take some planning. Many people think that they need to have their own SMS gateway and related infrastructure to get this kind of application up and running and at one time you did. Recently a new protocol called SMPP (Short Message Peer to Peer) that allows you to send an SMS message over a TCP/IP network to a SMS gateway server (SMSC) thus saving you the hassle of having your own. You will need an account with a provider that will support SMPP 3.4 over TCP/IP but we will cover that later on.

NOTE

The ColdFusion MX SMS event gateway conforms to the SMPP 3.4 specification, which you can download from the SMS Forum at http://www.smsforum.net/.


TIP

You will also want to make sure that your connection to your SMSC provider is encrypted or protected in some way as the SMPP protocol does not have inherent support for encrypted communication. Most providers will insist on some sort of VPN connection around your connection to their SMPP.


ColdFusion contains an SMS test server that simulates an SMSC. It will listen on port 7901 for SMPP connection requests from any SMS resource. In our case this will be our SMS Gateway. There is also an SMS client simulator, a limited function mobile phone. It can connect to the SMS test server and exchange messages with it. This is very handy for testing your application prior to deploying it on the internet.

Testing Your SMS Applications

When you are developing your SMS application you do not want to be running up a huge phone bill every time you need to test a new piece of code. To help with this, there is an SMS gateway and a mobile phone emulator built into ColdFusion. Whist this is good, don't forget that nothing beats testing in the real world.

TIP

Don't forget to go into the ColdFusion Administrator and actually start the SMS test server or none of your gateways will start. It does not actually automatically restart if you restart your ColdFusion server.


By default the ColdFusion server is setup with a phone number of 555-1212. It will make life easy if you reuse the example configuration file for testing of your application but this does have one downside, you will need to be sure that only one gateway is using this number at once. If you want to have two SMS gateways running, you will need to assign them each different configuration files and different phone numbers.

Getting Your Messages Out

The last step in deploying your SMS application is to change your SMS gateway from the test server that you have been using for development to a real gateway that sends real messages to real phones.

The first step is to set up an account with a provider of SMPP (Short Message Peer to Peer) access to the SMS network. This can be done either with your telecom provider directly or an SMS service provider. There are two main things to think about when you go shopping for an SMSC provider. The first decision you will need to make is if your application will be push only and send only SMS messages or if it will be a two way application and will allow users to SMS in requests to your application.

The main effect here is price; a push style gateway is very cheap and easy to set up and can be done almost instantly. A two way application requires some more set up as you will need your own phone number or short code for your users to send their messages to.

A good place to start looking for an SMS provider is with the telecom company that provides your existing phone line or mobile phone infrastructure. This is primarily due to differential pricing. In some parts of the world it is cheaper to send text messages to other users on the same network as apposed to going across to another carrier's network.

This is really only an introduction and just enough to get you going. If you wish to learn more about the inner workings of SMPP, point your browser to http://smsforum.net for full details of the SMPP specification. Figure 32.4 shows the path of your SMS traffic between your ColdFusion gateways and various mobile devices.

Figure 32.4. The path of your SMS traffic.




Advanced Macromedia ColdFusion MX 7 Application Development
Advanced Macromedia ColdFusion MX 7 Application Development
ISBN: 0321292693
EAN: 2147483647
Year: 2006
Pages: 240
Authors: Ben Forta, et al

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net