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

mainenotarynet

Not really a Guru - Just a long time user
Joined
May 29, 2010
Messages
754
Reaction score
155
Not the issue here as I had pointed that out in another post to someone else.

Here is all the Google Voice code I have save the original stuff from the old way:

Code:
[googlein]
exten => _.,1,GotoIf($["${EXTEN}" = "[email protected]"]?googlein1,s,1) ;MNN
exten => _.,n,GotoIf($["${EXTEN}" = "[email protected]"]?googlein2,s,1) ;KCC
exten => _.,n,GotoIf($["${EXTEN}" = "[email protected]"]?googlein3,s,1) ;SCAME
exten => _.,n,GotoIf($["${EXTEN}" = "[email protected]"]?googlein4,s,1) ;MTG

[googlein1] ; Used for My Business 207-aaa-bbbb
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] ; Used for My Neighbors Business 207-ccc-dddd
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)

[googlein3] ;Used for A Non-profit group I am in 207-eee-fffg
exten => s,1,Wait(1)
exten => s,n,Set([email protected])
;exten => _X.,n,Set(STATUS=${JABBER_STATUS(asterisk3,${ALERTNAME})});
;exten => _X.,n,NoOp(Gvoice/Jabber Status: ${STATUS})
exten => s,n,JABBERSend(asterisk3,${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-incoming3,1)

[googlein4] ; Used for Another non-profit group  207-eee-ffff
exten => s,1,Wait(1)
exten => s,n,Set([email protected])
;exten => _X.,n,Set(STATUS=${JABBER_STATUS(asterisk4,${ALERTNAME})});
;exten => _X.,n,NoOp(Gvoice/Jabber Status: ${STATUS})
exten => s,n,JABBERSend(asterisk4,${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-incoming4,1) 

[gvoice];Used for Googlein1 207-aaa-bbbb
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)

[gvoice2] ;Used for Googlein2 207-ccc-dddd
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:other)
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)

[gvoice3] ;Used for GoogleIn3 207-eee-fffg
exten => _X.,1,Wait(1)
exten => _X.,n,Set([email protected])
;exten => _X.,n,Set(STATUS=${JABBER_STATUS(asterisk3,${ALERTNAME})});
;exten => _X.,n,NoOp(Gvoice/Jabber Status: ${STATUS})
exten => _X.,n,JABBERSend(asterisk3,${ALERTNAME},Placing GVoice Call: ${EXTEN})
exten => _X.,n,GotoIf($["${LEN(${EXTEN})}"="10"]?us:other)
exten => _X.,n(us),Dial(Gtalk/asterisk3/+1${EXTEN}@voice.google.com)
exten => _X.,n,Goto(done)
exten => _X.,n(other),Dial(Gtalk/asterisk3/+${EXTEN}@voice.google.com)
exten => _X.,n(done),NoOp(GVoice Call to ${EXTEN} failed)

[gvoice4] ;Used for GoogleIn4 207-eee-ffff
exten => _X.,1,Wait(1)
exten => _X.,n,Set([email protected])
;exten => _X.,n,Set(STATUS=${JABBER_STATUS(asterisk4,${ALERTNAME})});
;exten => _X.,n,NoOp(Gvoice/Jabber Status: ${STATUS})
exten => _X.,n,JABBERSend(asterisk4,${ALERTNAME},Placing GVoice Call: ${EXTEN})
exten => _X.,n,GotoIf($["${LEN(${EXTEN})}"="10"]?us:other)
exten => _X.,n(us),Dial(Gtalk/asterisk4/+1${EXTEN}@voice.google.com)
exten => _X.,n,Goto(done)
exten => _X.,n(other),Dial(Gtalk/asterisk4/+${EXTEN}@voice.google.com)
exten => _X.,n(done),NoOp(GVoice Call to ${EXTEN} failed)

I was very diligent (I think) in making sure all of the asterisks had a number on the end.

The other thing That makes no sense is these:
Code:
exten => s,n,Set(CALLERID(number)=${CALLERID(name):2:10})
exten => s,n,Set(CALLERID(name)=${CALLERID(number)})

The way I read this is Asterisk is setting its caller ID Name to the incoming number and the asterisk caller ID Number to the incoming caller ID name -- why would you do this?

I did not put the Jabber.conf here as that has the passwords

Any insight would be helpful
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,201
Reaction score
5,220
The other thing That makes no sense is these:
exten => s,n,Set(CALLERID(number)=${CALLERID(name):2:10})
exten => s,n,Set(CALLERID(name)=${CALLERID(number)})

The way I read this is Asterisk is setting its caller ID Name to the incoming number and the asterisk caller ID Number to the incoming caller ID name -- why would you do this?

There's a great way to get insight without wasting everyone's time (in this case, mine). Take the code out and see what happens. Then you'll know why it's in there. :rolleyes:
 

rentpbx

Guru
Joined
Nov 2, 2010
Messages
109
Reaction score
16
Watch the CLI

Hi Kevin,

I would open up the asterisk CLI. I would watch it as you make a call. Lets see if anything come out at all. Now, CLI can be too fast to read. You just need to confirm that there are any activity. Once you confirm, I would go into /var/log/asterisk/full. Look for the simmilar message as the CLI. It should be close to end of the file. Try to read and find if anything is wrong there.
 

MisterQ

Member
Joined
Dec 11, 2007
Messages
188
Reaction score
5
Damn, went through everything meticulously, and am now getting "Congestions" on every call. (Even to 1-800 numbers, which to my way of thiking, should be parsed out before anything else.

Time to unravel and start again.
 

mainenotarynet

Not really a Guru - Just a long time user
Joined
May 29, 2010
Messages
754
Reaction score
155
I'm sorry for asking if you think a noob question is a waste of time -- that part wasn't the main focus of the post anyways -- I don't just erase or comment out code to see what happens -- I have had to rebuild my server (or have done for me {RentPBX}) seven times for thing that were changed without knowing what I was doing. I just meant why is it changing an incoming number to a name and an incoming name to a number. It may be significant but I just thought it may have been a mistake as name to name and number to number would make sense. Sorry for the inconvenience. I will keep stupid questions to myself.

@RentPBX - My outgoing works fine I can make calls on all 4 numbers, it's the inbound calls so if I can dial Google, and the only checked option is chat, what is the CLI going to tell me if the number is put Idle unless kept alive or the Jabber test cron keeps it that way. I cant't find the file to modify to put all my accounts in the test or does the Jabber test look in Jabber.conf for any and all names.

I don't NEED to use the Google but it would be nice if it did work -- only my original that came with Purple works correctly in and out.

Ok I'll stop wating everyones time now.
 

dswartz

Guru
Joined
Feb 17, 2009
Messages
1,056
Reaction score
0
well, it probably didn't help that you made a pronouncement that anyone with non-zero programming experience knew was wrong. It is not swapping the two fields like you said. It assigns part of one to the other, and then assigns the just-changed field back to the other, so both name and number end up being 10 digit strings skipping the first character (going from memory here.)
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,201
Reaction score
5,220
Kevin,
Sorry for being abrupt. It's just a little frustrating when someone writes in about something that works. And, yes, you have other issues that don't work, but this wasn't one of them. So it came across as nit-picking. Keep in mind that these are not normal phone calls. They are being carried over a very different protocol, and the CallerID is a mess to sort out. By converting it to something our systems are used to, the entries in the CDR and your CNAM lookups with CallerID Superfecta turn out the way they're supposed to. That's the only objective in the CallerID manipulation.
 

rentpbx

Guru
Joined
Nov 2, 2010
Messages
109
Reaction score
16
Hi Kevin,

Try to call the gv number fro m your land line or cell phone. And watch your asterisk CLI. If there is nothing show up in the CLI, it meant that there is issue in GV setting. I really doubt it. I think you nail that part. If there is activity in the CLI, try to read what is going on the log. I think that is the key for you.

Is your extension that you directed the incoming call from gv registered correctly? If those extension is not online, I am not surprised that you get those error.
 

mainenotarynet

Not really a Guru - Just a long time user
Joined
May 29, 2010
Messages
754
Reaction score
155
[My problem solved]

After talking to RentPBX re: my other PiaF issues we figure out the reason for the issues of the incoming calls not making the PBX.

Simple -- If you connect (for the demo at least) to an extension make sure the extension is ONLINE or at least has Voicemail enabled. Once I connected each to a different IVR (to make sure the calls were making the PBX) all the calls went through.
 

Lost Trunk

Guru
Joined
Aug 5, 2008
Messages
228
Reaction score
0
Turns out that the [googlein] context can handle multiple accounts just fine if it's rewritten slightly - you don't need multiple contexts to handle incoming calls for multiple users:

Code:
[googlein]
exten => _[@Xa-z].,1,Noop(Incoming Google Voice call for ${EXTEN})
;exten => _[@Xa-z].,n,Set(STATUS=${JABBER_STATUS(asterisk,${EXTEN})});
;exten => _[@Xa-z].,n,NoOp(Gvoice/Jabber Status: ${STATUS})
exten => _[@Xa-z].,n,JABBERSend(asterisk,${EXTEN},Incoming Google Voice Call: ${CALLERID(name):2:10})
exten => _[@Xa-z].,n,Set(CALLERID(number)=${CALLERID(name):2:10})
exten => _[@Xa-z].,n,Set(CALLERID(name)=${CALLERID(number)})
exten => _[@Xa-z].,n,Answer
exten => _[@Xa-z].,n,Wait(1)
exten => _[@Xa-z].,n,SendDTMF(1)
exten => _[@Xa-z].,n,Goto(from-trunk,gv-incoming-${CUT(EXTEN,@,1)},1)
The above assumes that all your google accounts contain only lowercase letters, numbers, and the @ sign (also the . character, but for reasons unknown to me the pattern I've used matches on the entire address even though I don't specifically include the dot character). In your inbound routes, just use gv-incoming-username instead of gv-incoming, where username is the part of the gmail address before the @ sign.

If for some reason you'd prefer to deal with only a subset of the username, for example the first four characters, then instead of using ${CUT(EXTEN,@,1)} in the last line you could use ${EXTEN,0,4}, assuming that all your usernames are unique in the first four characters.

I'm not saying this can't be further tweaked but at least now you don't have to create multiple contexts for the incoming calls, and as a bonus, in the CLI you'll see exactly which Gtalk address the incoming call is for.

Oh, and I also cut the wait after answer to one second - why make callers wait an extra second if they don't need to, and in my very limited testing, one second was sufficient. If it causes you problems, change it back to two seconds.
 

Lost Trunk

Guru
Joined
Aug 5, 2008
Messages
228
Reaction score
0
N.B. As of the end of November/start of December it has been reported that this does not work anymore, because Google no longer seems to accept outgoing calls on the Asterisk channel driver. Until this is fixed, see the ALTERNATE METHOD below.

And now to tackle the outbound call handling - you still have to create a separate custom trunk for each user, but if you make the Custom Dial Strings something like this:

local/$OUTNUM$@gvoice-user1
local/$OUTNUM$@gvoice-user2
local/$OUTNUM$@gvoice-user3

Then in extensions_custom.conf you can do this:

Code:
[gvoice-[B][I]user1[/I][/B]]
exten => _X.,1,Goto(gvoice,${EXTEN},[B][I]user1[/I][/B])

[gvoice-[B][I]user2[/I][/B]]
exten => _X.,1,Goto(gvoice,${EXTEN},[B][I]user2[/I][/B])

[gvoice-[B][I]user3[/I][/B]]
exten => _X.,1,Goto(gvoice,${EXTEN},[B][I]user3[/I][/B])

[gvoice]
exten => _X.,1,Noop(If this line is run, something is very wrong)
exten => _X.,n([B][I]user1[/I][/B]),Set(ALERTNAME=[B][I]user1[/I][/B]@gmail.com)
exten => _X.,n,Goto(user)
exten => _X.,n([B][I]user2[/I][/B]),Set(ALERTNAME=[B][I]user2[/I][/B]@gmail.com)
exten => _X.,n,Goto(user)
exten => _X.,n([B][I]user3[/I][/B]),Set(ALERTNAME=[B][I]user3[/I][/B]@gmail.com)
exten => _X.,n,Goto(user)
exten => _X.,n(alert),Set(STATUS=${JABBER_STATUS(asterisk,${ALERTNAME})});
exten => _X.,n,NoOp(Gvoice/Jabber Status: ${STATUS})
exten => _X.,n(user),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)
I keep thinking there's probably an even better way, but it's just not coming to me tonight.

ALTERNATE METHOD (to be used if/when Google won't accept outgoing calls via the Gtalk Channel driver, but still delivers incoming calls):

[gvoice-useraccountname]
exten => _X.,1,System(gvoice -e useraccountname@gmail.com -p password call ${EXTEN} useraccountname@gmail.com 9 &)
exten => _X.,n,Set(DB(gv_dialout_useraccountname/channel)=${CHANNEL})
exten => _X.,n,Wait(30)
exten => _X.,n,Noop(Never received callback from Google Voice on channel ${DB_DELETE(gv_dialout_useraccountname/channel)} – exiting)
exten => h,1,GotoIf($["${CHANNEL(state)}" = "Ring"]?:bridged)
exten => h,n,Noop(Hangup on channel ${DB_DELETE(gv_dialout_useraccountname/channel)})
exten => h,n,System(gvoice -e useraccountname@gmail.com -p password cancel &)
exten => h,n,Hangup()
exten => h,n(bridged),Noop(The channel has been bridged successfully)

[gvoice-return-useraccountname]
exten => s,1,NoCDR()
exten => s,n,Bridge(${DB_DELETE(gv_dialout_useraccountname/channel)})

Notes on the ALTERNATE METHOD:

1. Replace useraccountname with the part of your email address associated with your Gtalk account that is before the @gmail.com.
2. Your custom trunk must point to local/$OUTNUM$@gvoice-useraccountname instead of local/$OUTNUM$@gvoice-userx, although you are certainly free to change that if you understand what's happening here (I just find using the account name a convenient way to keep the trunks straight).
3. In the tools menu of FreePBX you must create a Custom Destination that points to gvoice-return-useraccountname,s,1 (you can name it whatever you like)
4. In your Inbound Routes you must create a duplicate Inbound Route for your Gtalk channel, using the same DID "Number" as the original, but the Caller ID number must be set to your ten-digit Google Voice number (the one associated with the account). And, you must make the destination the Custom Destination created in the above step.
5. Repeat the above for each additional Google Voice user.

The basic concept for the above was found on this blog page, but I modified it to use the Gtalk channel to bring in the incoming return calls.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,201
Reaction score
5,220
Failed Outbound Calls Fix

For those having problems with outbound GV calls failing, here's a fix that worked for us...

It appears Google is monitoring permanent connections to their servers and doing something to disable outbound calling for those accounts.

The way that we were maintaining a permanent connection was using a script in /etc/crontab. The simple solution is to disable this script for overnight hours when you're not making outbound calls anyway. Then your account will miraculously start working again.

Here's the revised entry we're using in /etc/crontab which registers with Gtalk every 9 minutes from 7 a.m. to 9 p.m. daily. Now our calls work again.

*/9 07-21 * * * root /root/jab > /dev/null
 

titodj

Member
Joined
Oct 22, 2007
Messages
120
Reaction score
7
After changing

*/9 * * * * root /root/jab > /dev/null
to
*/9 07-21 * * * root /root/jab > /dev/null

Do I have to reboot??
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,201
Reaction score
5,220
Shouldn't need to do anything but wait 'til morning. For good measure, you might want to: service crond restart
 

johnnypuffs

New Member
Joined
Nov 2, 2010
Messages
50
Reaction score
0
Shouldn't need to do anything but wait 'til morning. For good measure, you might want to: service crond restart

Changed the cron entry at 1AM. Restarted Cron, even rebooted the server. This morning still can not call out at all..

Hmmm.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,201
Reaction score
5,220
You might want to start following this Help thread on the same topic.
 
Last edited by a moderator:

Doktur

Guru
Joined
Nov 20, 2010
Messages
15
Reaction score
1
Ip address changed - no luck

I changed my IP to a completely different block, still no luck getting out.
 

Members online

No members online now.

Forum statistics

Threads
25,810
Messages
167,755
Members
19,240
Latest member
nikko
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