Welcome to Developer's Home Monday, April 21, 2014
Home - DevelopersHome.com

11.4. Receiving SMS Messages Using a Protocol / Interface Supported by an SMSC or SMS Gateway


Preferences - Do not show ads

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)

Nokia

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&timestamp=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&timestamp=1830+01012006

Preferences - Do not show ads


Page 17 of 65 Previous Page | Next Page
Contents at a Glance
Print this Web Page | | Back to Top
Custom Search

Feedback Form (Expand)

What do you think about this web page?






SMS Tutorial Table of Contents SMS Tutorial Contents at a Glance Preferences - Change Color Scheme Preferences - Do Not Show Ads Previous Page Next Page

Receive Global SMS - Clickatell Gateway


Send SMS