Fork me on GitHub

EnvayaSMS SMS gateway for Android

How it Works

In the simplest configuration, EnvayaSMS only needs to be installed on one phone. Suppose that you have installed EnvayaSMS on an Android phone in Dar es Salaam, Tanzania, with phone number +255987654321 (local number 0987654321), with GSM service from Vodacom.

Suppose also that your web server is example.com, and its servers are located in a datacenter in London.

In Dar es Salaam, you would put the Android phone in an office with internet access and a Wi-Fi router, and connect the phone to the Wi-Fi network. (Wi-Fi is not strictly necessary, since EnvayaSMS will also work over the phone's mobile data connection, but Wi-Fi is likely to be faster, cheaper, and more reliable.)

Then your network would look like this:

Typically your organization will need only one phone running EnvayaSMS in a particular country. However, it is possible to use multiple phones to load-balance requests for higher throughput, to offer different user services, or to serve different mobile networks.

Receiving incoming SMS and sending replies

Here is an example of how EnvayaSMS would forward an incoming SMS to your server, and send a SMS back as a reply:

  1. User in Tanzania, using Nokia phone with phone number 0555551234, sends SMS message to 0987654321
  2. Your Android phone at 0987654321 receives SMS
  3. EnvayaSMS sends SMS to example.com via HTTP
  4. example.com processes the message and returns SMS reply in HTTP response
  5. EnvayaSMS forwards SMS reply to 0555551234

Since users generally are charged only for outgoing messages in Tanzania, the user would be charged for sending one local SMS message, and your phone would also be charged for sending one local SMS message.

Sending outgoing SMS notifications

EnvayaSMS uses a different process to send SMS notifications that were not in response to an incoming message.

Assume now that example.com has multiple phones using EnvayaSMS in different countries, and it is configured to send all messages to phone numbers with a 255 prefix (Tanzania's country code) via the cell phone with number +255987654321.

  1. example.com wants to send an SMS message to +255555551234
  2. example.com identifies that the recipient number has a 255 prefix, and chooses sender phone number +255987654321
  3. The next time EnvayaSMS polls example.com for outgoing messages for its phone number +255987654321, the server responds with the message to send
  4. EnvayaSMS forwards the message to 0555551234
  5. EnvayaSMS notifies example.com via HTTP that message was sent
  6. example.com removes the SMS message from its queue of outgoing messages.

In these examples, even though SMS messages are being communicated between Dar es Salaam and London, all SMS messages are sent domestically and are not charged as international SMS messages.