Categories
Software Technical

Followup: Google Voice to FreePBX

In a previous post I wrote about  Adding Google Voice to FreePBX

After a lot of tinkering and research I was able to get inbound dialing to my assigned extension working.

I tell you think much, it wasn’t simple for me to understand and I may play around with setting this thing up a few more times so that I get a full grasp of it all.

I just wanted to take some time and share the three config I have that make this possible.

 

gtalk.conf

[general]
allowguest=yes
context=from-google
bindaddr=0.0.0.0
externip=aa.bb.cc.dd ; if you know your external ip addr
stunaddr=stun01.sipphone.com ; use STUN if you’re on dynamic IP and NAT

[guest]
disallow=all
allow=ulaw
context=from-google
connection=asterisk

 

jabber.conf

[general]
debug=yes
autoprune=no
autoregister=yes

[asterisk]
type=client
serverhost=talk.google.com
username=youruser@gmail.com/asterisk
secret=yourpassword
port=5222
priority=100
usetls=yes
usesasl=yes
status=Available
statusmessage=”I am an Asterisk Server”
timeout=100
keepalive=yes

 

extensions_custom.conf

[from-google]
exten => youruser@gmail.com,1,Set(CALLERID(name)=${CUT(CALLERID(name),@,1)})
exten => youruser@gmail.com,n,GotoIf($[“${CALLERID(name):0:2}” != “+1”]?notrim)
exten => youruser@gmail.com,n,Set(CALLERID(name)=${CALLERID(name):2})
exten => youruser@gmail.com,n(notrim),Set(CALLERID(number)=${CALLERID(name)})
exten => youruser@gmail.com,n,Wait(3)
exten => youruser@gmail.com,n,Answer
exten => youruser@gmail.com,n,Wait(6)
exten => youruser@gmail.com,n,SendDTMF(1)
exten => youruser@gmail.com,n,Goto(from-trunk,##########,1)
exten => h,1,Macro(hangupcall,)

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

 

After the above configuration you need to go into the FreePBX GUI and do the following:

First, create a new Inbound Route, using the following settings:

DID Number: 0000000000
CID Lookup Source: If you have a Caller ID lookup source available (such as the
Caller ID Superfecta) I suggest that you enable it, because Google Voice
does not pass Caller ID names.
Destination: Don’t forget to choose one!
Then click “Submit”.
Second, create a CUSTOM Trunk, using the following settings:

Trunk Name: GV_jermsmit
Dialed Number Manipulation Rules: Create one rule as follows: 1+NXXNXXXXXX

In other words, place 1 in the first text box (before the + sign) and
NXXNXXXXXX in the third text box on the same line.

Custom Dial String: local/$OUTNUM$@gvoice-jermsmit

Then click “Submit Changes”. If a popup appears complaining that you did
not set an Outbound Caller ID you can dismiss it and proceed.

Third, configure one or more Outbound Route(s) to use the trunk you just created.

If you want to restrict use of the route to just one extension or a group of
extensions, you can specify those extension using the “match pattern”
(fourth) field of each of your “Dial Patterns that will use this Route.”

Such routes much be placed above (higher in priority than) any other routes containing the same or similar dial patterns but no extension restrictions.

When you are all finished don’t forget to do an orange bar reload in FreePBX.
Then from the Asterisk CLI issue one of the following commands to restart
Asterisk:

core restart when convenient (to wait until there are no active calls)
core restart now

And to quote a trusted technical source:

PL  –  Core reload should also work, but without dropping you back to the shell.