DO NOT USE WITH TRIXBOX 2.8.0.4
Google Voice for Trixbox 2.8.0.3/Asterisk 1.6
You can download Trixbox 2.8.0.3 from http://sourceforge.net/projects/asteriskathome/files/trixbox%20CE...
This guide explains how to setup outbound calls with Google Voice - http://google.com/voice
I am not going to explain how to setup inbound calls, there are plenty of guides on how to setup trunks, get a DID and configure GoogleVoice to forward to your DID.
I am assuming when you read this guide, you can call your Google Voice number and receive the call on one of your extensions. I am also assuming in the definition of your trunk you used context=from-trunk
Here is the list of steps:
1. Login into your trixbox via ssh and install pygooglevoice:
# yum install python-setuptools # easy_install pygooglevoice # easy_install simplejson
2. Now as user asterisk configure your credentials for pygooglevoice:
# su -s /bin/bash asterisk $
Your prompt should change from # to $ at this point.
$ cd $ pwd # you should see /var/lib/asterisk $ gvoice call foo # keep hitting enter everywhere
The last step creates a .gvoice file, you need to edit it - e.g use
$ nano .gvoice
- to fill out the details of your account: email, password and forwardingNumber which is your DID ( the comment inside .gvoice states incorrectly the forwardingNumber is your GV number, but it is not true ) . You also need to make sure you have the right setting for the phoneType.
Now you should be able to make calls from the command line. Still as user asterisk do:
$ gvoice call 8005558355
to call TellMe. If you followed the instructions you should be promptly connected to TellMe via your Trixbox extension. If gvoice asks you any questions at this point it means your .gvoice file is missing information.
* * * * CHECKPOINT * * * *
You can not proceed unless you can use gvoice from command line to make calls.
3. Now we need to add a dialplan in order to handle Google Voice calls.
Let's edit extensions_custom.conf in /etc/asterisk
Add the following:
[gv-inbound]
exten => s,1,Verbose(Incoming call w/o DID - CallerID=${CALLERID(num)} - $[GROUP_COUNT(bridge)]);debug info
exten => s,n,Goto(gv-inbound,1234567890,2) ; some people do not get DIDs properly, making one up
exten => _X.,1,Verbose(Incoming call DID ${EXTEN} - CallerID=${CALLERID(num)} - $[GROUP_COUNT(bridge)]);debug info
exten => _X.,n,GotoIf($[GROUP_COUNT(gvbridge) != 1]?normalcall) ;
; EMPTY LINE
exten => _X.,n,Set(GROUP()=gvbridge) ; GROUP_COUNT(bridge) should be 2 now
exten => _X.,n,NoCDR() ; remove callback CDR
exten => _X.,n,Bridge(${DB_DELETE(gv_dialout/channel)},p)
exten => _X.,n,System(bash -c 'HOME=~asterisk && gvoice --batch cancel') ; mostly in case local hanged up
exten => _X.,n,Hangup()
exten => _X.,n(normalcall),Goto(from-trunk,${EXTEN},1); will use an inbound route for this DID
[gv-outbound]
exten => _X.,1,Verbose(gvbridge - $[GROUP_COUNT(gvbridge)]); some debug info
exten => _X.,n,GotoIf($[GROUP_COUNT(gvbridge) != 0]?gvinuse); only one call per GV account ;-(
exten => _X.,n,Set(DB(gv_dialout/channel)=${CHANNEL}) ; inbound needs this
exten => _X.,n,Set(GROUP()=gvbridge);
exten => _X.,n,System(bash -c 'HOME=~asterisk && gvoice --batch call ${EXTEN}'); fix the environment before running gvoice
exten => _X.,n,Wait(5) ; 5 secs should be plenty or you need better trunks
exten => _X.,n,Hangup()
exten => _X.,n(gvinuse), Macro(outisbusy)
The rest of the the setup will use trixbox GUI.
4. Change the context of your trunk where you receive Google Voice calls to
context=gv-inbound
5. Add a custom trunk, and put
Local/$OUTNUM$@gv-outbound
in the Custom Dial String
6. Configure an outbound route for Google Voice pointing to the custom trunk you just created. If you want to send all calls via Google Voice simply put "X." for Dial Patterns
Submit all your changes. You should be able to make outbound calls.
DO NOT USE WITH TRIXBOX 2.8.0.4 - ASTERISK DUMPS CORE
|||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||| \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Extras: The version presented here is somewhat simplified. You may have noticed it works fine 99.99% of the time which for most people should be enough.
There is one small problem:
When dialing out if you get another incoming call it will be bridged instead of Google Voice callback and the callback will be put into call waiting. This was done for the sake of simplicity. If you want to fix this issue you can add an extra line which will make sure the caller ID of the incoming call is really Google Voice. Put the following line instead of the EMPTY LINE replacing 3105551212 with your Google Voice number exactly as presented by your trunk (may include "+" ):
exten => _X.,n,GotoIf($["${CALLERID(num)}" != "3105551212"]?normalcall) ; this is where you put your Google Voice number as presented by your trunk
DO NOT USE WITH TRIXBOX 2.8.0.4 - ASTERISK DUMPS CORE