This is a very outdated article and has been removed. Please read this article instead for suggestions on implementing Google Voice in Asterisk.
How to use Google Voice for free outgoing calls on an Asterisk/FreePBX system (the easy way)
98 Comments
Comments are closed.
tix said
Incoming calls work with my Gizmo5 account but not external. I get “all circuits are busy”. I don’t see an outbound route in your instructions, could that be the cause?
Otherwise, excellent instructions you have.
michigantelephone said
tix, I guess I had just assumed (perhaps erroneously) that any experienced FreePBX user would know that you have to have an outbound route (and I did say, after giving the instructions for trunk creation, “Later on you can use this as a trunk selection for any USA/Canada Outbound Route”). And did you miss this paragraph?
I didn’t really go into how to create an outbound route because there is other documentation out there that explains that, and once you understand how FreePBX works there are many variations on outbound routing. The only thing you need to keep in mind is that if you don’t have an outbound route for your USA and Canada calls, your calls aren’t going anywhere regardless of who you’re using for your outgoing service (Google Voice or someone else). And, if you DO have an outbound route and want to use Google Voice then it needs to be one of your trunk selections for that route (the top one in the list if you want that route to “prefer” Google Voice over any other providers you may be using).
If you need help in outbound route creation, I suggest reading “Elastix Without Tears” or “PiaF Without Tears” (even if you are not using Elastix or PBX in a Flash per se – the method of outbound route creation is pretty much the same for any FreePBX-based distribution). Both books are free PDF downloads that you can find using Google (or your favorite search engine).
michigantelephone said
To anyone who followed the instructions in this article on the first or second day it was posted, please modify your [custom-gv-trunk-username] context to make use it ends with a Noop statement (and you may want to change the timeout in the line that sends the call to the Parking Lot) as now shown in the article. I discovered that if you don’t end the context with a Noop (not a Hangup!) the call will not fall through to any additional trunks if Google Voice fails to call back. You could use some other statement besides a Noop, as long as it’s not anything that ends the call – the point is there has has to be at least one more line AFTER the line that sends the call to the parking lot! Also, the ParkAndAnnounce statement wouldn’t work for Asterisk 1.6 users because I used bar characters as argument separators, and those are no longer allowed in 1.6 (don’t ask why, it’s one of those little Asterisk annoyances). You have to use commas only as of Asterisk 1.6.
Ben said
Can any one confirm if GV is currently working fine? My GV (even place call on the website) can’t make outgoing call since yesterday. Incoming call is fine.
Thanks
michigantelephone said
Ben, I think they had some issue yesterday where some outgoing calls failed, but whatever happened appears to have been fixed overnight (at least in my limited testing). That failure was what made me notice that the context wasn’t exiting gracefully and allowing the route to use the next trunk on the list, because I didn’t have any lines in the context following the transfer of the outgoing call to the Parking Lot (see my previous post just above yours), so it inadvertently served a useful purpose. Anyway, whatever the problem was, I hope it’s fixed for you today as well.
Ben said
Yeah, it’s back to normal now. thanks
Ward Mundy said
Nice article. As you mention, Google Voice integration has evolved thanks to contributions from many Asterisk enthusiasts. We appreciate, as I’m sure you do, the work of all of them. Your goal and ours differ only in degree. We’ve tried to simplify some of this for folks just getting started. What we don’t do is copy other people’s work without attribution. The design for multiple GV trunks has been around for many months. In fact, we’ve shared it with a number of users before our article ever was published. To the extent your article digests all of the developments of the past year, it will be enormously helpful to techies just starting out. Thanks for a great writeup.
michigantelephone said
Hi, Ward! I definitely appreciate the work that you, and the many folks who have left comments on your site, have put into this. And I do understand that we may have slightly different audiences – I have on several occasions recommend your PBX in a Flash to someone who is just starting out and knows nothing, or next to nothing, about Asterisk and FreePBX. I also don’t doubt that you’ve been working on this for months, and that it was coincidence that we came out with similar methods (I am not being facetious here – there are only so many ways to do the same thing, and I think we both took the only logical approach to implementing multiple GV accounts).
One thing I would suggest is that on your page at http://incrediblepbx.com/template2, add a line (even if only a Noop) after the last line of the [custom-gv2] context, and then reduce the timeout in the preceding ParkAndAnnounce statement a bit (20 seconds ought to be more than enough). That way, if Google Voice fails to call back, and there are any additional trunk selections in the Outbound Route, the call can fall through to the next trunk on the list. If there’s not at least one more statement of some kind, then at the end of the timeout Allison says “Goodbye” and hangs up on the caller (to see the difference, temporarily comment out the System(gvoice…) line, then try a call without and then with the added Noop line). And as I noted above, playing the “pls-wait-connect-call” announcement is unnecessary, though I suppose some users might want it. Don’t worry about giving me credit or anything; I’d rather just see it work right for your users in the (admittedly rare) situation where Google Voice fails to call (or perhaps the service providing the associated DID is down).
I will also add that had it not been for the original Nerd Vittles writeup on Asterisk@Home all those months ago, I don’t think we’d ever have been able to get our first system going. So thanks for all the work that you and your folks have put into this stuff, and all the great writeups you’ve done!
Ibra said
Was anyone able to make an outgoing call using similar setup describe above? I can receive incoming calls that GV forwards to my DID (SipGate), I however cannot make any calls using my softphone, I can see that the call with my GV CID gets parked and that the call to my sip DID is never made by google voice. I verified this on my outgoing call logs on GV and my incoming call logs on SipGate. When I use linux terminal and place a call using “gvoice -e username@gmail.com -p userpassword call numbertocall gvregphonenum code” to call my wife’s cell, the call goes through and her phone rings. My question is what could be causing GV not to make that call to my DID (Sipgate) Any help to point me in right direction would be appreciated.
Thanks
Tiggerpaws said
Great article!
Thank you so much for this excellent and
helpful article.
The trixbox forums especially that skyking butthole
over there are just so unhelpful and all they do
is insult you for being anewbie.
Your article made perfect sense to me and
with a bit of experimenting and tweaking
I now understand how to make my trixbox
work with google voice, thank you very
much for making it easy.
Tiggerpaws said
Thank you for the update, the bridged method
seems to be working very well in my Asterisk 1.6
I had to jump start it this morning hehehe but
3rd time was a charm and I got the ring back
perfectly and the person on the other end
did not get any dead air calls.
Thank you once again this is working
very well.
Patx said
Hello, I am pretty new to asterisk/freepbx systems but i am pretty use to manage linux servers, proxies and other linux stuff… I have installed asteriskonubuntu 10.04 and follwed some guides on the net to setup my incoming route using IPKALL…. works perfectly…
After following this guide my incoming route from googlevoice no longer work, if i call the IPKALL number my asterisk extension ring but going trough google voice i get this output in asterisk:
[Removed because it contained potentially identifiable information]
I guess i messed up the part about the parking lot… any help here would be welcomed
Also when I use linux terminal and place a call using “gvoice -e username@gmail.com -p userpassword call numbertocall gvregphonenum code” to call my home number, nothing happen, no google voice out call… if I ADD a 1 before gvregphonenum the call goes through and the phone rings.
I tried to change this in extension_custom.conf but it did not solve the issue…
Please help me setup this once and for all_
Thank you
Patx_
dreamtv@live.ca
michigantelephone said
Patx_, regarding the last part first, I don’t know why a leading “1″ would be required in some cases but not others, but obviously you should use whichever works. I removed your CLI output from your post because there were some IP addresses in there that might be too tempting a target for hackers, but I did look it over. What’s happening is that the incoming call from Google Voice is trying to go to Parking Lot slot 78, but there is no call parked on 78, so the incoming call is unceremoniously dumped. You didn’t send the entire CLI output from the very start of the call, so I can’t tell if the original call was successfully parked (maybe on a different parking lot slot?) but it would have been more helpful if you had sent the entire CLI output including the initial call setup (be sure to blank out any passwords!), not just the part where Google Voice is calling you back.
It would also have been helpful to see your [custom-gv-trunk-username] context. Does the line
exten => _X.,n,Set(PARKINGEXTEN=78)
exist there? Is your Parking Lot configured so that 78 is a valid parking lot slot? If you’re not sure of any of this, you might want to try doing it exactly the way I outlined in the article, and after you get it working, then you can try changing the Parking Lot extension if need be.
You obviously found my e-mail address so if you want to send me a full CLI output from the start of the original call, a copy of your context in extension-custom.conf, and perhaps a screenshot of your parking lot configuration page, I can look it over and see if I notice anything glaringly wrong. I tend to agree with you that you may have messed up on the parking lot; I just can’t tell you exactly how yet.
A L said
Hi,
I’m a total newbie in this arena and appreciate great articles like what you wrote here, especially the updated comments as you find better ways of doing things or more useful information.
I was wondering if you’re aware of such instructions for setting up Google Voice outbound calls with FreeSWITCH?
I’ve surfed the FreeSWITCH site and may just not realize that some of the examples can actually be applied with Google Voice.
Thank you again for any pointers and help you can give.
Joseph said
Hi,
I just want to set up voip with my Linksys SPA3102 ATA gateway. I try to sign up an account in Google voice but was rejected for I live in Canada. Service only provide for US.
Is there any resource that I can set up free voip in Canada. I got Wasington state phone number from Ipkall.com and basic account from Voxalot.com.
Right now I have two problems:
1. can’t dial out (no Canada free dial out service).
2. US phone number cause money to call me in my local Canada area.
Is there any way to slove such problem? Thanks a lot.
Joseph
A. M. said
Hi,
First of all thank you for sharing all the information required to use Google Voice via Asterisk/FreePBX.
I tested the solution you provided and its been working great for the past few weeks using pygooglevoice, asterisk, freepbx and DIDs from IP Kall so I replicated the same setup on 3 different PBXs.
Today I noticed that my outgoing calls are not going through Google Voice. I checked the logs and found that none of my Google Voice custom trunks are working, so the route fallsback to the next available trunk which my SIP provider.
I thought this was a local problem with my PBX so I checked the other PBXs with Google Voice setup same as above but found that the problem persists there as well.
I tried adjusting the setup to use my Gizmo5 DID instead of IP Kall but still no go.
I tried calling the Google Voice number(s) from my cell phone and inbound seems to be working fine through all the PBXs in question, including all Google Voice and IP Kall dids.
Also I noticed a slight discrepancy when trying pygooglevoice from the command prompt, if I use your sample “gvoice” command with the ampersand at the end I get no feedback until I hit enter twice. If I remove the ampersand I see the normal “Logging out of google voice” message.
My logs aren’t showing the callback from Google so it seems that they might have changed something. Can you please advise if this setup is still working at your end as of today?
Once again thank you for the detailed info and sorry for the lengthy comment as I wanted to fully explain the situation at hand.
michigantelephone said
A L – Sorry, don’t use FreeSWITCH, though it is an interesting project. I don’t see any reason you couldn’t make this work with FreeSWITCH but obviously the procedure would be different, because they don’t use Asterisk-style dial plans.
EDIT: See this post: FreeSWITCH users: Use FreeSWITCH To Make Free Calls With gmail Voice Interface!
michigantelephone said
Joseph – You’ve managed to totally confuse me. Try again if you like (preferably using proper spelling and grammar this time) but use complete sentences, as if you were writing for your high school English teacher. By the way, on a totally unrelated note, here’s a completely random web page you may find interesting: http://www.publicproxyservers.com/index.html
Patx said
[quote]I just want to set up voip with my Linksys SPA3102 ATA gateway. I try to sign up an account in Google voice but was rejected for I live in Canada. Service only provide for US.
Is there any resource that I can set up free voip in Canada.[/quote]
Use HotSpot Shield if your on windoz to register to a new google voice account or the easiest way…buy a magicjack, dump credentials and use it in your setup…. 20$/year free canada/usa calls + canadian numbers available…
[quote]Today I noticed that my outgoing calls are not going through Google Voice. I checked the logs and found that none of my Google Voice custom trunks are working, so the route fallsback to the next available trunk which my SIP provider.[/quote]
I am trying to do this setup for 2 days now, at first i tried ipkall, then bought a gizmo account on ebay… i get the same results as you on both setup… I succed placing a call using bridge method but i had to hang up my extension right after the routine started on CLI… then my extension rang…. got the number called ringing…
If i dont hang up CLI show all lines are busy…
michigantelephone said
A. M. – Still working for me tonight – Google Voice DOES have occasional outages (I actually suspect it’s times when too many people are trying to use it at once) so don’t panic too much unless it doesn’t work over several hours. If it’s still not working for you them I’m sorry but I don’t know what the problem is.
A. M. said
Thank you for your prompt responses. The problem seems to be isolated with those PBXs only as I have this dialer app, based on pygooglevoice as well, that still works fine on a linux portable device, using the same dids from Gizmo5 IP Kall and same Google Voice accounts. I’ll try this once again on a fresh install and let you know.
A. M. said
Hi again,
I spent a few hours last night trying to debug the problem with no luck. Upon waking up today I did some more research and came across a post referring to a “python-eggs” permissions issue and after applying that fix everything is working properly now.
Make sure you apply that same fix everytime you re-install and/or update PyGoogleVoice as it will default back to the original settings and needs the same fix once again to allow the “asterisk” user to run the script instead of “root” only.
Problem:
Asterisk doesn’t seem to connect the call via Google Voice as the call gets
stuck at the parking lot then timeouts and falls back to next trunk in route.
Cause:
PyGoogleVoice appears to be installed by user “root” and hence the temporary “eggs” folder is only accessible when the user “root” is running the PyGoogleVoice script. When the user “asterisk” attempts to run the same script it errors as user “asterisk” does not have enough permissions to access this “eggs” temporary folder owned by root. Causing the script to exit.
Solution: Adjust the PyGoogleVoice python script to use a temporary folder owned and accessible by the “asterisk” user such as “/var/lib/asterisk/.python-eggs” allowing “asterisk” to execute PyGoogleVoice properly without permission problems.
Steps:
1. Edit “gvoice” by typing “nano /usr/bin/gvoice”
2. Copy/Paste the following 2 lines directly after “#!/usr/bin/python”
import os
os.environ['PYTHON_EGG_CACHE'] = ‘/var/lib/asterisk/.python-eggs’
3. Press “Control X” to save and exit nano.
Joseph said
Hi gentlemen,
Thanks for reply. I think I have to make my question simple.
I am new in voip. I have a Linksys SPA3102 ATA gateway/router and I want to set up voip with it. But I don’t want use computer for the daily voip operation (just use ATA and analog phone). Googlevoice does not allow me to sign up for it is only avaliable for US. I thought the Ipkall US phone number and the basic voxalot account will work but does not work.
Can you tell me how to make voip work with the ATA? How to get a Canada phone numbner and free SIP outbound? Or may be some other way to make it work. Thanks so much.
Joseph
michigantelephone said
Are you saying you’re trying to use an SPA-3102 instead of an Asterisk server? If so, that won’t work, at least not without some external assistance (you could check out SipSorcery, but please don’t ask me how to set that up!). Otherwise, I don’t see what the relevance of the SPA-3102 is to the rest of your question. That’s why I’m saying, what you’re asking me seems to make no sense, from my perspective. You’re either leaving out details, or you’re making inappropriate assumptions.
As for not being able to set up a Google Voice account from Canada, the only way Google Voice can tell where you are is by your IP address. If you live near the border, you could make a trip south, go to the nearest public library and hop on one of their computers, and set up your account from there (I wonder if the Haskell Free Library that sits right on the U.S./Canada border in Vermont/Quebec has Internet service, and whether their computers appear to be in the U.S. or Canada by IP address?). But you don’t even need to do that; you can temporarily use a proxy in the U.S. (it will probably be a lot easier if you use the Firefox browser, since it has better support for a SOCKS proxy than any other browser). Or if you have friends or relatives in the U.S., you could call or IM them and see if you can set up screen sharing with their computer long enough to complete your registration. There are so many ways around this restriction that it’s sort of ridiculous that it even exists. Disclaimer: I am not advocating that you attempt to bypass Google’s geographic restrictions; just saying it’s an easy thing to do if you really want to. See this article, On The Internet, Nobody Knows You’re Not In The USA, or use Google for more help (and don’t spend money on a SOCKS proxy list, there are several free ones out there – see my previous reply to you)!
As for getting a number in Canada, if Google Voice won’t let you do that (and I assume they won’t if they don’t allow registrations from Canada), then you’d have to find a provider of Canadian DID’s (but again, you’d need an Asterisk server), or purchase VoIP service from a Canadian VoIP provider.
My suggestion to you, if you really want to get your feet wet in this stuff, is this: Dig your most recent retired computer out of the closet (hopefully it’s not too old), or buy a new “green” computer (like an Acer Aspire Revo) and install PBX in a Flash or the so-called “Incredible PBX” on it – I believe those come with support for Google Voice built in. And you can use your SPA-3102 with it, both to bring a PSTN line into your server, and to attach a phone to the system so you can make calls.
Joseph said
Dear gentlemen,
Thanks for the reply. I have check the voip outbound provider in Canada, quite expensive to me for I use long distance call a lot. I think I have change plan—use computer for daily operation voip. All I want is set up voip for free local and free long distance call (except rent or buy Canada phone number or may be some thing else). Would you please let me know what I need to fulfill such purpose (is that possible?). To my understanding, here is what I need:
1. Canada phone number (buy or rental, any suggestion?).
2. sip address.
3. software” PBX in a Flash” or “Incredible PBX” (any other suggestion?).
4. a computer (daily operation).
5. a ATA gateway device.
What else I need? Do I need any service to link the phone number and sip address? What step to set up (not in detail)?
Thanks for your help in this matter.
Joseph
Karl said
I followed this instruction and setup google voice in FreePBX. I can hear music on hold. After music seems like it’s disconnected. In my log file I see this:
Unable to request channel Console/dsp
can anyone tell me what is the problem?
Thanks,
michigantelephone said
Karl, I don’t know why you are having this issue but I can say you are not the only one. See this thread:
http://pbxinaflash.com/forum/showthread.php?t=6355
Try temporarily substituting an extension for Console/dsp (example, if you have a SIP extension 1234, then temporarily try SIP/1234 in place of Console/dsp). Another thing you can try is just using Park() (that’s Park followed by an open parenthesis and close parenthesis, with nothing inside) in place of the entire ParkAndAnnounce thing, however you’ll then hear Allison reading back the parking lot slot number, which is what using the ParkAndAnnounce attempts to avoid, and also there’s no timeout so if Google Voice never calls back the call will never fall through to another trunk (at least not until the general Parking Lot time limit expires). Unfortunately, that’s about all I can suggest, because I honestly have no idea why an unlucky few have this issue.
Karl said
Hi michigantelephone,
Thank you so much for your response. If I tell you more about my system you may have more ideas.
I got a DID:971xxxx from Call Centric. My Call Centric number is:1777xxxx. In my Inbound Route I need to put my Call Centric number:1777xxxx to be able receive a call for my DID. I configured Google Voice to forward calls to my DID: 971xxxx. That works. So I use 1777xxxx in my inbound route but use 971xxxx in
exten => _X.,1,System(gvoice -e username@gmail.com -p userpassword call ${EXTEN} 1971xxxx code &)
When I try the first time I hear music. After music I hear nothing. If I try again I don’t event hear music. If I reboot my system I’ll hear music again.
In my log I have:
[Aug 5 14:03:26] WARNING[9934] channel.c: No channel type registered for ‘Console’
[Aug 5 14:03:26] NOTICE[9934] channel.c: Unable to request channel Console/dsp
[Aug 5 14:03:26] WARNING[9934] app_parkandannounce.c: PARK: Unable to allocate announce channel.
I’ll try your suggestions and let you know.
Thanks,
Karl said
If I put SIP/123 in place of Console/dsp, my 123 extension rings. After I pick up 123 I hear “Transfer 78″, (78 is my parking lot), then I hear busy tone.
If I put Park() in place of ParkAndAnnounce, I will hear another call coming into my current extension. After I pick up that call I hear nothing.
michigantelephone said
Well, Karl, I’m sorry but you have me stumped. Obviously I cannot see what is happening on your system, and it’s also obvious that your system and mine are not behaving in the same way. This could be happening for any number of reasons, none of which I can guess. One thing I do wonder is what version of Asterisk and what version of FreePBX you are running, not that it would help me solve your problem but I’m just curious whether a new version of Asterisk or FreePBX breaks some functionality.
If you absolutely, positively need this to work then all I can suggest is starting over with a different distribution that includes Asterisk and FreePBX. If you use PBX in a Flash from the Nerd Vittles site, it has similar functionality built in (though their version may not connect the calls quite as fast as mine). Or you could try Elastix, another distribution that includes Asterisk and FreePBX. And once you get it installed, do not upgrade Asterisk or especially FreePBX unless you are certain that it won’t break existing functionality (upgrading FreePBX modules is okay, just don’t upgrade FreePBX to another major version – in other words, if the distribution comes with FreePBX 2.6 don’t upgrade to 2.7 or especially 2.8). I know it’s a PITA to install a new distribution and I also know that you may have to upgrade Asterisk from time to time for security reasons, but if you do upgrade, be sure to test everything to make sure that nothing you depend on is broken.
By the way, did you try A. M.’s suggested fix in his comment above?
Karl said
My FreePBX version is 2.5.2, Asterisk is 1.6.1.
I haven’t tried A.M.’s suggestion yet.
Thanks a lot. I’ll do some more research on it.
IsaacL said
Thanks a lot for the post!
I’m in middle of setting up a PBXIAF/GV system, and I was trying to figure out the best method for the GV setup.
What I like about the latest PBXIAF method is that it does everything by itself…
Is there any way to modify their code and dialplan once it’s created to work the same way that this does, without the “wait while your call is connected” message, and with the NOOP lines?
Thanks.
michigantelephone said
IsaacL, sure you can do that if you understand how the dialplan works. The PiaF method and the one I show here are very similar, and if you know anything about Asterisk dialplans it would be easy enough to make whatever changes you like to the PiaF method. And in fact, I’d suggest that all PiaF users consider doing exactly what you’re thinking of doing, to eliminate the unnecessary wait while it plays the totally unnecessary message — it just boggles my mind that they’d play an unneeded message that slows down call completion — and to provide for a graceful recovery (and perhaps fall-thru to another trunk, if you have any additional trunks specified in your route) if Google Voice never calls back.
I do understand the appeal of PiaF, especially to new users and those who don’t really want to touch Linux if it can at all be avoided. But the tradeoff is that when they do something in a non-optimal manner, as occasionally happens (not surprising given the sheer amount of code there), you’re stuck with their design choices, unless you know how to fix the things that ought to be fixed. Asterisk dialplan syntax isn’t all that difficult, especially if you’ve ever done any programming in just about ANY high-level language (even something simple like BASIC), and if you can try and familiarize yourself with it, it will help you understand what others are doing in their dialplans and it will help you when you want to make some small tweak to your system to make it work the way YOU want it to.
By the way, I’m not knocking PiaF here — it’s still probably the best of the “install and go” Asterisk/FreePBX distributions out there (at least it’s in the top three, along with Elastix and AsteriskNOW). It’s just that sometimes, they choose to do things in ways that would not be my first choice. For example, in my mind, users should never have to dial a code to select a particular outbound route or trunk, because unless you are the sole user, you cannot depend on your users to dial the code. Therefore, the PBX should make that choice for them. Unfortunately, FreePBX does not natively support the use of different outbound routes or trunks by different users (though you can more or less add that functionality with a third-party module or added dial plan code). So I understand why they may have initially set it up so you have to dial a code to access a Google Voice trunk, but in the end that sort of kludge can cause more problems than it solves (for example, if you use 48 (GV) as your access code, then what happens when you try to call a number in an area code that starts with 48? What if you have an endpoint that’s not set up to pass more than 11 digits?).
Ward Mundy said
FYI: No code dialing is required to use Google Voice with The Incredible PBX. It is included as an option only to support those that might choose to use some other provider for their primary VoIP connectivity.
michigantelephone said
Thanks for the clarification, Ward. I was unaware that had been changed.
IsaacL said
Back to this post again
Thanks again for all the info and help.
Things seem to be working well.
My only problem is that I need to have multiple GV numbers available for outcalling, and have an extension automatically use the next available GV number.
It’s not working so well though with concurrent outcalling, when I try to dial from a second line once there’s already a line on an outgoing call.
Can you help me with how to set up the trunks and outbound routes for this to work well?
Thanks a lot!!
michigantelephone said
Did you set up your Custom Trunk as per the instructions? In particular, did you set Maximum Channels to 1? If you did, then it shouldn’t be trying to use that trunk for a second call when there is already one on it. I’ve never tried to use the trunks in the way you apparently are trying to (in our case there’s only one Google Voice trunk available to each GV user – they get their own trunk, which no one else can use) so I just assumed that setting the Maximum Channels would prevent the issue that you seem to be having.
IsaacL said
Each trunk has Maximum Channels set to 1.
How would I set up a separate trunk for each user/extension?
I added a bunch of outbound routes – the first has all the trunks, the second has the second one and on, the third has the third trunk and on, etc, but it looks like once a call is connected on any trunk, it still has a hard time connecting with another one…
In a way, I’d rather have all phones by default use the available lower trunks first, but I’m open to whatever works
I don’t see a way to set up the maximum calls per outgoing route, and if I’m supposed to be using one trunk per route, or have them all listed…
Any ideas are really appreciated.
Thanks a lot!
michigantelephone said
Okay, let’s back up a second – how are you assigning different extensions to different outbound routes? FreePBX will NOT do that on its own, so if you have not read How to give a particular extension different or restricted trunk access for outgoing calls and used one of the methods described in that document to send calls from different extensions to different routes, you’re not going to be able to make it work. I’d suggest studying that document, and see if you can use one of the methods shown there. I will note, just for your information, that the one that uses the Custom Contexts module is the only one that’s even a little bit supported (and probably the only one that will work in FreePBX 2.8 or later), unless you want to do manual dialplan additions in extensions_custom.conf
Once you figure out how to make calls from different extensions use different outbound routes, then you just make sure that any route that can be selected by an extension selects only ONE GV trunk.
The other option would be to have several GV trunks and make all of them available in your one route that covers US (and maybe Canada) calls. But what I’m hearing is that’s what you’re trying now and it’s not working, and since I’ve never tried to do it that way I don’t know why. Setting the Maximum Channel to 1 SHOULD prevent any issues, but that’s not to say that there’s not a bug that isn’t honoring the Maximum Channels setting. Obviously, I can’t see what your system is doing when a call goes out, so I really don’t know what’s failing.
IsaacL said
I just went back to just one outgoing route, with all the trunks added, and it seems to be working…
Hopefully that will work correctly…
If not, I’ll try setting up extensions with specific outgoing routes.
Thanks a lot again for the help, and the posts – it was a huge help.
And I see I have a lot more to read up on
IsaacL said
After some testing, it looks like I still have that problem after I place 2 other calls, and then attempt a third.
It eventually connected, but it looked like it was trying to find an available trunk, and couldn’t find one.
I’m not sure why it would try the trunks that were already in use, since they had the Maximum Connections set (unless I’m supposed to be putting it somewhere else besides in the custom trunks…
IsaacL said
And I just noticed that by the Maximum Channels setting, the description says:
“Controls the maximum number of outbound channels (simultaneous calls) that can be used on this trunk. Inbound calls are not counted against the maximum. Leave blank to specify no maximum.”
Will that still work to limit the trunks to one outgoing call?
Or since they are only used to initiate the calls, will it try to use them even though a call was already initiated with that trunk?
michigantelephone said
To be honest, I just don’t know the answers to your questions. When I write these articles, all I can really do is tell you what worked for me, and maybe try to offer informed guesses if something doesn’t work. In this case, I’m pretty much stumped – your guesses are as good as mine. I will say that once a call disappears into the Parking Lot, Asterisk seems to treat it differently than most normal calls.
Let’s test a theory here. Here’s an adaptation of my original code that WILL NOT WORK, but it illustrates a solution that COULD work if only Asterisk didn’t completely take over Parking Lot calls:
[custom-gv-trunk-username]exten => _X.,1,GotoIf($["${GVoiceOut-username}" = "1"]?inuse)
exten => _X.,n,SetGlobalVar(GVoiceOut-username=1)
exten => _X.,n,System(gvoice -e username@gmail.com -p userpassword call ${EXTEN} gvregphonenum code &)
exten => _X.,n,Set(PARKINGEXTEN=908)
; exten => _X.,n,Set(CHANNEL(musicclass)=connect-gv)
exten => _X.,n,ParkAndAnnounce(pbx-transfer:PARKED,20,Console/dsp)
exten => _X.,n,SetGlobalVar(GVoiceOut-username=0)
exten => _X.,n(inuse),Noop(Never received callback from Google Voice or trunk is in use – exiting)
The idea is that we are checking a system-wide variable to see if the trunk is in use – if so, we fall out of this trunk immediately and into the next trunk. If you make these changes, in theory it should work great just once, but after that you won’t be able to use the trunk again until you restart Asterisk. The reason is that we have no way to reset the trunk as available after it goes to the Parking Lot, unless it falls out of the Parking Lot because Google Voice never called back. And even if we had a way around that problem, we’d also have to flag incoming calls on that Google Voice trunk. But the biggest issue is that as far as I know, there’s no way to track a call (and in particular, tell when it has ended and whether the trunk is again available) once it has gone into the Parking Lot. The words “as far as I know” should be your clue that there probably IS a way to do it, but I just don’t know what that might be.
michigantelephone said
One other point – I suspect it would be a lot easier to make this work the way you want if you were using Asterisk 1.6, since it has some added functionality that might be useful here. Unfortunately, we’re still running 1.4, which means I can’t say much more than that.
IsaacL said
Thanks for the reply.
For now, I decreased the length of time it keeps the call in the Parking Lot from 20 seconds to 10 seconds, which should at leastmake the wait shorter.
One follow up question:
Will the other method that you posted, that has the ability to cancel a GV call that’s already been placed, or some variation of that code, do anything to solve my problem?
I am not too great at writing Asterisk configurations yet, otherwise I’d try a few things myself, but since the method is different (though I don’t fully understand it yet), I’m wondering if that, or a variation, might make things better…
If that’s not possible, and if the 10 seconds I changed it to is still too long, I’ll probably try setting up a different outbound route for each extension (though I’m sure I’ll run into some issue there too )
Thanks a lot again for all the info and help!
MyKroFt said
Am using Asterisk 1.6 w/bridge method and in the full log I get the following:
[2010-08-29 13:54:30] VERBOSE[24849] app_db.c: — DBdel: family=gv_dialout_tcs, key=channel
[2010-08-29 13:54:30] VERBOSE[24849] app_db.c: — DBdel: Error deleting key from database.
the briding does work and the calls get linked together – but was just curious about the error….
Thanks
MyKroFt said
also – do upload your 1.6 bridge instructions, just saw this as well:
app_db.c: The DBdel application has been deprecated in favor of the DB_DELETE dialplan function!
Thanks
Myk
michigantelephone said
Okay, since 1.6 apparently doesn’t like DBdel, let’s try it without it. I’ve modified the Asterisk 1.6 code in the article to use DB_DELETE only – please try it and let me know if it solves the problem. Failure to delete the database entry isn’t a huge problem because it will just get overwritten next time you place a Google Voice call, but I do prefer to clean up a database entry that’s no longer needed, if at all possible.
I also added a line in the hangup context that should cancel the Google Voice call if you hang up right after you dial the call, and Google Voice hasn’t called back yet. Unfortunately, that particular method won’t work under Asterisk 1.4 because as soon as the call goes to the parking lot we lose all control over it. Oh, how I wish there were some way to add the Bridge command to 1.4, or to easily upgrade from 1.4 to 1.6 without potentially breaking a lot of other things.
Tom Rogers said
This is an appeal for help… I’ve spent the last week searching the net with varying terms and pieces of what I have below trying to see if anyone has done this before.
The Asterisk / Trixbox has a hard time with routing calls and does not support any “class of service” or facilities restriction. Once it finds a route compatible with what the user dialed, that is where it tries to send the caller.
The idea is to use the information configured in the calling extension to populate the required fields in the scripts that have developed for the purpose of using Google Voice for outbound calling.
With this stated, my fledgling attempt is below in dire need of serious work in order for it to function.
I lack the programming skills to do this such that it will work. I don’t know if this has to be installed in a fashion similar to pygooglevoice or can simply be an augmentation placed in extensions_custom.conf…
Furthermore, the idea will be to reduce the matching route patterns down to a single route that has the credentials matched by the macro below before they are sent out.
If this is successful, you would be able to add additional users as noted below…
*******
[macro-gv-outbound_route]
exten => s,1,DBget(${USEROUTCID_${ARG1}})
;
; User account # 1
exten => 101,1,Macro(CALLERIDNUM,${NXXNXXXXXX}); 101,2,Macro(userid,${USERID}); 101,3,Macro(userpassword,${USERPASSWORD}); 101,4,Macro(gvregphonenum,${GVREGPHONENUM}); 101,5,Macro(code,${CODE}); 102,6,Macro(parkingexten,${PARKINGEXTEN}); 102,1,Macro(CALLERIDNUM,${NXXNXXXXXX}); 102,2,Macro(userid,${USERID}); 102,3,Macro(userpassword,${USERPASSWORD}); 102,4,Macro(gvregphonenum,${GVREGPHONENUM}); 102,5,Macro(code,${CODE}); 102,6,Macro(parkingexten,${PARKINGEXTEN}); <— Parking lot destination for this user
*******
michigantelephone said
Tom, here are some links for you:
http://www.freepbx.org/support/documentation/howtos/how-to-give-a-particular-extension-different-or-restricted-trunk-access
http://www.freepbx.org/support/documentation/module-documentation/third-party-unsupported-modules/customcontexts
http://www.freepbx.org/support/documentation/module-documentation/third-party-unsupported-modules/outbound-route-permission
http://www.freepbx.org/support/documentation/howtos/basic-usage-of-route-prefixes-to-reroute-calls-from-specific-extensions
One or more of these should give you the information you need. I will grant that it’s not exactly an easy thing to get one’s head around, and there’s no “cookbook” on the subject (that I’m aware of). Right now, it seems that most users who try to do this wind up using the third-party Custom Contexts module, although that wouldn’t be my personal choice (fortunately there’s more than one way to accomplish this).
Jake Gaisser said
I have had all of this working before with “theincrediblepbx” but it was hit or miss every time I installed it. I wanted to be in control if you will of everything happening. I have installed elastix. and I have my Trunks and inbound properly setup and can receive inbound calls when a call is placed to my google voice number. However on outbound calls it still does not work after following this guide. The PBX lady voice immediately says all circuits are busy
here is the relevant section from the asterisk log i blieve: (im new to this, but I used incrediblepbx as a free phone with google voice for months and have set it up 3-4 times successfully)
[Sep 21 01:42:42] VERBOSE[4727] pbx.c: — Executing [s@macro-dialout-trunk:27] Dial(“SIP/701-00000012″, “Local/13608984357@custom-gv-trunk-jakegaisser,300,M(setmusic^none)”) in new stack
[Sep 21 01:42:42] NOTICE[4727] chan_local.c: No such extension/context 13608984357@custom-gv-trunk-jakegaisser while calling Local channel
[Sep 21 01:42:42] VERBOSE[4727] app_dial.c: — Couldn’t call 13608984357@custom-gv-trunk-jakegaisser
[Sep 21 01:42:42] VERBOSE[4727] app_dial.c: == Everyone is busy/congested at this time (0:0/0/0)
[Sep 21 01:42:42] VERBOSE[4727] app_dial.c: == Everyone is busy/congested at this time (0:0/0/0)
michigantelephone said
It’s nearly impossible for me to say what the problem might be with only that to go on, but it looks like it’s not finding the custom context in extensions_custom.conf — the tipoff is “No such extension/context”, and since you’re not calling an extension, that means it’s not finding the context for some reason. I’d check for typos, and watch your CLI output while you try to place a call. Also remember that any time you make a change in extensions_custom.conf you MUST do an orange bar reload — go to any FreePBX setting page (such as an extension or route), click the “save changes” button (or whatever it’s called on that page — note you don’t need to actually change anything) and the orange bar should appear. Then click that and when the reload is finished, any changes you have made in extensions_custom.conf will be recognized.
Jake Gaisser said
hmmm is it “extension_custom.conf” or “extensions_custom.conf” I am wondering if that is the problem. I made the changes to “extension_custom.conf” as per the guide. I will give this another shot. Thank you for your help
michigantelephone said
extensions_custom.conf – and I must apologize because I did typo it in a couple places in the article (fixed now). In a way I’m surprised no one noticed that before, but then again, I suppose that most people who followed these instructions either realized which file I meant, or used the filename from one of the several places I entered it correctly, or found the correct file on their system. Leaving off the s is an easy mistake to make (I’ve done it before and I’ll probably do it again), but still, I apologize for the confusion.
Jake Gaisser said
so I added the lines to extensions_custom.conf but I am having the same Console/dsp problem as karl:
[Sep 21 12:01:01] WARNING[14072] channel.c: No channel type registered for ‘Console’
[Sep 21 12:01:01] NOTICE[14072] channel.c: Unable to request channel Console/dsp
[Sep 21 12:01:01] WARNING[14072] app_parkandannounce.c: PARK: Unable to allocate announce channel.
This is with elastix, going to try PIAF again but without the incrediblePBX installer. and follow this guide, I’ll post back my results.
michigantelephone said
From what I’ve read about that error, my guess (and it is strictly a guess) is that sometimes that error appears because of a hardware or driver issue – either your computer doesn’t have a sound card (or built-in equivalent), or you don’t have the correct drivers for it. One of the reasons for using ParkAndAnnounce is that it is a worakround so you don’t hear the parking lot number announced (it instead goes to the system’s audio output, which in most installations isn’t hooked up to anything, so it doesn’t bother anyone).
If you are going to go back to PiaF, you may well encounter the same issue if your hardware is the same, or you don’t get the driver issue resolved, or whatever the problem is. I’d therefore suggest installing a version that includes Asterisk 1.6 (choose “Bronze” rather than “Gold” or “Silver” in the installer) and then try the method that uses Bridge rather than ParkAndAnnounce. If it doesn’t work, you can always try going back to the original method, but as I say, if it’s a hardware or driver issue then any version you install will likely have the same issue with ParkAndAnnounce.
Tom Rogers said
I wanted to note that I did actually get the multi-GV user function working using the custom contexts module. It was a little less than stable and lacked consistency. Sometimes the return call would come quickly and other times the line would yield a busy-back first…
I write today noticing that I have a problem that was documented some time ago and seems to be alive and well… 15 minute termination of calls on Google Voice. I use Sipgate as the method of delivery to Trixbox CE. The 15 minute “limit” occurs whether the call is inbound or outbound. During tests over the weekend, I tested the same calls in both directions using the Google Talk plug-in through Gmail and I ran through the 15 minute limit… I got bored at 17 minutes and hung up…
With this said, I started to look for the option to emulate Google Talk (mod_dingaling) but there are quite a few dependencies (can’t have your other phones set to ring and have to be logged in) that I am not sure I can actually utilize the service the way I really want to. To my question, has anyone tried having a secondary GV number as one of the “ring-to” numbers which would used by Asterisk? This is likely quite a can or worms with a whole new set of dependencies but I thought I would at least ask.
michigantelephone said
This is why I wish Google would stop being evil and reopen Gizmo5 for new registrations, or at least provide direct SIP connectivity to Google Voice. I have NEVER seen a call time out when Gizmo5 is used, probably because when one leg of the call is delivered via SIP then Google doesn’t have to pay termination charges for they leg of the call. When they force new users to use a DID provider such as Sipgate to bring calls in, they probably have to pay termination charges (perhaps relatively high charges at that) to Sipgate (or Sipgate’s upstream provider), which probably gives them some inducement to limit the length of the call. All I know is that on a couple of occasions I’ve had Google Voice calls that lasted over an hour, but I was using Gizmo5 on my end.
Every now and then someone offers a Gizmo5 account on fleabay – however I can’t recommend that because you have no idea what state the account is in – it might be useless because someone made a lot of outgoing calls (via Gizmo5, not Google Voice) and used up all the call credit. So you are basically buying a pig in a poke, from someone trying to make a profit on something they got for free – or maybe they don’t have it at all, and are trying to run an outright scam. But until Google reopens Gizmo5 for new registrations, IF they ever do, those who didn’t get a Gizmo5 account when they were available are kind of stuck. Personally, I hope someday soon the government investigates Google’s practice of buying online services only to shut them down to new registrations, inconveniencing many users and potential users. Maybe if the government started poking around, Google might realize that yes, that really is a fairly evil thing to do (I’m playing off their company motto, “Don’t be evil”, in case you hadn’t guessed).
Even a Gizmo5 account, however, will not give you 100% call completion. It seems there are times of day that Google Voice just gets too busy and doesn’t return calls. I find that if you make two calls in quick succession during the afternoon hours, sometimes the second one won’t go through because Google Voice never makes the callback. And then there are simply those random occurrences where, for whatever reason, Google Voice never calls back. Sometimes I wonder if they are already reaching the limits of their capability to handle voice traffic and because it’s a service they aren’t making any money on, they have no incentive to make any improvements that would alleviate the congestion issues.
Andy said
This is an excellent article. I followed it and now i have my elastix server routing through my gmail account.
Thank you very much.
BitterMike said
hello,
I am following the tutorial above and as I try to get simplejson i get a download 111 connection refused error?
it is trying at http://cheeseshop.python.org/pypi/simplejson/
and
http://undefined.org/python/#pyhton/simplejson
TIA for your help!
michigantelephone said
Unfortunately I know next to nothing about Python, so I can’t help you much. I can tell you there is documentation on easy_install that might assist you at http://peak.telecommunity.com/DevCenter/EasyInstall#downloading-and-installing-a-package and I can also tell you that on our system, it appears to have installed the file simplejson-2.1.1-py2.4.egg into the /usr/lib/python2.4/site-packages directory (whether it installed or configured anything else I do not know). A Google search shows me that the package MIGHT be available on this page: http://pypi.python.org/pypi/simplejson/2.1.1 – however, I have NO CLUE whether you could do something like easy_install http://pypi.python.org/packages/source/s/simplejson/simplejson-2.1.1.tar.gz#md5=0bbe3a2e5e4cac040013733aca159d89 and it would work (if it doesn’t, try omitting the #md5=0bbe3a2e5e4cac040013733aca159d89 part of the link). If you get absolutely stuck, I could perhaps send you a copy of the .egg file that’s on our system, but I have no idea whether that would be the correct version for your system, so it would be much better if you could grab a copy from an “official” site.
EDIT: It looks like it was a temporary outage on those sites, and that they are back up now, so hopefully easy_install simplejson should be working again.
Bradley P said
Hello I am using pbx in a flash and what I would like to do is Me and my brother have different google voice numbers. my setup is GOOGLE VOICE + SIPGATE ONE and my brother uses GOOGLE VOICE + GIZMO5. I want a setup where we both have our phones setup to use 2 accounts on same pbx in a flash system, with both numbers having there own setup. where if someone calls his number it rings his phone only and if someone calls my number it only rings my phone and that we both have our own call out routes. if someone could help would be very apperciated. I am dumb so please if you could do a step by step setup for me. thank you very much.
Simon Lok said
Regarding the first edit where you talk about using bridge and you say it is not tested, I tried it out, and it works great. Specifically, these two blocks of code added to custom_extensions.conf along with the specification of the custom destination in the inbound route works correctly for me.
custom-gv-trunk-username]
exten => _X.,1,System(gvoice -e username@gmail.com -p userpassword call ${EXTEN} gvregphonenum code &)
exten => _X.,n,Set(DB(gv_dialout_username/channel)=${CHANNEL})
exten => _X.,n,Wait(20)
exten => _X.,n,Noop(Never received callback from Google Voice on channel ${DB_DELETE(gv_dialout_username/channel)} – exiting)
exten => h,1,Noop(Hangup on channel ${DB_DELETE(gv_dialout_username/channel)})
exten => h,n,System(gvoice -e username@gmail.com -p userpassword cancel &)
[custom-gv-inbound-username]
exten => s,1,NoCDR()
exten => s,n,Bridge(${DB_DELETE(gv_dialout_username/channel)})
michigantelephone said
Thank you for that report, Simon – I’ve been wondering if it actually worked!
Is time running out for Gizmo5? « The Michigan Telephone blog said
[...] Or to be more specific: Is time running out on the use of Gizmo5 as a part of the method used to make free outgoing Google Voice calls from an Asterisk box, as mentioned in our article on How to use Google Voice for free outgoing calls on an Asterisk/FreePBX system (the easy way)? [...]
michigantelephone said
With regard to the above pingback, I should note that this ONLY potentially affects you if you are using a Gizmo5 account to receive your Google Voice callbacks. If you are using a DID number then it does NOT affect you at this time.
UniC Solution said
Thank you for this well organized information. I made it working with the asterisk 1.6 bridge function. However I did find the call canceling was not done right. Since we are calling the Local channel as the trunk, the system well perform a hangup on the original Local channel when it’s bridged, thus leading the call to the h extension within the outbound call context. And further disconnect my bridged call in about 10 second since the h extension is sending out a call cancel command to the google voice. It took me a while to figure out why my call always gets disconnected in exactly about 10 second.
Well, once we found the problem, the second part is to figure out how we could address it and make it better. So I have done my study and testing. Here I present you an improved h extension to go along with the Asterisk 1.6 Bridge method:
exten => h,1,GotoIf($["${CHANNEL(state)}" = "Ring"]?:bridged)
exten => h,n,Noop(Hangup on channel ${DB_DELETE(gv_dialout_username/channel)})
exten => h,n,System(gvoice -e username@gmail.com -p yourpassword cancel &)
exten => h,n,Hangup()
exten => h,n(bridged),Noop(The channel has been bridged successfully)
Hopefully , michigantelephone will update the original article for this fix.
Henry
michigantelephone said
Henry, thank you for the fix. Although I’ve not received any other reports of this issue prior to yours, if the changes helped you I figure it’s worth adding them to the original article, in case others are having (or have had) the same issue and just never reported it. You’ve probably saved a few people from some hair-pulling frustration!
IsaacL said
I’ve been using this setup, and it’s been working wonderfully for a few months already.
Running PBXIAF 1.7.55 Silver with the Incredible PBX and the above GV setup.
I have a new challenge though:
Is it possible to set up a Google Voice number that only works foroutgoing calls with a specific extension? I know that I can forward all incoming calls from that number to an extension, but I’d like to be able to have a specific extension only use one Google Voice number, and have only that extension use that number, and have that extension not be able to dial out using any other outgoing number/route.
Is that possible? Any way to work that?
Thanks a lot for all your help!!
Cliff said
Thanks for sharing this wonderful post. However, I followed the directions step by step, but afterwards, none of my trunks work. I get the message “all circuits are busy now,” when try to use any out going trunks which worked prior to adding GV. I am running Elastix 2.0, Asterisk 1.6. any help would be appreciated.
michigantelephone said
There are two things I will never understand:
- How it is that people can mess up their systems in such new and creative ways, using instructions that probably dozens (if not hundreds) of others have followed without any major hitches, and
- Why they then think that I can tell them what they did wrong when they essentially tell me nothing more than “it’s not working.”
Cliff, in your case you may want to restore from your latest backup (you DO have a backup, right?) and then if you still want to try again, follow the instructions more carefully. I just don’t understand how you managed to kill all your previously working trunks (there’s nothing in these instructions that should affect existing trunks not related to Google Voice), and you haven’t given me nearly enough information to diagnose the issue, even if I were so inclined, which I’m really not because it sounds to me like you must have done something that was not in the instructions. I try to help when I can, but even when given a lot of information on the problem the best I can do is make an educated guess, and when given virtually no information there is just nothing I can tell you. I’m not one of those “remote viewer” guys (never stared down a goat!) and I don’t have a crystal ball.
If you hadn’t said that you killed your existing trunks I might suggest that you consider upgrading Asterisk to the current 1.8 release, but I hate to even think what might happen if you tried that.
michigantelephone said
Cliff, one other point – if you created a new outbound route for Google Voice, try deleting it or making sure it’s lower in priority than all the other outbound routes. If you added the Google Voice trunk to any existing outbound routes, remove it from those routes. That may get your other trunks working again.
Cliff said
Hey Mich, thanks for the whipping- I love it. Everything is back up and running. Basically this is what happen. I am using Voiceeclipse for my sip trunks, well VE does not use DIDs, they use an extension (5XXX3). In my CID, I have to use the VE extension, rather than my google voice number. Onces I did that, All trunks came back up. Now I am checking to see if GV is placing outbound calls.
Bradley P said
I made a post back in october 2010 and still have received no reply, could someone please help. thank you very much for any help that might be given on my earlier post dated October 8, 2010 @ 1:14 pm.
michigantelephone said
Bradley P – you wanted a step by step setup and that’s exactly what these articles are. Please read my comment policy, especially the part where it says that I AM NOT YOUR TECHNICAL SUPPORT. If anyone else reading this wants to walk you though it I’m fine with that, but what I didn’t understand was that if you are running PBX in a Flash, why you didn’t ask for help in their forum? The way they do things and the way I do things is sometimes different enough that if I tried to help you with a PiaF installation, I could make things worse than they are now and then you’d be mad at me. But maybe someone else (perhaps another PiaF user) would be willing to try and help you.
Now, had you given me some indication that you’d made an attempt to follow the instructions in the article and perhaps got at least one account up and running, we might be having a different discussion. But I’m not going to try and write what would in effect be a custom article just for you. Sorry.
Bradley P said
michigantelephone,
I do have my account setup and working. I was wanting to know how to add my brothers account to pbx. I take it from your post you do not like PiaF. Sorry I asked for help. Thanks any ways.
michigantelephone said
Bradley P, it has nothing to do with any feelings I may have about PiaF (pro or con) and everything to do with the fact that I’m not going to write custom instructions for everyone who comes along. The instructions in the article are specifically intended to allow multiple Google Voice accounts.
Cliff said
Hi Mich, let me make another attempt at this. I can test calls from a command line, but cannot place a call from an extensions. My existing routes are fine, it appears to be an issue with my parking lots. My settings are, parking lot extension 70, number of slots 8, my sipconfig is as follows exten => _X.,n,Set(PARKINGEXTEN=78).
Can you think of anywhere I can check as to why calls from extensions are failing?
Jake said
I’m having a problem with getting both incoming and outgoing calls to work with this setup. If I leave my existing (pre this article) inbound rule for an ipkall number to ring a certain extension (instead of going to a call park), I am able to receive calls but not make outgoing ones. If I change the destination for the previous inbound rule to a park slot, I can make outgoing calls but incoming gives an audible message saying the park slot is invalid. I’ve messed around a bit and got it to the point where it will accept incoming calls and will kind of place outgoing calls (the number is dialed, then I’m disconnected, and the ringback for the Google Voice comes through about 3 seconds later). Is there any way I can make the handoff to the GV ringback not require hanging up the phone?
michigantelephone said
Due to the impending demise of Gizmo5 (see R.I.P. Gizmo5), which is the only service I have ever used with this method, I will no longer be offering any assistance to those trying to make this method work. You are, of course, still welcome to use it, but any comments left asking for help or assistance will not be answered by me (unless, perhaps, the answer is glaringly obvious on first reading). I don’t use this method anymore, so I’m not really in a position to help diagnose your issue. The last paragraph (as I write this comment) of the article linked above offers some suggestions for alternatives that you might wish to explore, none of which use either Gizmo5 OR a DID from a third-party provider to bring your calls into the system, and any of which will provide you with better call quality and faster call completion than this method.
Trent said
I found a method that actually works. After months, I finally have outgoing calls through asterisk.
Go to this site and download a FreePBX module (2.9 not supported)
http://freedoh.net/
After reload it will appear in the 3rd Party Module section at the bottom.
For username only enter in your username before the @gmail.com else it will add another @gmail.com
michigantelephone said
Will it handle multiple Google Voice accounts on the same system, or does this module limit you to one? Also, the fact that it doesn’t support FreePBX 2.9 will be a blocker for some potential users.
Trent said
Yes, it supports multiple acounts and I have two accounts setup on it. Works great for me.
No telling when support for 2.9 will come out. I sent the developer a message asking when it will come out. I will post when he reponds.
Trent said
And another, note. **IF** you have trouble receiving calls then you need to go into the gtalk.conf file and change “connection=asterisk” to “connection=@gmail.com for each account you have.
Trent said
He got back with me. He would like to make a compatable 2.9 version, but he is not in a big hurry to make it. Seems he has issues with the developers. He states FreePBX is just one big bug.Here is his final comment on the subject, “bottom line is that I’m not going to write stuff for the benefit of others when I get treated like shit”
michigantelephone said
Gee, you mean there is someone else out there that thinks the FreePBX development team is mostly a bunch of assholes (maybe not every single one of them, depending on who you actually consider to be a part of that team and who just thinks they are)? This is why I keep saying I wish that there were decent GUI software (comparable to FreePBX) for FreeSWITCH. Both Asterisk and FreePBX suffer from the same problem: The developers design the software they want and if you want to use it you’ll take what they give you and like it, bugs and all, and they reserve the right to screw up previous functionality in new releases. If you report a bug and it doesn’t personally affect one of them, maybe they’ll fix it and maybe they won’t, or maybe they’ll call it a “feature request” (which means “we might address this a few months to years from now, but only if we feel like it:”) or maybe they’ll just close the ticket altogether with some snide or condescending remark. I have said several times that I use FreePBX but I hate it – and hate is really much to mild a word to describe how I feel about it.
One of the first reasons I started hating the current FreePBX development team was because of the way they treated another would-be developer like dirt. I’m talking about the guy who originally wrote Custom Contexts and a few other useful modules. He was a VERY talented programmer and probably would have produced a lot more useful FreePBX modules except that they treated him like shit, too (this is my opinion of the situation as I watched it unfold at the time, not something that he actually said to me). In my personal opinion, the most active FreePBX developers are arrogant and rude, have no “people skills” whatsoever, and have totally ruined FreePBX with the latest releases (WHY would you keep making changes that break existing modules or make things more difficult for users when no one has asked for anything like that?).
I HATE FreePBX. I hate it with every fiber of my being, and yet I still use it because no one else seems capable of producing a comparable GUI for Asterisk OR FreeSWITCH. A few versions ago my attitude was totally different. If someone would take ANY pre-2.8 version (2.7 was the last reasonably good one), fork it, and commit to making only changes requested by users and security fixes, and not whatever stupid design change some asshole developer thinks would be a good idea (after consulting no one, especially not the FreePBX users), I could get behind that version. But everything from FreePBX 2.8 forward is an abomination in my opinion, and I’m afraid it’s only going to get worse because those guys never seem to run out of bad ideas and ways to break things.
FreePBX is, in fact, one of the big reasons I have stopped actively writing in this blog. My writing was getting so negative and 90% of my negativity was entirely because of FreePBX. The only reason I have posted the last couple of articles is because, having finally figured out how to do something, I wanted to put it somewhere where I could find it again, and if the information helps someone else, why not?
Trent said
Yes it is a shame it has come to this. He informs me he has gone over to freeswitch. Though he did make a really nice Asterisk/FreePBX installation script for Debian. within 10 minutes you get both installed auctomatically after running the script. Sad it seems both Digium and FreePBX people running people off on on to other things than further development for these systems.
I have enjoyed your posts. Would hope you could continue to write on other subjects on VoIP and other telecom things than Asterisk and FreePBX.
Richard M. said
Hi michigantelephone
I have been using your Google Voice / Asterisk/FreePBX solution with Elastix 2.0 (Asterisk 1.6) for several months and it has been working fine until a few days ago.
Now I am unable to make any outgoing calls. I heard Google may have made some changes to their call format, but I have not idea what those changes are.
Do you know what may have changed or a solution?
Thanks
Richard
Trent said
If you have FreePBX < 2.9 then you can install and use this module as I mentioned above.
http://www.freedoh.net/googlevoice.html
michigantelephone said
Richard, Google Voice keeps changing things and it seems like about every two weeks a group of users (not always the same group) starts having issues.
The most recent change I’m aware of is this: In a message on the Jingle mailing list, Peter Thatcher of Google writes:
Also see this article from The Register:
Google battles MicroSkype with ‘open’ VoIP protocol
This may or may not be related to your problem (my guess: it isn’t). Can you still receive normal incoming GV calls? Any number of things could cause a problem like yours, from your firewall not allowing communications with GV’s servers (did they maybe change their IP address?) to a timing issue (seems like now, GV wants you to wait a few milliseconds before answering a call, and some DID providers deliver the call just a little too quickly). You could try inserting a one second wait and see if it helps, like this:
[custom-gv-inbound-username]
exten => s,1,NoCDR()
exten => s,n,Wait(1) <—— Try adding this
exten => s,n,Bridge(${DB_DELETE(gv_dialout_username/channel)})
In the past such a wait was completely unnecessary but Google Voice just keeps changing things and throwing us off.
If you just can’t get it working again, the only things I can suggest are either using FreeSWITCH to add Google Voice to Asterisk or using an Obihai OBi100 or OBi110 VoIP device as a gateway between Asterisk/FreePBX and Google Voice (and note the last paragraph — there’s a part 2). I may be wrong, but my gut impression is that both the FreeSwitgh people and the Obihai folks are more committed to maintaining Google Voice connectivity than the Asterisk folks, not that it matters if you are still running Asterisk 1.6 (there’s no built-in Google Voice support until you get to Asterisk 1.8, and right now even that’s a little bit flaky).
michigantelephone said
Trent, are you sure that module will work with Asterisk 1.6? Google Voice has to be handled completely differently in pre-1.8 versions of Asterisk.
Trent said
I believe it is for 1.8. I see no reason not to upgrade. 1.8 been working out fine for me.
michigantelephone said
Interesting development with regard to the Google Voice module for FreePBX, with regard to version 2.9 — see this thread on the PBX in a Flash forum.
After reading that you may think I have been a little too hard on FreePBX and its development team. However, it remains to be seen if this is a one-off thing or if they have actually decided to become more responsive to users concerns on an ongoing basis. I would certainly hope the latter is the case, and if so I’d be very happy to suspend my criticisms, and maybe someday I could even actually like FreePBX again. But at this point, the way I see it, they have built up a lot of “bad karma” with users and would-be third party developers they will need to work to overcome. I’m sure they can do that if they really want to, but the question is, do they want to?
I, for one, am certainly willing to forgive past transgressions if there is any indication that they have “seen the light”. But I wonder if all the third-party developers that have felt slighted by the FreePBX developers will feel so charitable?
Trent said
I would have replied sooner, but seems that fix stirred up a hornets nest. Marcus Brown seems to not be at all happy with the FreePBX developers at all now. I am not sure exactly what transpired, but if you can get the public logs for the #freepbx-dev IRC channel, it would be revealed what has made him so angry.
I do know one of his final comments on the subject is “Any relationship that I MAY have had with FreePBX ends now.”
michigantelephone said
I just want to inject this here, for anyone coming late to this thread. It turns out that in this particular case we may be overlooking the REAL troublemaker, the guy who stirs the pot and gets everyone mad at each other and then feeds off all the negative energy. And, he’s NOT on the FreePBX development team. So some of the above comments (by me and others) may be misguided if we think that a particular developer is the REAL reason things went south. Not that one or more developers didn’t perhaps make things worse by their subsequent actions.
If any of you have children or grandchildren and have been forced to sit through the animated movie “Hoodwinked” (okay, it’s really not that bad as kids’ movies go), think “who’s the bunny in this scenario?” And that’s all I will say about it.
michigantelephone said
Asterisk 1.6 users: During a recent Google Voice problem I posted these simplified instructions to the PBX in a Flash forum inviting users to try them. It quickly developed that this was NOT the correct fix for that particular issue, but it occurs to me that Asterisk 1.6 users might still prefer somewhat simplified installation instructions. This is basically a variation on what is posted above. What I’ve tried to do here is cut out some of the excess verbiage, the Asterisk 1.4 stuff, the Gizmo5 references, the Parking Lot nonsense, and a lot of other stuff that is irrelevant to Asterisk 1.6 users, BUT please bear in mind that I’ve never personally had an Asterisk 1.6 system to test this on. These instructions should be considered UNTESTED and EXPERIMENTAL. Also, note that lines may wrap on the screen, so be sure you copy and paste any lines in question (particularly in the code blocks) into a text editor so you get them complete and without incorrect line breaks.
You will need to have your Google Voice calls arriving on a DID.
First, you must install some Python additions and the pygooglevoice program, assuming you have not done so already. From a command prompt, do this (this assumes you are using CentOS):
cd /root
yum -y install python-setuptools
easy_install simplejson
wget http://code.google.com/p/pygooglevoice/downloads/detail?name=pygooglevoice-0.5.tar.gz
tar zxvf pygooglevoice-0.5
cd pygooglevoice-0.5
python setup.py install
EDIT (September 28, 2011): You may also need to run this patch from the Linux command prompt (this is all one line):
sed -i 's|https://www.google.com/accounts/ServiceLoginAuth?service=grandcentral|https://accounts.google.com/ServiceLogin?service=grandcentral\&continue=https://www.google.com/voice|' /usr/lib/python2.4/site-packages/googlevoice/settings.pyThe above was found in this thread in the PBX in a Flash forum, which explains why the patch is needed. If you are actually using PBX in a Flash, then you can run update-fixes to get this patch.
Next open /etc/asterisk/extensions_custom.conf in a text editor and add the following new context:
[custom-gv-trunk-username]
exten => _X.,1,System(gvoice -e username@gmail.com -p userpassword call ${EXTEN} gvregphonenum code &)
exten => _X.,n,Set(DB(gv_dialout_username/channel)=${CHANNEL})
exten => _X.,n,Wait(20)
exten => _X.,n,Noop(Never received callback from Google Voice on channel ${DB_DELETE(gv_dialout_username/channel)} – exiting)
exten => h,1,GotoIf($["${CHANNEL(state)}" = "Ring"]?:bridged)
exten => h,n,Noop(Hangup on channel ${DB_DELETE(gv_dialout_username/channel)})
exten => h,n,System(gvoice -e username@gmail.com -p userpassword cancel &)
exten => h,n,Hangup()
exten => h,n(bridged),Noop(The channel has been bridged successfully)
In the first line of the above context (the context identification) and elsewhere in these instructions, replace username with the name of the user associated with the Google Voice account — this makes it easier to add additional users if you should ever need to. Then in the next line (the one that runs the System command), change the following four values:
username@gmail.com — change to the actual email address associated with the Google Voice account
userpassword — replace with the password of the Google Voice account.
gvregphonenumber — replace this with the registered phone number in Google voice that you want to forward calls to – note that this must be a number that comes into your Asterisk/FreePBX box, and you must have already registered it as a destination in Google Voice. This is NOT your Google Voice number. You may need to use ten or eleven digits. The only thing I can tell you here is to try it first without the leading “1″ and if that doesn’t work, try prepending the “1″ – Google Voice just doesn’t seem to be consistent on this, but generally only one way or the other will work for any given destination number, and it’s up to you to figure out which works. If it’s a Google Talk destination, you must put your Gmail address (the one associated with the Google Talk account, e.g. youraddress@gmail.com) here.
code — When you registered the destination phone number with Google Voice you had to tell them if the number was a Home, Work, Mobile, etc. number. Replace “code” with a single digit that is one of the following: 1-Home, 2-Mobile, 3-Work, or 9-Google Talk. Just use the single digit, not the word. In some cases the code number can be omitted entirely and it will still work, but in other cases the code appears to be essential to making it work. Note that this must be a number that actually comes into your system!
Also in this line, do not omit the space and ampersand just before the final parenthesis — this allows the dial plan to move ahead while the call is being set up.
Change all the other occurrences of username, userpassword, etc. in the remainder of the context.
Next, add another new context (you can put it just above or below the one previously discussed) in extensions_custom.conf as follows:
[custom-gv-inbound-username]
exten => s,1,Wait(1)
exten => s,n,NoCDR()
exten => s,n,Bridge(${DB_DELETE(gv_dialout_username/channel)})
The wait in the “exten => s,1,Wait(1)” line is newly added – I believe this is where you’d need to insert a wait to keep an incoming call from being bridged (and therefore answered) prematurely, which can sometimes cause problems with Google Voice nowadays.
Go into FreePBX, Tools menu, Custom Destinations and create a new Custom Destination. In the Custom Destination: text box put this string:
custom-gv-inbound-username,s,1
In the Description: field, use a description that makes sense, such as Google Voice Bridge username and then click on “Submit Changes.”
Create a new CUSTOM trunk. Set it up this way:
Maximum Channels: set to 2 (I’ve read that Google Voice allows up to two simultaneous outbound calls per account).
Dial Rules: Use what you like, it’s suggested that you at least add 1+NXXNXXXXXX but if your area allows seven digit dialing, you may also want to add one like 1areacode+NXXXXXX where areacode is replaced with your local three digit area code.
Custom Dial String: Set to Local/$OUTNUM$@custom-gv-trunk-username (so it matches the context you created in extensions_custom.conf above).
Click Submit Changes. Use this custom trunk as a trunk selection for any USA/Canada Outbound Route.
Remember that I said above that your Google Voice number must come into your Asterisk/FreePBX system? I am assuming you already have an Inbound Route for that, and that you know it works. That is, when you call your Google Voice number, it should forward the call to one of your DID’s. For this to work, the DID you use MUST preserve incoming Caller ID (the number, not necessarily the name) — I’ve heard reports that a few “free” DID’s discard incoming Caller ID and if yours does, it won’t work as you like. Now you are going to make a second inbound route for that same DID (don’t change the original, just make a new one). So go to Inbound Routes and Add Incoming Route, then set it up as follows:
Description: Whatever you want.
DID Number: Same as on your other Inbound Route that handles your Google Voice traffic.
Caller ID number: This will be your Google Voice number, but however your DID provider hands you Caller ID, you must match their format (usually either ten or eleven digits), and even then you may need to watch the CLI the first time you try a test call, to make sure that when the return call arrives it’s coming in with the Caller ID exactly as you entered it here. Remember, if you don’t exactly match what your provider sends, it won’t work!
Destination: Set this to the custom destination that you created above (Google Voice Bridge username). Don’t change any of the other settings on the page (in particular, do not set a CID Lookup Source, as it may cause an unwanted delay in connection time, and there’s no reason to do so since this route is only triggered when a single Caller ID comes in). Now click “Submit.”
Good Luck!!! If you get this to work, please let me know if you had to do anything extra that’s not mentioned above.
TT said
Hello there
Great info here.. Just curious is it possible to terminate multiple call on a google trunk and what’s the limit ? I apologize in advance if that was covered and I missed that part..
michigantelephone said
I haven’t personally tested a multiple call scenario but I believe the limit is 2 (probably to allow for one call plus one “call waiting” call, or a three-way call). Although, for all I know there may be no limit on incoming calls. Bear in mind that what’s true today may not be true tomorrow, because the FCC just made some major changes to USF and to VoIP carrier payments, and I don’t think anyone is sure quite yet how these will affect services like Google Voice, and even commercial VoIP service (see discussion at http://www.dslreports.com/forum/r26482997-FCC-makes-major-changes-to-USF-and-to-VoIP-carrier-payments).