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"]?usther)
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"]?usther)
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.
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"]?usther)
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"]?usther)
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: