Asterisk 1.8 + Multiple Inbound Google Voice Accounts?

Greetings all,

The “native” Google Voice support in Asterisk 1.8 is looking great so far! Using the information on the Calling Using Google wiki article, I was able to easily get both inbound and outbound connectivity.

My PBX serves myself and several others in my house. We all have Google Voice accounts.

I was able to get jabber sessions established for these three accounts, and use the dialplan configuration to route calls out any of the accounts; caller ID and call logging worked, so the outgoing calls were getting initiated on the proper account, etc.

But the inbound routing is proving trickier. Any ideas on how to set up gtalk.conf for multiple incoming GV accounts? I’d like each account to come in on it’s own context, which would allow for proper dialplan and call routing configuration.

I’m not sure if this is possible, and what the appropriate syntax would be. Did not see any docs on this; anyone have the recipe?

Thanks in advance! :smile:

Here’s one way I just figured out to make this happen; possibly not the only or best way, but seems to do the job. Relevant config sections follow. Idea here is two SIP clients (one PC and one Android device) with two google voice accounts, and enough configuration for both devices to place and receive calls on both lines.

*** jabber.conf
[general]
debug=yes
autoprune=no
autoregister=yes

[XXXXjabber]
type=client
serverhost=talk.google.com
username=XXXX@gmail.com/Asterisk
secret=supersekret
port=5222
usetls=yes
usesasl=yes
statusmessage="Asterisk"
timeout=100

[YYYYjabber]
type=client
serverhost=talk.google.com
username=YYYY@gmail.com/Asterisk
secret=supersekret
port=5222
usetls=yes
usesasl=yes
statusmessage="Asterisk"
timeout=100

*** sip.conf
[androidXXXX]
type=friend
host=dynamic
secret=sekret
context=gvXXXX
callerid=“AndroidXXXX” <101>
nat=yes

[androidYYYY]
type=friend
host=dynamic
secret=sekret
context=gvYYYY
callerid=“Android YYYY” <101>
nat=yes

[pcXXXX]
type=friend
host=dynamic
secret=sekret
context=gvXXXX
callerid=“pcXXXX” <100>
nat=yes

[pcYYYY]
type=friend
host=dynamic
secret=sekret
context=gvYYYY
callerid=“pcYYYY” <100>
nat=yes

*** gtalk.conf
[general]
allowguests=yes
bindaddr=x.x.x.x

[guest]
disallow=all
allow=ulaw
context=gv-inbound
connection=XXXXjabber

*** extensions.conf
[users]
exten => 100,1,Dial(SIP/pcXXXX,20)
exten => 101,1,Dial(SIP/androidXXXX,20)
exten => 200,1,Dial(SIP/pcYYYY,20)
exten => 201,1,Dial(SIP/androidYYYY,20)

[gvXXXX]
;append an area code if necessary
exten => _NXXXXXX,1,Set(CALLERID(dnid)=1239${CALLERID(dnid)})
exten => _NXXXXXX,n,Goto(1239${EXTEN},1)
;append a 1 if necessary
exten => _NXXNXXXXXX,1,Set(CALLERID(dnid)=1${CALLERID(dnid)})
exten => _NXXNXXXXXX,n,Goto(1${EXTEN},1)
;do our real dialing
exten => _1NXXNXXXXXX,1,Dial(gtalk/XXXXjabber/${EXTEN}@voice.google.com)
exten => _+1NXXNXXXXXX,1,Dial(gtalk/XXXXjabber/${EXTEN}@voice.google.com)
include => users

[gvYYYY]
exten => _NXXXXXX,1,Set(CALLERID(dnid)=1239${CALLERID(dnid)})
exten => _NXXXXXX,n,Goto(1239${EXTEN},1)
exten => _NXXNXXXXXX,1,Set(CALLERID(dnid)=1${CALLERID(dnid)})
exten => _NXXNXXXXXX,n,Goto(1${EXTEN},1)
exten => _1NXXNXXXXXX,1,Dial(gtalk/YYYYjabber/${EXTEN}@voice.google.com)
exten => _+1NXXNXXXXXX,1,Dial(gtalk/YYYYjabber/${EXTEN}@voice.google.com)
include => users

[gv-inbound]
exten => XXXX@gmail.com,1,Answer()
exten => XXXX@gmail.com,n,Wait(1)
exten => XXXX@gmail.com,n,SendDTMF(1)
exten => XXXX@gmail.com,n,Dial(SIP/androidXXXX&SIP/pcXXXX,20)

exten => YYYY@gmail.com,1,Answer()
exten => YYYY@gmail.com,n,Wait(1)
exten => YYYY@gmail.com,n,SendDTMF(1)
exten => YYYY@gmail.com,n,Dial(SIP/androidYYYY&SIP/pcYYYY,20)

Hi
*** gtalk.conf
[general]
allowguests=yes
bindaddr=x.x.x.x

[guest]
disallow=all
allow=ulaw
context=gv-inbound
connection=XXXXjabber

Do we need one ore entry in gtalk.conf to support multiple inbound google voice.