Google Voice using Asterisk

You will need a Google voice account to do this. You can get one for free by having a normal Google account, and visiting the Google Voice page.

The top most portion of this page: http://pbxinaflash.com/forum/showthread.php?t=10825 will help you setup the Google Voice portion on the Google side. Once you see the screen shots on that page, you can then use this configuration, or read up if you have their software to continue.

Just my working configuration files for using a google voice number on your asterisk server.

gtalk.conf

[general]
context=googlein
bindaddr=0.0.0.0
externip=xxx.xxx.xxx.xxx
;stunaddr=mystunserver.com
allowguest=yes

[guest]
disallow=all
allow=ulaw
connection=asterisk
context=googlein

jabber.conf

[general]
debug=no
autoprune=no
autoregister=yes
;collection_nodes=yes
;pubsub_autocreate=yes
;auth_policy=accept
;----------------------------------------------
[trunkname]
type=client
serverhost=talk.google.com
;pubsub_node=pubsub.astjab.org
username=[email protected]/Talk
secret=secretpassword
priority=1
port=5222
usetls=yes
usesasl=yes
;buddy=[email protected]
;distribute_events=yes
status=Available
statusmessage="I am an Asterisk Server"
timeout=100
keepalive=yes

Add following block to extensions_custom.conf

[googlein]
exten => _[0-9a-z].,1,Noop(Incoming Google Voice call for ${EXTEN})
exten => _[0-9a-z].,n,Set(CALLERID(name)=${CUT(CALLERID(name),@,1)})
exten => _[0-9a-z].,n,GotoIf($["${CALLERID(name):0:2}" != "+1"]?notrim)
exten => _[0-9a-z].,n,Set(CALLERID(name)=${CALLERID(name):2})
exten => _[0-9a-z].,n(notrim),Set(CALLERID(number)=${CALLERID(name)})
exten => _[0-9a-z].,n,Wait(1)
exten => _[0-9a-z].,n,Answer
exten => _[0-9a-z].,n,Wait(1)
exten => _[0-9a-z].,n,SendDTMF(1)
exten => _[0-9a-z].,n,Goto(from-trunk,gv-incoming-${CUT(EXTEN,@,1)},1)
exten => h,1,Macro(hangupcall,)

[gvoice-trunkname]
exten => _X.,1,Dial(Gtalk/username/+${EXTEN}@voice.google.com)
exten => _X.,n,Noop(GVoice Call to ${EXTEN} failed)
exten => h,1,Macro(hangupcall,)

Custom Trunk Configuration:
Trunk Name: GVoice-trunkname
Outbound Callerid: “Name”
Custom Dial String: local/$OUTNUM$@gvoice-trunkname

Outbound Route Configuration:
Use the GVoice trunk.

Incoming Routes DID will be:
gv-incoming-username (without @gmail.com)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Post Navigation