2 Google Voice numbers

Hello All,

FreePBX 2.8.1.0

I have configured Asterisk via FreePBx with the following configuration for 2 Google voice accounts. Two different users of course.

GV1
GV2

http://michigantelephone.wordpress.com/2010/12/21/how-to-use-google-voice-for-free-calls-on-an-asterisk-1-8freepbx-2-8-system-the-easy-way/

I have set up two trunks, two outbound routes, two inbound routes ,each with separate context’s.
Outbound and inbound calls works perfect on each extension,other than on the GV2 account the receiving phone sees the GV1 GV number.
Anyone know how to troubleshoot this? I have looked at the asterisk CLI but simply can not see what needs to be changed?

Thanks,
Barry

Hey!!!

Thank You asterisk21st!

This worked!
the outbound call from GV2 does show GV2 phone number now.
I DID learn something from all of this…:slight_smile:
I will have to study up on outbound route dial patterns and trunks…:slight_smile:

Thanks again,
Barry

as I wrote, I setup my GV numbers to require a prefix to dial out. For instance, press 8 + 1 + area code + telephone number.

so in the three boxes this would look like this:

nothing | prefix 8 | 1NXXNXXXXXX

Hello All,

Can someone here tell me if I use the following dial pattern( for the second GV ext) if this should ‘force’ this extension to use GV2 trunk.
I have GV1 extension dial pattern

1 _ NXXNXXXXXX
_ _ 1NXXNXXXXXX
1555 _ NXXXXXX

If i use for GV2
(GV2 DID = 1112223333)

1 _ NXXNXXXXXX 1112223333
_ _ 1NXXNXXXXXX 1112223333
1555 _ NXXXXXX 1112223333

And select trunk2 as I have it selected now,will this force GV2 extension to use the GV2 trunk?
I should be able to get the second phone to test this with tomorrow.

thank You,
Barry

sir_sip,

You are exactly right in regards to my ‘two of each’ on outbound route,trunk,inbound route. I DO have trunk2 outbound route2 for GV2 user.
Please give me an example of how to alter my dialing pattern so GV2 will ONLY use GV2 trunk/outbound route
For both I DO have identical dialing patterns. I simply have not used asterisk enough to know the ‘matched dialing patterns use same trunk’ deal
I have:

  _  1NXXNXXXXXX

1 _ NXXNXXXXXX
1555 _ NXXXXXX

For dialing pattern for both of my 2 GV extensions.

Thanks again,
Barry

brcisna, you posted while I was typing that last message. You need to understand that Google Voice sets the CID so if you are only seeing 1 GV number then you are only using that 1 trunk. Did you create two custom trunks as the link you posted directs you to do? If so, try making sure that only the GV2 is selected. Temporarily disable GV1, in other words. Now it should show the GV2 number on outgoing calls. If that’s the case, it means your contexts and trunks are probably correct and that the problem is in your outbound routes.

sir_sip:

I only omitted the the entire email address from my example so my email address is not shown. Of course you need the entire address for the incoming and outgoing trunks to work. sorry for omitting this information from my example.

Sir_sip is also right that you need incoming and outgoing routes. For each google voice account, I have information in the [googinin] as well as the account [user2] in extensions_custom.conf and information similar to that of the oP.

Furthermore, each account has an incoming, outgoing, and custom trunk in freepbx. To make outgoing calls on the various trunks, I assigned a random digit like 9 to it so if I want to use this trunk to make an outgoing I press 9 +1(area code)+rest of number, this is setup in the outbound prefix area.

I used the same instructions to get my google voice working but it took many tries since I was not completely following the steps. I think the oP is nearly there to resolve it.

If I understand the OP correctly, he’s not having a problem with incoming calls, and as best I can tell his incoming context is fine, whereas the one suggested by asterisk21 is not. That’s because if you’re going to go the route that asterisk21 suggests, you need complete e-mail addresses, not just "@gmail.com." The problem the OP is having is that for some reason only one of his two Google Voice trunks is being used for outgoing calls, and if you read the article he links to you’ll note that he also has to create two custom trunks, and then somehow select which trunk he wants to use in his outbound routes.

My guess, and it is only a guess, is that more than likely he only has one outbound route and is selecting both trunks in that route, in which case the first trunk would always be used unless it is busy. Or, maybe he has two outbound routes each selecting a different trunk, but if the outbound route dial patterns are identical then only the first one would be used and the second would always be ignored. This is a common error that people seem to make with multiple Google Voice trunks if they don’t understand the way that FreePBX and Asterisk work; people don’t get that once Asterisk matches on a pattern it will totally stop looking at patterns, so if the call fails for some reason it it will not move on to another, lower priority outbound route that contains the same pattern. Unless you do something to force use of the second trunk, such as using dialing prefixes or using certain outbound routes only with certain extensions (through the use of the extensions field in the dial patterns, or by using something like Custom Contexts), most of the time only the first trunk will be used.

Thanks for the feedback!

OK, So the ‘googlein’ context you have listed does work for a 2 number/user in FreePBX 2.8.10 setup?
Stupid question. The trouble I am having is actually with the ‘outgoing’ calls,AKA: wrong GVnumber being shown on the ‘recipient’s’ phone.? GV1 number being shown when GV2 extension calls a landline for example.

Barry

So your configuration looks a little different from mine at the jabber section but I don’t think that is the issue.

My best guess is that the [googlein] is missing more information.

[googlein]
exten => @gmail.com,1,Set(CALLERID(name)=${CUT(CALLERID(name),@,1)})
exten => @gmail.com,n,GotoIf($["${CALLERID(name):0:2}" != “+1”]?notrim)
exten => @gmail.com,n,Set(CALLERID(name)=${CALLERID(name):2})
exten => @gmail.com,n(notrim),Set(CALLERID(number)=${CALLERID(name)})
exten => @gmail.com,n,Answer
exten => @gmail.com,n,Wait(1)
exten => @gmail.com,n,SendDTMF(1)
exten => @gmail.com,n,Goto(from-trunk,xxxxxxxxxx,1)
exten => @gmail.com,1,Set(CALLERID(name)=${CUT(CALLERID(name),@,1)})
exten => @gmail.com,n,GotoIf($["${CALLERID(name):0:2}" != “+1”]?notrim)
exten => @gmail.com,n,Set(CALLERID(name)=${CALLERID(name):2})
exten => @gmail.com,n(notrim),Set(CALLERID(number)=${CALLERID(name)})
exten => @gmail.com,n,Answer
exten => @gmail.com,n,Wait(1)
exten => @gmail.com,n,SendDTMF(1)
exten => @gmail.com,n,Goto(from-trunk,xxxxxxxxxx,1)

Notice how many @gmail.coms you see? That’s because you have to restart it and have an occurrence for every email address. The xxxxxxxx is the telephone number.

post the extensions_custom.conf as well as the jabber.conf

It took me awhile to get this working because
a) the email addresses were too similiar (i.e.) [email protected] and then [email protected]
b) I was entering the code wrong in the extensions_custom.conf

Asterisk 1.8.2
FreePBX 1.8.1.0

-extenstions_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,Set(DIAL_OPTIONS=${DIAL_OPTIONS}aD(:1))
exten => _[0-9a-z].,n,Goto(from-trunk,gv-incoming-${CUT(EXTEN,@,1)},1)
exten => h,1,Macro(hangupcall,)

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

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

-jabber.conf

[user1]
type=client ; Client or Component connection
serverhost=talk.google.com ; Route to server for example, talk.google.com
;pubsub_node=pubsub.astjab.org ; Node to use for publishing events via PubSub
[email protected]/Talk ; Username with optional resource.
secret=GVpassword ; Password
;priority=1 ; Resource priority
port=5222 ; Port to use defaults to 5222
usetls=yes ; Use tls or not
usesasl=yes ; Use sasl or not
;[email protected]

[user2]
type=client ; Client or Component connection
serverhost=talk.google.com ; Route to server for example, talk.google.com
;pubsub_node=pubsub.astjab.org ; Node to use for publishing events via PubSub
[email protected]/Talk ; Username with optional resource.
secret=GVpassword ; Password
;priority=1 ; Resource priority
port=5222 ; Port to use defaults to 5222
usetls=yes ; Use tls or not
usesasl=yes ; Use sasl or not
;[email protected]

Thank You,
Barry