Until recently you could use SIP providers to talk to Google Voice, and thus it was quite simple to use a phone analog terminal adapter (ATA) to work with the service. But now this has died, google has bought and shut down one service, others are overloaded or not taking new subscriptions.
You might ask, "why do I care? I can use google voice's web site to initiate calls", and the answer would be "but what if you want to _replace_ a voice line, or treat google voice like a real voice line - pick up your phone, dial a number, receive calls directly on the phone and so on".
Fortunately you can use Google Chat to make outgoing calls (you might have seen the link on your gmail site), and google voice can direct incoming calls to Google Chat.
So we need 4 things to make this work.
1) A google voice account
2) A Google Chat account
3) An ATA
4) Asterisk software to glue it all together.
You can also add google voice to this. You no longer need to be invited by someone else; anyone can add google voice to their google account. Pick a number that'll be convenient for you. This will be your new phone number.
IMPORTANT: you need to configure google voice to forward calls to Google Chat. It can also forward to other phones (eg your cellphone) as normal, if you wish it to.
So get and build asterisk. The posting at plugpbx is pretty much all you need to do.
Step 1: Ensure your system has all the pre-req libraries:
# apt-get update
# apt-get -y install make gcc g++ libxml2 libxml2-dev ssh libncurses5 libncursesw5 libncurses5-dev libncursesw5-dev linux-libc-dev sqlite libnewt-dev libusb-dev zlib1g-dev libmysqlclient15-dev libsqlite0 libsqlite0-dev bison openssl libssl-dev libeditline0 libeditline-dev libedit-dev mc sox libedit2 libedit-dev curl libcurl4-gnutls-dev apache2 libapache2-mod-php5 php-pear openssh-server build-essential openssh-client zlib1g zlib1g-dev libtiff4 libtiff4-dev libnet-telnet-perl mime-construct libipc-signal-perl libmime-types-perl libproc-waitstat-perl mpg123 libiksemel-dev
Step 2: Get Asterisk
# cd /usr/src
# wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-current.tar.gz
# tar xvfz asterisk-1.8-current.tar.gz
# cd asterisk-1.8.*
When I did this, 18.104.22.168 was the latest version. I wasn't sure if asterisk actually needed to be in /usr/src so I actually did this on the 300Gb disk and symlinked from /usr/src to the untarred directory. This worked.
Step 3: Fix a minor "ARM" related bug in main/utils.c
(a) Under the line: #include asterisk/config.h
add the following line:
#define __arm__ 1
(b) Search for "__sparc__" and replace the line
#if defined(__sparc__) || defined(__arm__)
for the two instances it appears in
(c) Set proper compilation for ARM platform. In makeopts.in
search for the line
and change it to
4) Configure the build environment:
5) Configure the application:
# make menuconfig
In the item "Channel Drivers" make sure "chan_gtalk" is selected
In the item "Resource Modules" make sure "res_jabber" and "res_rtp_asterisk" are selected
In the item "Music On Hold File Package" select "MOH-OPSOUND-G729"
Exit and save. The only setting I had to change was the "MOH" value, but you should verify the rest all work.
6) Now we're at the stage of compiling and installing
# make install
# make samples
# make config
Really, do read the plugpbx article on compiling for full details.
My files can be found here. The conf files need to go into /etc/asterisk/ and the agi file needs to go into /var/lib/asterisk/agi-bin/
You need to edit extensions.conf and gtalk.conf to replace YOURGVOICE with your Google Voice login name
You need to edit jabber.conf with your Google Voice username and password.
Finally you need to edit sip.conf, replacing PASSWORD and YOUR NAME values. We only actually use user 101 in the following; a second user can use 102.
Some things I've learned: originally the "102" user had transport and allow/disallow lines - this prevented it from bridging to Gtalk and failed. Also I removed the "7 digit" and "free call" sections; my area code doesn't work with 7 digit dialling and gtalk works fine for free call numbers. Also if you want to make both 101 and 102 ring at the same time for incoming calls you need to to modify the line that reads
exten => YOURGVOICE@gmail.com, n, Dial(SIP/101, 180, D(:1))
exten => YOURGVOICE@gmail.com, n, Dial(SIP/101&SIP/102, 180, D(:1))
You can also do manual addition of entries to the asterisk number lookup database by connecting to the running asterisk instance:
/usr/sbin/asterisk -r -x 'database put cidname +19875551234 "Fred Bloggs"'
You can remove entries with:
/usr/sbin/asterisk -r -x 'database del cidname +19875551234'
You can see the database with:
/usr/sbin/asterisk -r -x 'database show cidname'
And, of course, you can always use your phone's built in phonebook and let it do the lookup based on that. But one nice feature of having 411.com and asterisk do the lookup is that the number is stored in /var/log/asterisk/cds-csv/ files.
For the ATA, pretty much all you need to do is configure it to point to your asterisk server as the SIP server, with username "101" and the password you configured. The HT286 has these settings on "Advanced Settings 1"; set both the SIP User ID and Authenticate ID to "101". Save. Reboot.
If you've configured the ATA correctly the admin screens should show it's registered with the SIP server.
The posting that started me off has more details on the HT286; again I suggest you read that
Just like a real phone!
But with the advantages of having Google Voice's web page to handle voicemail, to log calls, to provide cheap international calls, to block spammers and so on.