GoogleVoice (GV for short) is a great service (I won’t go into the details, but you can read up about it here), but it is unfortunately accessible only if you are in the USA.
Granted there is already plenty of documentation about how to circumvent this, but I’m not aware of any of those using Asterisk.
So this post will document how to sign up for a GV account as well as how to use it with Asterisk afterwards, in the prospect of using it if you are not in the USA.
In order to be able to sign up for GV, you need to meet 2 prerequisites :
- You need to have a US IP address
- You need to have a US phone number, which will be used to validate your GV account
Step 2 is the one we’re going to describe here, as an example of what you can pull with simple Asterisk configurations.
1. Getting a US phone number
What you really need to find is a DID (Direct Inward Dialing aka DDI : Direct Dial-In) provider. It will provide you with a US phone number and will patch that call either to another phone number or to a SIP address.
GV will only forward calls to US phone numbers, so you need one of those. IPKall is such a free provider. They will provide you an American phone number and will forward it to any SIP or IAX2 address. Creating an account only takes a minute.
Nothing fancy here : Simply fill the SIP account into the SIP phone number field, and the SIP servername or IP into the SIP proxy field.
2. Setting up Asterisk
Now IPKall will gladly forward the calls to your SIP account. You can setup this SIP account as simply as below :
IPKall has a specificity we need to take care of : calls can originate from 2 different servers. We need to have calls coming from both servers to get into the same context. To avoid repeating twice the same configuration block (with just the IP address being different), we’ll use a template.
We’ll also define a SIP account for a SIP phone (or for a softphone).
[phone1] type=friend username=phone1 secret=SecretPassword host=dynamic context=myhouse nat=yes ; if you need to connect from behind a nat [ipkall](!) ; This section is only a template type=peer username=ipkall context=ipkall-in insecure=invite [ipkall-01](ipkall) ; We import the previous template to setup calls from host=220.127.116.11 ; the first IPKall server [ipkall-02](ipkall) ; We import the previous template to setup calls from host=18.104.22.168 ; the second IPKall server
I’ve setup an SIP “number” I’ve instructed IPKall to forward the calls to is “ipkall”. The configuration below must reflect this. Here, phone calls to the “ipkall” extension will be routed to the “phone1″ SIP phone.
[ipkall-in] exten => ipkall,1,Dial(SIP/phone1) exten => ipkall,n,Hangup()
3.Setup a softphone and finally your GV account
Now all you need is a softphone (I like sflphone for that purpose) or a SIP phone to be configured as “phone1″ (check your favorite softphone instructions to do so) and head back to GV to create your account.
GV will assign you a phone number and will ask you to which phone number to route the phone calls. That’s where you’ll specify your IPKall phone number.
GV will then ask you to validate this phone call by giving you a 2 digit number and calling you on your IPKall phone number. You’ll have to pick up the call on your softphone and dial the 2 digit number.
Voila, the account is created and validated !
Any call to your GV phone number will be routed to IPKall which will send it to your Asterisk installation, which will then ring your softphone or SIP phone.
Pretty nifty, heh ?