11.4. Receiving SMS Messages Using a Protocol / Interface Supported by an SMSC or SMS Gateway
After setting up an account with a wireless carrier or an SMS service provider, the SMSC or SMS gateway will start forwarding inbound SMS messages to your SMS application using a certain a protocol / interface. To communicate with an SMSC, an SMSC protocol is required. As mentioned in earlier sections of this SMS tutorial, most of these SMSC protocols are proprietary to the company that developed the SMSC. One widely used SMSC protocol is SMPP (Short Message Peer to Peer). It was originally a proprietary SMSC protocol created by Logica (an SMSC vendor). Now SMPP is an open SMSC protocol whose development is controlled by a non-profit organization SMS Forum. The following table lists some of the SMSC protocols and the SMSC vendors who develop the protocols:
SMSC vendor |
SMSC protocol |
---|---|
CMG (CMG and Logica have merged into LogicaCMG.) |
EMI (External Machine Interface) UCP (Universal Computer Protocol) |
Logica (CMG and Logica have merged into LogicaCMG.) (Now the SMS Forum is responsible for the development of SMPP.) |
SMPP (Short Message Peer to Peer) |
CIMD (Computer Interface to Message Distribution) |
|
SEMA Group (Now Airwide Solutions) |
OIS (Open Interface Specification) SMS2000 |
SMS gateways of SMS service providers and wireless carriers very often support one or more of the following protocols / interfaces: HTTP, HTTPS (HTTP + SSL encryption), XML over HTTP / HTTPS, SMTP (SMS to email), FTP. Some also support the SMPP protocol, which is usually used by advanced users. SMSC protocols other than SMPP are not commonly supported.
It is very easy to receive SMS messages from an SMS gateway if you use a simple protocol like HTTP / HTTPS. Let's take HTTP as an example. First, you log into your account and register a callback URL that points to a server-side script written by you. The server-side script is hosted on a web server / application server and it will be responsible for processing the received SMS messages. Commonly used server-side technologies include ASP, Java Servlet / JSP, Perl and PHP. If your server-side script is written in PHP, the callback URL should look something like this:
http://yourserver.com/receiveSMS.php
Whenever an SMS message is received, the SMS gateway will submit an HTTP GET to your web server / application server using the above callback URL. Details of the inbound SMS message such as its content, the sender's mobile phone number, the time and date that the SMS message is received, etc, will be appended to the callback URL. For example, suppose someone with the mobile phone number 61234567 sends an SMS text message "It is easy to receive text messages" to your SMS application's phone number. When the SMS gateway receives the SMS text message, it submits an HTTP GET to your web server / application server using an URL that looks like this:
http://yourserver.com/receiveSMS.php?sender=61234567&textmessage=It+is+easy+to+receive+text+messages&date_time=20060101+1830
In the above URL:
"yourserver.com" is the host name of your web server / application server that is responsible for processing the inbound SMS text message.
"receiveSMS.php" is the file that contains the PHP script for processing the inbound SMS text message.
"sender=61234567" assigns the value 61234567 to the sender parameter. The sender parameter specifies the originating mobile phone number.
"textmessage=It+is+easy+to+receive+text+messages" assigns the value It is easy to receive text messages to the textmessage parameter. The textmessage parameter specifies the content of the inbound SMS text message. The "+" character is the escaped character of the space character. The space character is a special character and it cannot appear in an URL without escaping.
"date_time=20060101+1830" assigns the value 20060101 1830 to the date_time parameter. The date_time parameter specifies the date and time that the SMS text message was received. In this example, 20060101 1830 means the SMS text message was received on 1 January 2006 at 6:30 pm. The date and time format may be different if you use the SMS gateway of a different SMS service provider or wireless carrier.
After processing the inbound SMS text message, you may want to send a reply SMS text message to the originator. Usually this can be done simply by including the reply SMS text message in the HTTP response you send back to the SMS gateway. The SMS gateway will then forward the included text message towards the mobile phone number 61234567. The cost for sending the SMS text message will be deducted from your account.
Note that the parameters that are included in the callback URL varies between SMS gateways of different SMS service providers or wireless carriers. For example, if a different SMS gateway is used, the previous SMS message "It is easy to receive text messages" may be forwarded to your web server / application server using a different URL, like below:
http://yourserver.com/receiveSMS.php?from=61234567&msg=It+is+easy+to+receive+text+messages×tamp=1830+01012006
Also, note that data transmitted over the Internet using the HTTP protocol is not secure. This means other people can read the data included in the above URL. Some SMS gateways allow the use of the HTTPS protocol instead of HTTP in a callback URL (i.e. change "http" at the beginning of the above URL to "https") so that inbound SMS messages can be submitted to your web server / application server securely. (HTTPS must be enabled on your web server / application server.)
https://yourserver.com/receiveSMS.php?from=61234567&msg=It+is+easy+to+receive+text+messages×tamp=1830+01012006
Previous Page | Page 17 of 65 | Next Page |
- 1. Introduction to SMS Messaging
- 2. What Makes SMS Messaging So Successful Worldwide?
- 3. Example Applications of SMS Messaging
- 4. What is an SMS Center / SMSC?
- 5. Basic Concepts of SMS Technology
- 6. Intra-operator SMS Messages
- 7. Inter-operator SMS Messages
- 8. International SMS Messages
- 9. What is an SMS Gateway?
- 10. How to Send SMS Messages from a Computer / PC?
- 11. How to Receive SMS Messages Using a Computer / PC?
- 12. Introduction to GSM / GPRS Wireless Modems
- 13. How to Use Microsoft HyperTerminal to Send AT Commands to a Mobile Phone or GSM/GPRS Modem?
- 14. Introduction to AT Commands
- 15. General Syntax of Extended AT Commands
- 16. Result Codes of AT Commands
- 17. AT Command Operations: Test, Set, Read and Execution
- 18. Testing the Communication between the PC and GSM/GPRS Modem or Mobile Phone
- 19. Checking if the GSM/GPRS Modem or Mobile Phone Supports the Use of AT Commands to Send, Receive and Read SMS Messages
- 20. Operating Mode: SMS Text Mode and SMS PDU Mode
- 21. Setting or Reading the Service Center Address / SMSC Address (AT+CSCA)
- 22. Preferred Message Storage (AT+CPMS)
- 23. Writing SMS Messages to Memory / Message Storage (AT+CMGW)
- 24. Deleting SMS Messages from Message Storage (AT+CMGD)
- 25. Sending SMS Messages from a Computer / PC Using AT Commands (AT+CMGS, AT+CMSS)
- 26. Reading SMS Messages from a Message Storage Area Using AT Commands (AT+CMGR, AT+CMGL)
- 27. Appendix A: How to Choose an SMS Service Provider (SMS Gateway Provider, SMS Reseller, SMS Broker)?
- 28. Appendix B: Comparison Table of SMS Service Providers (SMS Gateway Providers, SMS Resellers, SMS Brokers)
- 29. Appendix C: Free Software/Tools and Libraries for Sending and Receiving SMS Messages with a Computer / PC
- 30. Appendix D: GSM 7-bit Default Alphabet Table (with Character Codes of ISO 8859 Latin 1)