Monday, January 04, 2016

RBox - Remotely Deployed GSM SIM Management

As I discussed earlier in my previous post, one of the use cases of RBox is for management of remotely deployed GSM-sim card for sending/receiving sms. You might wonder why would someone deploy their Sim card in a remote location rather than inserting it in a phone and keeping it close to your body. Well, there are many reasons why remotely deployed sim card would make sense, so far I could think of following reasons(do let me know in comments section if there are other use cases).

  1. When on international travel, your sim-card may not have roaming feature enabled.
  2. You might be located outside gsm coverage area, but you are in need of sms send/receive functionality.
  3. You may have multiple sim cards, but want to access them from centralized location.
  4. You might want to setup your own sms-gateway for sending/receiving sms over internet.
  5. You might have remotely deployed sensors sending the data via sms, and you want to collect all sms data from a central gateway.

There might be many other reasons why someone would deploy their SIM card remotely, but whatever you decide to do with this kind of setup, ensure that your SIM card is deployed at a safe and secure location to avoid possible misuse.

In simple words, this solution allows you to keep your SIM card connected to the internet and you can access it from your xmpp-client(or google-hangout) using your handheld mobile device.

You need following items to prepare this setup:

  1. SDCard image(download it from here, RBox is an open source project hosted on github
  2. Raspberry pi B or B+
  3. Micro or full size SDCard
  4. Huawei E173 USB 3G stick
  5. Sim card(ensure that SIM is not locked with pin)
  6. 5V/2A power supply.
  7. Two google(or jabber) accounts(one for you, second for your raspi)

Solution shown above, uses Huawei e173 USB 3G Modem connected to your Raspberry pi B+ and further on Raspi is connected to internet via home router. Here you can find the details about preparing the SDCard. If everything goes well, you shall see raspi being online on your android xabber app(or on your google-hangout). Send "Help" chat message and the raspi will reply will list of supported commands.

You will notice that when RBox is booted without USB-3G-stick, sms/sim related commands from the "Help" list will be missing because of missing USB-3G-stick hardware.

Before switching on the setup, ensure that password-unlocked SIM card is inserted into USB-3G-stick and a 2Amp capable 5V power supply shall be used.

Note: Ensure that both the google(or jabber) accounts are known to each other by authorizing the contact, you have to do this separately on your PC before switching ON the raspi.

How to read SMS?

  1. Send "Smsupdate"
  2. Immediate reply "InProgress : taskID=1" will be received
  3. nothing happens for 3-to-5seconds(dont panic, just wait)
  4. If everything goes well, reply "Success : taskID=1" will be received, else "Fail : taskID=1".
  5. Send "Smstotal"
  6. reply will look like: "Success : 2" this means total 2 messages are read from sim to cache
  7. send "Smsget 0" to read first message, or "Smsget 1" to read second message.

How to delete all SMS?

  1. Send "Smsdeleteall"
  2. Immediate reply "InProgress : taskID=2" will be received
  3. nothing happens for 3-to-5seconds(dont panic, just wait)
  4. If everything goes well, reply "Success : taskID=2" will be received, else "Fail : taskID=2"
  5. To know if all messages are delete, follow the steps above in section "How to read SMS"
  6. If you notice there are still undeleted messages, Repeat the step 1 to 4(hopefully in future version of RBox this problem will be fixed).

How to send SMS?

  1. Send "Smssend 009198xxxxxxxx hello this is a test message"
  2. Immediate reply "InProgress : taskID=3" will be received
  3. nothing happens for 3-to-5seconds(dont panic, just wait)
  4. If everything goes well, reply "Success : taskID=3" will be received, else "Fail : taskID=3"
  5. If you notice sms was not sent, just skip "0091" international+country code and try again.

How to do voice dialling?

  1. Send "Dialvoice 009198xxxxxxxx"
  2. Immediate reply "InProgress : taskID=4" will be received
  3. nothing happens for 20 to 25seconds(dont panic, just wait, dialling might be in progress)
  4. Call ringing will happen for 20 to 25seconds, if caller picks the call, then he will hear nothing
  5. After 25seconds call will be disconnected automatically and reply "Success : taskID=4" will be received.
  6. As of now, there is no specific use of this blank call, but future RBox release would include auto playback of recorded message to notify certain events for automation use case.

How to Dial USSD codes like *101#(useful for knowing balance amount of prepaid SIM)?

  1. Send "Dialussd *101#" (this number may vary depending on the provider)
  2. Immediate reply "InProgress : taskID=5" will be received
  3. nothing happens for 3-to-5seconds(dont panic, just wait)
  4. If everything goes well, reply "Success : taskID=5" will be received, else "Fail : taskID=5"
  5. Send "Readussd" to know the return text of last ussd-dial.


Unknown said...

sir this is a great project. i want to ask you a question. how to send a message to multiple numbers using this setup. or how to create a list. concept of bulk sms. said...

Very informative article, for those who wants to stay connected with everyone even when they are traveling or not have cell phone/Sim card with them, can get beneficial from RBox.

Sona said...

Hello Albert,

Thanks for this article. I got to this page from your post on Quora "How do you start your own SMS gateway?" I am in the US and developing some applications that will target users from Cameroon(Africa) and I will like to setup my own gateway to send sms to people in Cameroon if possible. Will your solution work or is limited to the US. How can I make it work for sending sms to Cameroon or through whatsapp?

Sms Laravel said...

I've created an open source soulution built using PHP and mysql you can find it at It has integration with more than 150 gateways or even your own device, you should have a look