Raspberry Pi GSM gateway

If you travel a lot, you’ll be used to absurd roaming charges when you use your mobile phone. But sometimes your phone’s an absolute necessity – those of us at the Foundation can’t really go overseas for work or for holiday without paying those charges, because we need to be in touch with the office and with a lot of other people around the world who need to talk about things Pi. (And we like to be able to phone our mothers.)

Holger Leusch, Benjamin Reichel and Karina Hochstein have found themselves with a similar problem. Worse still, Holger travels to Cambodia a lot, and his German phone provider doesn’t even have a roaming agreement with any of the Cambodian telcos, so he’s not able to use his phone there at all. He found VoIP unusable in Cambodia, with patchy calls, lousy bandwidth, delays and dropouts. Like us, he needed to be in constant touch with his office.

Enter (you knew this was coming, didn’t you?) the Pi.

Many of those in Holger’s position would look into buying a SIP-based GSM gateway. GSM gateways are expensive things: Holger’s research found that a single GSM port (and you’ll need two, one at each end) was priced between €200 and €400. “For this to pay off, I would have to make a whole lot of phonecalls.” So he, Benjamin and Karina built their own, using a Pi running RasPBX; a Huawei dongle for 3G; a Chan dongle which works as an Asterisk channel driver; and a USB modeswitch. The whole kit came to €75.

Holger says:

Now when a caller in Europe calls my german GSM number, first my domestic Snom phone rings, then after 5 seconds, my Cambodian mobile phone gets called. As a sideffect, my Cambodian friends from now on can call and SMS my German phone back at local rates of a few cents…

The connection quality over the 10.000 km spanning 64 kbps Asterisk SIP trunk between both gateways actually is so amazing that none of the callers even noticed that I was out of the country at the time!

Please be aware that in some countries, telecoms law around GSM gateways is a bit fuzzy. In the UK, Ofcom says:

Ofcom has recently clarified that it is entirely legal under UK law for end-users (whether businesses or ordinary consumers) to buy, install and use GSM gateways for their own use. However it is currently illegal under UK law for anyone to use GSM gateway equipment to provide a communications service by way of business to another person or organisation, irrespective of where the gateway equipment is located, or how many or few end-users are connected to each gateway. This prohibition on ‘commercial’ use applies equally to the mobile network operators (MNOs) as to other organisations, since the MNOs’ licences do not currently extend to the installation and use of GSM gateways.

Basically, you can build a gateway yourself in the UK – but woe betide you if you try to sell or lease one. The mobile network operators sometimes take this even further (for reasons which you might, when you consider all the lovely money that results from those roaming charges, think to be a bit…venal): for example, if Vodaphone suspects you’re using one of its sim cards in a GSM gateway it says it will disable the card. So be sure to research what the local rules are carefully before you implement something similar yourself.

You can read more about Holger, Benjamin and Karina’s setup at Carrier Connect Shout Out.

 

29 comments

Avatar

This is fantastic. Well done :)

Avatar

Extremely useful. Excellent job guys! Will have to check Indian Laws ;) :P

Avatar

Hi Anand,

Did you check Indian laws.. Are we allowed to do it ?

regards,
Pratik

Avatar

No! The Indian law does not allow this. The Govt of India wants to keep limited points of inflow and out flow so they can monitor it. TRAI has a hot line where you are supposed to report foreign calls that originate from Indian numbers (this – VoIP GSM). I think it is stupid. Any terrorist worth h(er/is) salt shall use encryption and it cannot be cracked before the message looses it’s value.

Avatar

Indian law doesn’t allow termination f VoIP originating outside of the country to be terminated/interconnected to the local PSTN/mobile network. However, you may use a stand-alone VoIP ATA (and phone) connected to the internet to make/receive calls to/from abroad.

Avatar

Really awesome work…..

Avatar

Well, I suppose it could be worse, we could still have to turn a crank on a box the size of a refrigerator to ring a bell at the distant end and ask for our assistant, Mr. Watson, to come from a room at the other end of the building to help us … :D

Avatar

Very Interesting. I suspect if I wait long enough, someone will develop one of my other favorite projects. (The first was using a Raspberry Pi, web enabled, to control my lawn sprinklers. See Rayshobby and OpenSprinkler Pi for that.)

This one is a home communicator system similar to the communicator badge worn by the Startrek Next Generation folks. I know it’s phony on TV, but I don’t see why some wise person does not come up with something that can be used by merely saying the persons name. Calling Connie, or Calling Larry and the connection is made to the device near Connie or Larry.

Hurry Please! 8>)

Avatar

this is awesome for many reasons

I need to know how its done

Avatar

Follow the links – instructions there!

Avatar

I haven’t seen it on the PI but there are commercial implementations out there. One of the local hospitals uses one such system.

Avatar

Sorry this was supposed to be in response to Homer.

Avatar

Thanks Bob,

I thought it might be but was unsure. Do you have any idea of what it might be called?

Thanks again.

Avatar

Hi again Bob,

Never mind. With your hint of tracking in Hospitals, I was able to search for Hospital Tracking System and come up with RTLS which stands for Real Time Location System.

That’s the concept I want.

Thank you

Avatar

Looks amazing. One small question, though:
“He found VoIP unusable in Cambodia, with patchy calls, lousy bandwidth, delays and dropouts.”
So, how does this tunneling solution get better connection quality than those VoIP providers?

Avatar

@ L.
Have you tried asking this directly to the makers of Raspberry Pi GSM gateway? :)

@ Raspberry Pi Foundation, Holger Leusch, Benjamin Reichel and Karina Hochstein
“Good things come to those who wait”. And boy have I waited long for this hack! One year to be exact. Thank you for sharing.

Avatar

So Vodafone UK say this:

“… Vodafone’s policy is not to accept applications for the operation of GSM Gateways on its network. Customers should be aware that where a GSM Gateway is connected to the Vodafone network in breach of this policy, Vodafone has and will continue to disconnect SIM cards that it believes are being used illegally.”

Strange wording. They’ve said that they will disconnect SIM cards if they believe they are being used illegally.

As this blog entry states, Ofcom have stated that it’s not actually illegal to set up a GSM gateway for one’s own personal use in the UK, but one cannot provide a GSM service.

Therefore, logic might suggest that Vodafone should not disconnect SIMs which which are being used legally in a GSM gateway.

Avatar

This is cool, I will try it…

Avatar

I have managed successfully built the system and finally came out with the possibility to make a call using usb dongle. watch the video here:

http://youtu.be/hS5uUtUZpVI

Avatar

Would you mind posting detailed how to please?

Avatar

Great! Pretty nice thing… I found this Asterisk Telefonanlage tutorial in German extremely helpful as a pre-requesite for the installation of the GSM gateway. Just wanted to share with you.

Love, Frederike

Avatar

great work!

Avatar

After much tinkering, I was able to setup freepbx with chan_dongle on my pi. Sadly, because of the double-nat that my isp is doing on their server side, I cannot forward the port of my asterisk so that I can use my voip account. Is there any work-around for this using the existing setup?

Avatar

i want to by Raspberry Pi. but me live in cambodia.where by?

Avatar

Same question from my side.

I am living in Cambodia and would like to purchase a Rasperry Pi here. Unfortunately I couldnt find any shop who is importing them yet!

Looking forward to receive some advice :)

Avatar

I’d really like to set up a VPN on a server (not pi) which has a static and then connect the pi to the VPN and my laptop to the VPN and connect to my pi that way… Any ideas?

Avatar

If i were to create one like this. I would just buy two android phones. And each android phone will act as a gateway using an sms application (i can create one in less than a day). So when the phone from germany receives a message it will forward any incoming messages to a certain http etc etc…. you get the idea. ;)

Avatar

Hi all

I am new to asterisk/chan_driver. I am thinking of something and was wondering if it can be done.

What I want to achieve:

I have a SIP account with a provider. I can use any sip client to make calls.

I have a raspberry pi.

I can buy a usb gsm dongle.

I want to install the dongle with a gsm sim card in the pi. Also setup my sip account to be used by asterisk.

Then when I call this sim card to be given the option to send a number via dialpad on my gsm phone. Then the asterisk/chan driver to dial this number in my sip account and transfer it to the active gsm call. In that way I can use the sip account to make calls from my gsm phone.

Is this possible at all?

If so can someone post a how to?

Thanks

Avatar

There are some posts in the forum about getting asterix to work – I suggest doing a search, and if necessary, reposting your question in the forums.

Leave a Comment

Comments are closed