Need Help with Google Voice Inbound

Hello everyone. I am (very) new to FreePBX, not so new with the technology in general. I read an article in MaximumPC about setting up GoogleVoice with PBX in a Flash.

So far I have everything installed, I am able to log in extension 701 as a softphone and extension 702 as an Avaya 4620SW hard phone, I am able to make outgoing calls from either line, I am able to call the internal extensions, but incoming calls ring a couple of times then go to 701s voicemail. If I attempt to leave a voicemail it goes “Thank you” blah blah blah immediately followed by an “I’m sorry, an error has occured”, followed by a disconnect.

I’ve tried messing around with the incoming routes and the trunks and everything goes to RingAll group, where both extensions are present.

I can see the call come in on the status page, but neither extension rings. Even if I have try setting it up so the incoming routes go to a specific extension, it still does not ring.

I ran a tcpdump trace while placing a call but my knowledge is not sufficient enough to read it.

Anyone care to take a stab at my issue?

i got it figured out, my incoming and outgoing calls work now. It turns out I don’t need to use the pstn side of the SPA at all. All i did was use one of the preconfig google ext in line one and it works like a charm

I could make outgoing and incoming calls on the softphone. What do you use are your dial string?

You might want to try using a softphone connected to the PBX directly to see if you can make incoming/outgoing calls just so you eliminate the SPA as a problem.

BTW I have an SPA as well, it works but I had to play with the dial string to remove the crazy delays (stil takes 5s+ for a call to go through).

I managed to get the file to work, I followed the directions now nothing works lol. I was able to make out going call now it just says all circuits are busy. I’m using a Linksys SPA 3102 to connect my phone to my pbx.

ok are there any other commands that will allow me to load this file?

I typed the command and tried to run it and it still says permission denied. I have the file in the root directory. what I meant before with the outgoing setting and incoming settings in the trunk. Do I need to enter something in the incoming settings in the trunk settings or do i just create a inbound route in leave the incoming settings in the trunk blank?

I don’t see any incoming settings on my version of freepbx so I don’t know which field that is.

You can “#chown root gvoiceaid.sh” to take ownership and “#chmod +x gvoidaid.sh” to make it executable. You should also try running it from the /root directory as some directories may not allow execution.

I’m not sure what you mean by the “inbound setting” in the trunk config. There is the “trunk” that you have to configure, this will handle incoming and outgoing calls. Then you need to define an “inbound route” and an “outbound route” depending on how you want calls routed.

ok cool thanks! Question for ya, in the trunk setting for inbound setting are you suppose to put anything there? I’ve read 3 different website say you do and 2 saying you don’t.

I tried it out, I got the file there but when i try to open it the system says i don’t have permissions to open the file. I’m logged in as root. i typed in ./gvoiceaid.sh. also how do you have it a executable file? on a website it says just delete the .sh from the file name is that correct

You need to ftp or sftp the file to your Asterisk server, otherwise from an SSH connection to your PBX you can “wget” the file (it will download it directly to the server). So, #wget <link_to_file>.

I think there were directions on how to do that on the site.

The script doesn’t auto-configure anything it just tells you what text to add to which files. I would go through and remove everything from the jabber.conf and the extensions_custom.conf from the /etc/asterisk directory first, as to not interfere with the new configuration.

Once the backend stuff is done you need to go into FreePBX and add inbound routes, trunks, etc. The script will tell you exactly what you need to do.

Whether you dial 1 or not is also dependant on the dial plan you create. I usually dial with only 10-digits, but you can use 11-digit dialing as well (at the same time).

Thanks!! I downloaded the file now how do you get it to load on the pbx? I’m new to this so i don’t really know the commands yet

Will this auto config my incoming calls? will I still have create a inbound route or will the script take care of that. also when i type in the DID number do you have to include the 1 in front of your phone number?

do you have the link for the settings you used i’m trying to figure this out as well

Sure man, I followed the instructions and used the gvoiceaid.sh script found here:

http://michigantelephone.wordpress.com/2011/01/20/a-bash-script-to-assist-asterisk-1-8freepbx-2-8-users-in-adding-new-google-voice-accounts/

Removed all the configuration for the existing Google Voice from the various files. Works like a charm. By the way I had an issue with GV prompting me for verification (press 1) for all incoming calls. If you look at the code there’s a wait(1) then sends DTMF 1, I upped the wait to 10, as it looks like it was sending it too fast and Google wasn’t getting it. Haven’t had the problem since.

I scrapped everything and installed it with directions from another source, I have it working now.

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.