Thursday, September 7, 2006

What is SMS?

SMS is gaining mass popularity and billions of messages are exchanged across the world. Though typing may be cumbersome and delivery is not gauranteed, SMS popularity has encouraged development of MMS.

I'm more interested in the actual communication itself so you can try out a Java implentation I have written but first some basic understading may be helpful. Basic stuff is from the GSM specifications by ETSI (3.40 and 3.38) and the AT command set.

The basic process for sending a SMS (MO) is to first create the message in text mode or as a PDU (Protocol Description Unit), then send it over to a SMSC (SMS Center). The SMSC which is usually operated by a telco then delivers the message via appropriate means to the destination (MT). Sounds simple and even practically its no rocket science, just the need for proper infrastructure in place. Communications between different telcos is sometimes tricky since they use competing and often propriety protocols such as OIS (Sema), SMPP (Logica), CIMD (Nokia), UCP (CMG). However not bothering at the SMSC level end users are more interested in sending and recieving SMS.

Sending/Recieving a SMS: There can be many encoding sets for the characters you use that sets the limit for the length of your SMS. Using the GSM 7-bit encoding it is 160 characters and may be 60 chars if a 16-bit encoding is used (say for typing chinese characters). Encoding is set using the AT+CSCS command. Using the HEX encoding all characters can be easily represented. Next a SMSC number is required where the modem must forward your sms, this is usually in the SIM card already, otherwise can be set using AT+CSCA. Next it must contain the destination address (DA). Additional fields include origin address (OA), timestamp, status request and a validity period.

The message mode can be set using AT+CMGF. The PDU is quite complex, for a good description see http://emctone.tripod.com/html/smspdu.html

The message can then be sent using AT+CMGS.

Reading a message is also very simple and can be done using AT+CMGL to list all messages or AT+CMGR for a specific one. Next deleting a message is done using AT+CMGD.

AT Help: If you are not familiar with the AT command syntax, search some tutorial. Use hyper terminal that comes with Windows. For example if you use AT+CMGL=? a list of valid options shows. Generally AT+=? shows help for that command.

Try GSMS - a simple Java package for communicating using SMS with your GSM modem/phone!

No comments: