New Multi-Tenant PIAF Purple w/ ALL latest Gtalk fixes! 12/10/2010

rentpbx

Guru
Joined
Nov 2, 2010
Messages
109
Reaction score
16
Go to this link for the current methodology using PIAF-Purple, Incredible PBX, and Asterisk 1.8.1.1.

Introduction

PIAF incredible 1.8 comes with script which will configure one google voice account as a trunk. It is a huge and cool features. Kudos to PIAF team for bringing this new feature to us. Some of us, see the opportunity to expand the idea of connecting PIAF incredible 1.8 into multiple google voice account. It is driven by some of us who would like to share their PBX resources with multiple department or family usage by spliting the PBX into multiple tenant model.

This work is made possible by foundation that PIAF laid in their PIAF 1.7.5.5 purple edition. As prerequisite, you will need a PIAF 1.7.5.5 purple edition configured as in http://nerdvittles.com/?p=705. We will make some changes on the premade script. We will also take advatage the custom context module that come pre installed in their PIAF 1.7.5.5 purple edition.

We will split the work into two part. Part one, we will be modify context and configuration file to get multiple GVoice account connected. We will be taking care of the incomming route. In the second part, we will be configuring custom context to handle out going call.

Here we go......

Part 1.

1. add additional google account to your jabber.conf (please refer to http://nerdvittles.com/?p=705) to configure your google account. Login to your freepbx. Then, go to the tool tab and click on config edit. Look for jabber.conf and let start modifying it. Here is what I have in my configuration (modify the username and password according to your gvoice credential)

[asterisk]
type=client ;connection
serverhost=talk.google.com ;route to server
[email protected]/Talk ;change to your username
secret=pass1 ;change to your password
port=5222 ;
usetls=yes ;
usesasl=yes ;
status=Available ;
statusmessage="Incredible PBX" ;
timeout=100 ;


[asterisk2]
type=client ;connection
serverhost=talk.google.com ;route to server
[email protected]/Talk ;change to your username
secret=pass2 ;change to your password
port=5222 ;
usetls=yes ;
usesasl=yes ;
status=Available ;
statusmessage="Incredible PBX" ;
timeout=100 ;

save this file by clicking update.


2. go back to config edit. now lets edit the extensions_custom.conf. Look for the [googlein] context and modify it as follow. BTW, you acn enhance/ optimize the dialplan better. I am giving you quick and dirty implementation

[googlein]
exten => _.,1,GotoIf($["${EXTEN}" = "[email protected]"]?googlein1,s,1:googlein2,s,1])

[googlein1]
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,Answer
exten => s,n,Wait(2)
exten => s,n,SendDTMF(1)
exten => s,n,Goto(from-trunk,gv-incoming,1)

[googlein2]
exten => s,1,Wait(1)
exten => s,n,Set([email protected])
;exten => _X.,n,Set(STATUS=${JABBER_STATUS(asterisk2,${ALERTNAME})});
;exten => _X.,n,NoOp(Gvoice/Jabber Status: ${STATUS})
exten => s,n,JABBERSend(asterisk2,${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,Answer
exten => s,n,Wait(2)
exten => s,n,SendDTMF(1)
exten => s,n,Goto(from-trunk,gv-incoming2,1)


replace [email protected] and [email protected]. If you do not care about notifcation, you can refactor this code into much better dialplan context.


while we are at this file, we are going to modify the outgoing gvoice context too.

[gvoice] // notice this one is created by incredible script leave it alone for now.
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:eek:ther)
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)

[gvoice2] //this is just quick and dirty copy of the above. Again, If you do not care about notifcation, you can refactor this code into much better dialplan.
exten => _X.,1,Wait(1)
exten => _X.,n,Set([email protected])
;exten => _X.,n,Set(STATUS=${JABBER_STATUS(asterisk2,${ALERTNAME})});
;exten => _X.,n,NoOp(Gvoice/Jabber Status: ${STATUS})
exten => _X.,n,JABBERSend(asterisk2,${ALERTNAME},Placing GVoice Call: ${EXTEN})
exten => _X.,n,GotoIf($["${LEN(${EXTEN})}"="10"]?us:eek:ther)
exten => _X.,n(us),Dial(Gtalk/asterisk2/+1${EXTEN}@voice.google.com)
exten => _X.,n,Goto(done)
exten => _X.,n(other),Dial(Gtalk/asterisk2/+${EXTEN}@voice.google.com)
exten => _X.,n(done),NoOp(GVoice Call to ${EXTEN} failed)


Save your modification. That is it. We are close to get multiple incoming gvoice.


3. Next you will be modifying (more likely playing around) with inbound route. Lets go there, first modify the gv-incoming/ any cid. set the destination to extension 701. This is just for the demo. you can set the destination to ivr, ring group. etc etc.

4. Create a new inbound route.


Description: gvoice2
DID Number: gv-incoming2

set the destination to extension 702. This is just for the demo. you can set the destination to ivr, ring group. etc etc.


That is all. You have multiple gvoice inbound call now.



Part 2.

In this part we are going to play around with custom context. We are done with modifying script.

1. lets go to freepbx. create a new trunk call it gvoice2. Make a copy from the existing gvoice which is a custom trunk.

On Custom Dial String put local/$OUTNUM$@gvoice2 (remember we create this on part1).

2. Lets create an outbound route. This time, copy the existing default outbound route. give it Route Name: Default2. copy the other setting from the Default with the exception that the second trunk should be set to gvoice2.

3. now on the third party addon click on Custom Context. Add Context. Name it googlevoice2out. submit it.

4. now select what we want to be included in googlevoice2out. Please start from deny for all.
diligently set everything to Allow except for the following


ENTIRE Basic Internal Dialplan
ALL OUTBOUND ROUTES

You can deny all contexts under Outbound Route except for Default2. You can play around to add other route except you do not want to add route that has trunk in gvoice. It will confuse you.

5. Last step is go to extensions. modify extension 702 and set Custom Context to googlevoice2out.

6. Don't forget to reload. I did amportal restart.

That is all. you can create a group of extension that share the gvoice2 trunk by setting the Custom Context to googlevoice2out. All out going from these extensions will go through gvoice2 trunk. While other extension call out will be through gvoice trunk. It is a poor man multi tenant system. However, it works for me.
 
Last edited by a moderator:

lowno

Guru
Joined
Feb 18, 2009
Messages
125
Reaction score
8
Wow, thanks for all the info. I'll be trying this tomorrow.
 
Joined
Oct 5, 2010
Messages
188
Reaction score
38
Somehow I assumed gtalk would be limited to one account per ip, but I guess since you can make multiple calls per gtalk account then secondary account logins should work okay as well, thanks big brother Google.

In this implementation the outbound calls are being defaulted from set extensions, I suppose you could route them out like prior implementations of gvoice calling in Piaf "GV|, GV2|..."


Nice... I'll play with this this morning.... unless Ward want's to test this and bundle this up into a nice install script in the next few minutes....:drool5:
 

rentpbx

Guru
Joined
Nov 2, 2010
Messages
109
Reaction score
16
Just FYI, after the first step (configuring incoming ....) you need to do amportal restart. It seem gtalk does not how to do reload yet. Otherwise, it would not recognize the additional gv account
 
Joined
Oct 5, 2010
Messages
188
Reaction score
38
[asterisk]
type=client ;connection
serverhost=talk.google.com ;route to server
[email protected]/Talk ;change to your username
secret=pass1 ;change to your password
port=5222 ;
usetls=yes ;
usesasl=yes ;
status=Available ;
statusmessage="Incredible PBX" ;
timeout=100 ;


[asterisk2]
type=client ;connection
serverhost=talk.google.com ;route to server
[email protected]/Talk ;change to your username
secret=pass2 ;change to your password
port=5222 ;
usetls=yes ;
usesasl=yes ;
status=Available ;
statusmessage="Incredible PBX" ;
timeout=100 ;

save this file by clicking update.

keepalive=yes

was added to the end of yes gtalk configuration in jabber.conf to keep the google chat connection from timing out, shouldn't that be in place here as well?
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,198
Reaction score
5,218
Probably for every jabber context that you want to keep alive although we've found keepalive to be very unpredictable. The jabber test cron job works much better. :wink5:
 

rentpbx

Guru
Joined
Nov 2, 2010
Messages
109
Reaction score
16
My server has public ip. I do not have to change any parameter. I have it for couple of days with this configuration. I have not experience any issue yet. I would suggest try the existing configuration. If you have some sort of long term issue, you can play around with other setting.
 

ojthecat

New Member
Joined
Oct 31, 2010
Messages
23
Reaction score
0
Thanks this works great. I can now assign an extension it's own gv number.
 

nlucier

New Member
Joined
Aug 5, 2008
Messages
28
Reaction score
1
I have this on the cusp of working with 3 GV numbers attached to 3 separate extensions.

To get the [googlein] section to work correctly with more than 2 options for the 'GotoIf' according to how I read the documentation I had to do this:

[googlein]
exten => _.,1,GotoIf($["${EXTEN}" = "[email protected]"]?googlein1,s,1)
exten => _.,n,GotoIf($["${EXTEN}" = "[email protected]"]?googlein2,s,1)
exten => _.,n,GotoIf($["${EXTEN}" = "[email protected]"]?googlein3,s,1)

The rest of the rentpbx's instructions were followed adding a 3rd entry in each section where a 2nd was added. As far as I can tell, this would work for as many GV numbers as you want.

The above works a treat for incoming calls. They all go to the assigned extension without problems once the first call works. It seems that I have to do an amportal restart and then manually fire off the jabber cron job and then wait a few minutes and it magically works. This is only needed once I change a config affecting the GV stuff.

My issue at this point is outbound calls. They go out the correction extension according to the panel and the logs, but the CID being presented to the other end is the same one every time, that of my original [email protected] GV number configured during the Incredible setup. The logs show the calls all using the expected context and route (Default, Default2, Default3) on every test.

Has anyone that is working on this configuration been able to get the individual GV CIDs to show on the receiving end?

My system is currently supporting the home phones of 3 households now and would really like to be able to utilize this setup to further shrink the phone bills, but if I can't get this one feature to work, it's a non-starter due to callbacks based on CID will go to the wrong household 67% of the time.
 

rentpbx

Guru
Joined
Nov 2, 2010
Messages
109
Reaction score
16
I would suggest you log into account2 and account3 in google.com/voice. Check on the history if the call is made from those account. If it does, you have big issue since you have to deal with google. They are different kind of animal.

If not, your configuration is not quite correct.

check the following.

1. do you use custom context? does it set correctly on each extension?
2 You custom context, make sure you follow my exception DENY "ENTIRE Basic Internal Dialplan" and "ALL OUTBOUND ROUTES". open up (MAKE SURE you do not edit) /etc/asterisk/extension_additional.conf look for you custom context. check if from_internal is included. If it is, you still have not set your custom context correctly.

For the record, my CID show up correctly on the receiving phone. That is why we go through all this custom context setting. Otherwise, you can just do the Part1. It will handle only the incoming route. Without doing part2, you will be getting the same behavior as yours now.
 

vcallaway

Guru
Joined
May 6, 2008
Messages
170
Reaction score
2
Starting to see a pattern.

If my internet connection goes down, the first gv account comes back online. Not so with the others. I have to restart asterisk to get them back online.

I use the google chat sidebar plugin to monitor if they go offline.
 

nlucier

New Member
Joined
Aug 5, 2008
Messages
28
Reaction score
1
I would suggest you log into account2 and account3 in google.com/voice. Check on the history if the call is made from those account. If it does, you have big issue since you have to deal with google. They are different kind of animal.

If not, your configuration is not quite correct.

check the following.

1. do you use custom context? does it set correctly on each extension?
2 You custom context, make sure you follow my exception DENY "ENTIRE Basic Internal Dialplan" and "ALL OUTBOUND ROUTES". open up (MAKE SURE you do not edit) /etc/asterisk/extension_additional.conf look for you custom context. check if from_internal is included. If it is, you still have not set your custom context correctly.

For the record, my CID show up correctly on the receiving phone. That is why we go through all this custom context setting. Otherwise, you can just do the Part1. It will handle only the incoming route. Without doing part2, you will be getting the same behavior as yours now.

When you say that your CID is showing up correctly, you get unique CIDs on the remote phone when you are dialing from the configured extensions on the * box? Just making sure that part was explained correctly in my issues.

I checked the extensions_additional.conf file from the CLI (strange that that file isn't in the list in Config Edit), and I did not find "from_internal" in the includes, but did find "from_internal_custom", so I went into the Custom Contexts Add-On again and found the line for that and changed it to Deny. Currently the Deny's in my Custom Contexts for "googlevoice2out"are:
  • Custom Internal Dialplan
  • ENTIRE Basic Internal Dialplan
  • ALL OUTBOUND ROUTES
  • outrt-001-OutSkype
  • outrt-002-OutFreeNUM
  • outrt-003-GoogleVoice
  • outrt-004-TollFree
  • Default3
  • outrt-005-Default

The only entry in Outbound Routes with Allow is Default2.

No change in what happens with CID though, my original GV number is seen on the remote phones regardless of which extension I use to dial out from. Checking the actual GV accounts, the calls are indeed only going out account1.
 

rentpbx

Guru
Joined
Nov 2, 2010
Messages
109
Reaction score
16
When you say that your CID is showing up correctly, you get unique CIDs on the remote phone when you are dialing from the configured extensions on the * box? Just making sure that part was explained correctly in my issues.

I checked the extensions_additional.conf file from the CLI (strange that that file isn't in the list in Config Edit), and I did not find "from_internal" in the includes, but did find "from_internal_custom", so I went into the Custom Contexts Add-On again and found the line for that and changed it to Deny. Currently the Deny's in my Custom Contexts for "googlevoice2out"are:
  • Custom Internal Dialplan
  • ENTIRE Basic Internal Dialplan
  • ALL OUTBOUND ROUTES
  • outrt-001-OutSkype
  • outrt-002-OutFreeNUM
  • outrt-003-GoogleVoice
  • outrt-004-TollFree
  • Default3
  • outrt-005-Default
The only entry in Outbound Routes with Allow is Default2.

No change in what happens with CID though, my original GV number is seen on the remote phones regardless of which extension I use to dial out from. Checking the actual GV accounts, the calls are indeed only going out account1.

Yes, I confirm it is a unique ID.

One more trick I'll pass on here. Go to asterisk cli. and try to type dialplan show 14255222222@googlevoice2out

Make sure there is only one

[ Included context 'outrt-8' created by 'pbx_config' ]
'_1NXXNXXXXXX' => 1. Macro(user-callerid,SKIPTTL,) [pbx_config]
2. Noop(Calling Out Route: Default2) [pbx_config]
3. Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})}) [pbx_config]
4. Set(_NODEST=) [pbx_config]
5. Macro(record-enable,${AMPUSER},OUT,) [pbx_config]
6. Macro(dialout-enum,6,${EXTEN},) [pbx_config]
7. Macro(dialout-trunk,2,${EXTEN},) [pbx_config]
8. Macro(outisbusy,) [pbx_config]

If you have another one, you need to resolve it with the priority on the custom context.


Once that is done. You need to check.
1. Go to your out bound route (Default2). check if the trunk used is gvoice2 not gvoice
2. Then go to your extensions page. In this page, there is a custom context field. Set that to googlevoice2out

You should be golden.
 

nlucier

New Member
Joined
Aug 5, 2008
Messages
28
Reaction score
1
OK. Call back the search party. Just got a second set of eyes on my config and found a typo in the [gvoice2] & [gvoice3] sections where they were both pointing at [asterisk] and not [asterisk2] & [asterisk3]. I blame staying up way too late playing with my new toy :lol:

This works splendidly now with full CID differentiation.

Only problem I have now is I get to flatten the current switch and install Purple.


THANKS GUYS FOR THIS AWESOME APPLICATION!!!
 

warraich

Member
Joined
May 11, 2009
Messages
54
Reaction score
0
Introduction

PIAF incredible 1.8 comes with script which will configure one google voice account as a trunk. It is a huge and cool features. Kudos to PIAF team for bringing this new feature to us. Some of us, see the opportunity to expand the idea of connecting PIAF incredible 1.8 into multiple google voice account. It is driven by some of us who would like to share their PBX resources with multiple department or family usage by spliting the PBX into multiple tenant model.

That is all. you can create a group of extension that share the gvoice2 trunk by setting the Custom Context to googlevoice2out. All out going from these extensions will go through gvoice2 trunk. While other extension call out will be through gvoice trunk. It is a poor man multi tenant system. However, it works for me.

EXELENT WORK "rentpbx" Thank you and WARD for the great work you have done! :wink5:
 

mainenotarynet

Not really a Guru - Just a long time user
Joined
May 29, 2010
Messages
754
Reaction score
155
Yes - Great work RentPBX and Mr. Ward. But I have a bit of a funky one. I can call out on all 4 of my separate GV accounts - Yeah :D but... :confused: I can not get calls in on any but the original one set up with Incredible That has in and out but the second one gives me 'Google subscriber unavailable' message as does the third. The fourth, however gives me a Fast Busy (congestion tone?).

Anyone have this happen? If so... anything I can Try?

Thanks
 

JRoque

Member
Joined
Jun 2, 2008
Messages
40
Reaction score
1
Sssweeeeeet!! Got 3 in/out trunks going on a VirtualBox machine. I skipped the custom context stuff since I don't need it in my setup but everything was spot on. Nlucier's post also helped getting the 3 working.

JR
 

mainenotarynet

Not really a Guru - Just a long time user
Joined
May 29, 2010
Messages
754
Reaction score
155
-bump- Mr. Ward - RentPBX -- any ideas on what to try re:#17?

All 4 show connected to PBX through the cli

I have the jabber cron thing going but where do I add my four accounts to 'keepalive'?

Thanks again
 
Joined
Oct 5, 2010
Messages
188
Reaction score
38
-bump- Mr. Ward - RentPBX -- any ideas on what to try re:#17?

All 4 show connected to PBX through the cli

I have the jabber cron thing going but where do I add my four accounts to 'keepalive'?

Thanks again


Check post 10 and 15 in this thread, make sure you have your syntax correct [gvoice2] & [gvoice3] sections where they were both pointing at [asterisk] and not [asterisk2] & [asterisk3]
 

Members online

Forum statistics

Threads
25,804
Messages
167,724
Members
19,232
Latest member
voiplads
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top