How I have a Universal Phone Number using Google Voice, Twilio and stdlib

Written by ngardideh | Published 2016/12/01
Tech Story Tags: messaging | tech | microservices

TLDRvia the TL;DR App

Over the past little while, I’ve moved to different countries, and changed cell providers a few times. However, if I’ve given you my number before, you’ll notice how it has never changed. And I’m reachable at that number no matter where I am in the world.

I’ve received text messages in Japan and taken phone calls while at the pyramids in Egypt without even having data.

It turns out it’s very easy and cheap to make this happen if you use the right services in conjunction.

How I have a Universal Phone Number

In order to make this work, I use a Google Voice account and route it to multiple Twilio numbers that auto-forward the SMS and phone calls to local numbers I have around the world.

Google Voice numbers -> Twilio numbers -> Local numbers

The auto-forwarding is powered by a simple micro-service that’s built on top of stdlib (which we also use at our company).

Google Voice Number

This is the main phone number that I pass around to my friends. It’s very easy to create a Google Voice account and set it up.

The reason you can’t just forward straight from Google Voice to your local number that you might have in Japan, or Canada — is that Google doesn’t forward numbers outside of the U.S.

From there – you have to connect your Twilio numbers (that are proxies for your foreign numbers) using Google Voice’s forwarding system here.

Twilio Number Forwarder

Since Twilio supports a lot of international countries and regions – it’s a great service to forward your calls with. It’s also very cheap to maintain phone numbers – I usually have one or two numbers that are setup for new SIM cards outside the U.S. ready if I’m travelling. It only costs $1 month for each number.

You’ll have to buy a U.S. phone number (since Google Voice can only forward to U.S. numbers) and configure it to forward calls and texts to your actual number outside of the U.S.

Here’s an example:

Buy number 415-XXX-XXXX (a U.S. California number) and configure it to call and text 011–81–90–xxxx–xxxx (a Japanese number).

The configuration is simple – you just have to have a service that responds to Twilio saying that it should forward the call or text using their call webhook and message webhook, respectively.

This is where stdlib comes in – to provide an easy way for us to respond to the webhooks and not have to worry about maintenance of this whole system.

stdlib Twilio Webhook Phone Forwarder

Twilio needs a response that tells it to forward the call or message to another number. This can done very simple using their Twiml system.

The good news is that if you’d like to do this – I’ve already written the code and open sourced it here. All you have to do is configure the service and put in the URLs into Twilio and you’re good to go!

You’ll need one for voice calls:

https://nemo.api.stdlib.com/twilio/forward?ForwardTo=415xxxxxxx&type=call

and one for SMS:

https://nemo.api.stdlib.com/twilio/forward?ForwardTo=415xxxxxxx&type=SMS

Those URLs can go as the webhook URLs in Twilio and you’ve created yourself a simple phone forwarder. You can read more about the stdlib service here and see the source code here.

Of course, you’ll have to do this for every new number that you acquire in different parts of the world. I highly recommend keeping the same SIM cards and just reactivating them as you re-enter countries.

Thanks for reading about one of my weird life hacks.

Hacker Noon is how hackers start their afternoons. We’re a part of the @AMIfamily. We are now accepting submissions and happy to discuss advertising &sponsorship opportunities.

To learn more, read our about page, like/message us on Facebook, or simply, tweet/DM @HackerNoon.

If you enjoyed this story, we recommend reading our latest tech stories and trending tech stories. Until next time, don’t take the realities of the world for granted!


Published by HackerNoon on 2016/12/01