Browse DevX
Sign up for e-mail newsletters from DevX


Open the Mobile Gateway with SMS and MMS Messaging : Page 2

If you've ever used your mobile device to check your Yahoo! Mail or check the news, you've used a Short Messaging Service (SMS). This article takes you through the inner-workings of these near-ubiquitous services, finally demonstrating how to SMS-enable your weblog.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

The SMS-to-Web Gateway
Here are the three things a required to implement a gateway:
  1. An incoming service request from a mobile (in this case in the form of SMSes).
  2. A number to send the service request.
  3. A service network (typically).
To satisfy the first of the above requirements, you may use any cell-phone (note that the network type—whether GSM or CDMA—determines availability of service numbers).

The main task is to provide your own service, using your own gateway. Since you don't have your own service number or your own network, you'll need to use an intermediary service—like Yahoo Mail for SMS—as a way to send requests. For your network, you'll simply use the Web.

Before you implement your gateway, you'll need to decide what service you want to offer. This example uses a simple model: a user sends SMSes which are displayed as plain text on the sender's home computer.

The user will send messages using a service like Yahoo Mail for SMS. This service is offered by Yahoo to select carriers (like Hutch, Orange, etc.). Users are able to send emails from their Yahoo mail account using SMS. Here's how to send an email using Yahoo Mail:

Login to your account by SMSing the following to 8243 (this is Yahoo's service number, more commonly called the Yahoo Gateway):

in username password

To send an email, SMS the following to 8243:

to recipient@host.com mail_body

In this case, you're the only user, so the recipient email address will be one of the user's email addresses.

Because the Web is your intermediate network, the user's home machine should be connected to the internet at all times. Your gateway—which is software—will be implemented on this machine.

The gateway is like a daemon—whenever a new request comes in, the gateway services it. More specifically, the gateway is an endless (infinite) loop that sleeps in between events for a pre-defined time, meaning it's not a tight infinite loop. In this case, the service is simply displaying the SMS.

Figure 2. The Scheme of Things: This shows how the gateway fits into the scheme of things.

Take a more detailed look at how the gateway grants service requests:

  • The user sends an SMS to one of his own email addresses. The email address could be a Web mail account or a POP3 account, which is even better.
  • The gateway is running in the background. It uses the Internet to access the user's mail account to check for new emails. New emails are filtered to get only those emails that have been sent via SMS. The simplest way to do is to check for the subject, which is typically set to '[none]' when using Yahoo Mail for SMS.
  • The gateway parses the raw email source, and extracts only the body of the email, simply displaying it in the console.
  • After one round of processing, the gateway "sleeps" for a while.
  • After the sleep period is over, it springs back into action.
Now, you have implemented an SMS gateway. The gateway fits into the scheme of things as shown in Figure 2. The pseudocode in Listing 1 shows the overall logic flow for building the gateway.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date