UPDATE!! So I was able to figure out the incoming portion of it and set up the incoming route with the correct DDI. Incoming and outgoing calls work great.
I’m not trying to configure a second GV number on my system but the configurations I have seen online don’t really match up to what I have, and since I’m not sure of the programming flow I’m not sure what I need to change.
Here is a snapshot of my custom extensions conf file:
[googlein]
exten => [email protected],1,Wait(1)
exten => [email protected],n,Set([email protected])
exten => [email protected],n,JABBERSend(asterisk,${ALERTNAME},Incoming Google Voice Call: ${CALLERID(name):2:10})
exten => [email protected],n,Set(CALLERID(number)=${CALLERID(name):2:10})
exten => [email protected],n,Set(CALLERID(name)=${CALLERID(number)})
exten => [email protected],n,GotoIf(${DB_EXISTS(gv_dialout_uname/channel)}?bridged)
exten => [email protected],n,Goto(s,regcall)
exten => [email protected],n(bridged),Bridge(${DB_DELETE(gv_dialout_uname/channel)}, p)
exten => s,1,Wait(1)
exten => s,n,Set([email protected])
;exten => _X.,n,Set(STATUS=${JABBER_STATUS(asterisk,${ALERTNAME})});
;exten => _X.,n,NoOp(Gvoice/Jabber Status: ${STATUS})
exten => s,n,JABBERSend(asterisk,${ALERTNAME},Incoming Google Voice Call: ${CALLERID(name):2:10})
exten => s,n,Set(CALLERID(number)=${CALLERID(name):2:10})
exten => s,n,Set(CALLERID(name)=${CALLERID(number)})
exten => s,n(regcall),Answer
exten => s,n,SendDTMF(1)
;exten => s,n(regcall),Set(DIAL_OPTIONS=${DIAL_OPTIONS}aD(:1))
;exten => s,n,Goto(from-trunk,gv-incoming,1)
exten => s,n,Goto(from-trunk,gv-incoming-${CUT(ALERTNAME,@,1)},1)
[gvoice]
exten => _X.,1,Wait(1)
exten => _X.,n,Set([email protected])
;exten => _X.,n,Set(STATUS=${JABBER_STATUS(asterisk,${ALERTNAME})});
;exten => _X.,n,NoOp(Gvoice/Jabber Status: ${STATUS})
exten => _X.,n,JABBERSend(asterisk,${ALERTNAME},Placing GVoice Call: ${EXTEN})
exten => _X.,n,GotoIf($["${LEN(${EXTEN})}"=“10”]?us:other)
exten => _X.,n(us),Dial(Gtalk/asterisk/+1${EXTEN}@voice.google.com)
exten => _X.,n,Goto(done)
exten => _X.,n(other),Dial(Gtalk/asterisk/+${EXTEN}@voice.google.com)
exten => _X.,n(done),NoOp(GVoice Call to ${EXTEN} failed)
[gvoice-uname]
exten => _X.,1,System(sudo /usr/bin/gvoice -e [email protected] -p passw0rd call ${EXTEN} [email protected] 9 &)
exten => _X.,n,Background(pls-wait-connect-call)
exten => _X.,n,Set(DB(gv_dialout_uname/channel)=${CHANNEL})
exten => _X.,n,Wait(30)
exten => _X.,n,Noop(Never received callback from Google Voice on channel ${DB_DELETE(gv_dialout_uname/channel)} â exiting)
exten => h,1,GotoIf($["${CHANNEL(state)}" = “Ring”]?:bridged)
exten => h,n,Noop(Hangup on channel ${DB_DELETE(gv_dialout_uname/channel)})
exten => h,n,System(sudo /usr/bin/gvoice -e [email protected] -p passw0rd cancel &)
exten => h,n,Hangup()
exten => h,n(bridged),Noop(The channel has been bridged successfully)
My incoming route is set up as ‘gv-incoming-primary’.
I can’t figuring out a way routing different DDIs to different places, as the DID isn’t the GV username but my primary account username. I would assume in free PBX I would set up my routes as gv-incoming-uname.pbx1 and gv-incoming-uname.pbx2.