A Google Voice Landline with Asterisk

June 4, 2011
This article was updated May 2013 with new instructions for Asterisk 11.

Inspired by a recent Maximum PC article, I recently set up a land line telephone that supports both incoming and outgoing calls from my Google Voice number. I opted to use an installation of Asterisk in on an Arch Linux server instead of using one of the pre-built PBX Linux distributions. The process involved enough fiddling and Google searching that I thought a summary of how my setup works could be helpful for others.

I compiled this setup by following the official Asterisk guide to enabling Google Voice and by mixing in a few other tips.

Install the Package

In Arch, Asterisk is available in the AUR.


There a few Asterisk configuration files to change:


Add this to the end of the file:



Add this to the end of the file:

load => chan_motif.so
load => res_xmpp.so


Find the [local] section of this file and add this to set up outgoing calls:

exten => _1XXXXXXXXXX,1,Dial(Motif/google/${EXTEN}@voice.google.com,,r)

At the end of the file, add this new incoming-motif section. Replace asterisk-username with your user account in Asterisk. This enables incoming calls and corrects the Caller ID.

exten => s,1,NoOp()
 same => n,Set(crazygooglecid=${CALLERID(name)})
 same => n,Set(stripcrazysuffix=${CUT(crazygooglecid,@,1)})
 same => n,Set(CALLERID(all)=${stripcrazysuffix})
 same => n,Dial(SIP/asterisk-username,20,D(:1))


Replace asterisk-username with your desired Asterisk username and asterisk-password with your desired password - you’ll use this account information to log in to your Asterisk server from a SIP phone.



Replace your.google.voice.account@gmail.com with your actual Gmail address and your-google-voice-password with your Google account password. If you use Google’s two-factor authentication, you will need to create an application-specific password.

statusmessage="Asterisk Server - Not a Human"


There are a few known issues with this setup.

The Google account you use will appear logged into Google Talk anytime the server is running. Messages sent to the server will just get lost in the ether. I set up a separate Google account with my Voice number so this wouldn’t be an issue. If you already have an established Voice number that you don’t want to change, another option is to create a second Google account for chat only - although then you lose the ability to use the inlined chat in Gmail. If anyone has a better solution for this, I’d love to know about it.

Incoming calls are not bulletproof - occasionally the phone will ring, but after picking it up you just get dead air. My cell phone keeps ringing when this happens so I’m still able to pick up the call. It’s annoying, however, and I’d love to find the root cause.

Other times, if you accidentally logged into Google Talk somewhere else, the local SIP phone won’t ring at all. My current workaround is to reboot Asterisk via a cronjob every night, so at least it gets back to normal fairly quickly.

Otherwise, outgoing calls work quite well. The only issue I’ve ever had is if I’m using all of my upstream bandwidth doing something else, but that’s not unique to Asterisk. Some QoS controls in your router should help out with that.

Chef Cookbook

When I originally set up Asterisk, I wrote a Chef cookbook that did most of this configuration automatically. I no longer use Chef to manage my system configuration (nothing against Chef, it was just overkill for my setup and Arch Linux moves too quickly), so I’m not actively maintaining that cookbook anymore. If you use Chef, it may be a good starting point, and I’d be happy to transfer control of the cookbook over to you.