EDIT: This is one of the most popular articles on this site, so I really hate to have to say it but this method doesn’t work very well anymore, and that’s because Asterisk’s support of Google Voice, in a word, SUCKS (that is just my opinion, of course, but feel free to try it if you don’t believe me). Google Voice changed some things, and it sure appears as if Digium hasn’t even tried to keep up with the changes. Obihai devices, FreeSWITCH, and YATE all seem to have fewer or no issues communicating with Google Voice, while in Asterisk it’s a crap shoot whether you will receive incoming Google Voce calls (for the moment, outgoing calls still seem to work, though there is a rather long delay before the call connects through).
So I am going to make an unusual recommendation: Don’t use the method shown here, or ANY method you find that relies solely on Asterisk to connect to Google Voice. If you have an Obi100 or OBi110 adapter, consider using it as a gateway between Asterisk and Google Voice. If you don’t have an Obihai adapter, or need to bridge multiple Google Voice accounts, then take a look at the article Using FreeSWITCH to add Google Voice to Asterisk, or check the comment section of this article for some additional suggestions. At the end of January, 2012 I used the technique in the aforementioned link to use FreeSWITCH as a gateway between Google Voice and Asterisk, and I must say that it works a LOT better than Asterisk’s Google Voice support. I also added some comments to that article (probably too many!) that among other things show how I got it working for multiple Google Voice accounts. So if you don’t have an Obihai, I would now recommend using that method, unless you are very short on memory and/or storage space — it just works, and calls connect faster. If you do go that route, read the article AND the comments under it first, so you’ll know what to expect, and do be aware that it takes a relatively LONG time to compile and install FreeSWITCH (compared to Asterisk). At points during the installation it may look like it’s stuck in an endless loop, but it really isn’t. Just go away and take a walk outside or something, and come back in a while and it should be done.
And if you just don’t want to be bothered with any of that, and you don’t mind using an external service, you could try using Bill Simon’s Google Voice-SIP gateway (the linked article shows how to use it with an Obihai device, but if you read through it you will see it also shows that the gateway can be used with Asterisk directly).
But just in case you think you can debug Asterisk’s buggy channel drivers and get this working as it should, here’s my original article. Unless you are a master coder, however, I strongly suggest that, at least for the time being, you do NOT follow these instructions, because you are most likely NOT going to be happy with the result!
* * * * *
This is a followup to my earlier article, How to use Google Voice for free outgoing calls on an Asterisk/FreePBX system (the easy way). Starting with Asterisk 1.8 it’s a whole lot easier, and doesn’t require you to have a separate DID or Gizmo5 account to bring in the calls. My goal was to simplify (as much as possible) the dial plan code used, especially the code that has to be entered into /etc/asterisk/extensions_custom.conf, and to speed up execution by getting rid of unnecessary waits (why make callers wait extra seconds if you don’t have to? That’s just inconsiderate).
This article comes with my standard disclaimer: Although it worked for me, it may or may not work for you, and I offer no warranties or guarantees of any kind. I present the following for experimental use only. Don’t put it on a production server unless you, personally, are satisfied that it works the way you need it to. If it stops working, you have my sympathy but that’s about it. If it breaks your system, you own all the pieces. I am not your technical support, so don’t complain to me if it doesn’t work, but if you leave a detailed comment maybe I or someone else can point you in the right direction. Just saying that something doesn’t work is not a detailed comment, and if you leave a comment like that, don’t be surprised if all you hear is crickets chirping. Still here? Let’s get started then.
Note that you should be running as root while you are configuring and/or installing Asterisk and any related programs, or else be using sudo in front of all commands entered at the Linux command prompt during the configuration and installation process. Otherwise files may be installed with the wrong permissions and/or ownership, and things won’t work!
Until Google fixes the bug where your preference to disable Call Screening (where you are prompted to press “1″ to accept the call, etc.) is NOT honored when you use a Google Chat destination in Google Voice, the first thing you have to decide is how you want to answer incoming calls. Will you want to answer a call as soon as it comes into your system, or defer answering until a destination extension picks up? There are pros and cons to each approach and rather than rehash those here, I’ll refer you to my previous article, Asterisk 1.8.x and FreePBX users: How to NOT answer Google Voice calls UNTIL the called extension answers. You may want to read the discussion there, and then come back here.
You also have to determine what version of Asterisk you are running. You need to be running at least Asterisk 1.8.1.1, or something in the Asterisk 1.8.2 branch or higher, for outgoing calls to work. From the Asterisk CLI you can enter core show version to see what version of Asterisk you are using. If you don’t have the correct version you will need to upgrade Asterisk. If you’re running an earlier version of Asterisk, see Links and Information: Updating an Asterisk/FreePBX system so you can use Google Voice for possible assistance.
Also, you need to make sure the proper modules are installed. Go to your Asterisk source directory (usually it’s /usr/src/asterisk-1.8.something but be sure you’re at the correct version) and run make menuselect. Look under Channel Drivers and make sure there’s an asterisk [*] next to both chan_gtalk and chan_jingle:
Also look under Resource Modules check to be sure there’s an asterisk next to res_jabber:

If everything looks good, just hit escape to exit (and skip the rest of this paragraph). But, if you see XXX next to one or both, it probably means that iksemel is not installed on your system. The current version of iksemel (as of this writing) is 1.4 and you can get it here. After you install and compile it (see How to fix the problem of missing modules res_jabber.so and/or chan_gtalk.so in your Asterisk installation if you need help with that), from within your Asterisk source directory, you’ll have to do contrib/scripts/get_mp3_source.sh (only if you’ve not previously done that), then ./configure, then make menselect (select chan_gtalk, chan_jingle and res_jabber if they aren’t already selected, and also app_mysql, app_saycountpl, cdr_mysql, format_mp3, and res_config_mysql if you just ran the get_mp3_source.sh script, then Save & Exit), then make, and finally make install to recompile Asterisk (if you’re going to do this anyway, this may be a good time to upgrade Asterisk to the latest version if you don’t already have it).
EDIT: Note that in many (possibly most) installations, you may have to go into your firewall and route UDP port 5222 to your Asterisk server, in the same way you probably had to map UDP port 5060 to your server in order to make SIP calls work. You can do this here at the start of the process as a precaution, or you can wait to see if you have problem making this work and if so, do it then. It’s up to you.
One final thing before we proceed — let’s talk a moment about Google Voice accounts. When you create a Google Voice account, it is a very good idea to first create a new Gmail account that you won’t actually use for e-mail, then tie the Google Voice account to that. Don’t tie your Google Voice account to your primary e-mail address because the account password has to be stored in plain text in the jabber.conf configuration file (so if someone hacks your Asterisk box, they could get into your e-mail account) AND because whenever you are logged into Gmail, there is some chance you might not receive incoming calls. So unless you are very attached to a particular Google Voice number (or managed to snag one in a Frontier exchange while they were still up for grabs), get a new Gmail account, use a good strong password when you create it, and then open your Google Voice account from there. And when you set up your Google Voice account, be sure to set it to forward to Google Chat, and be sure that Call Screening is off, that Caller ID (incoming) is set to Display caller’s number, that Do Not Disturb is NOT enabled (at least not whenever you actually want to receive calls!), and that Call Options are NOT enabled.
EDIT: At this point I should probably let you know that since this article was originally written, there is now an unofficial, third-party Google Voice FreePBX module by Marcus Brown (look at the “googlevoice” entries and pick the one with the highest version number). Always use the latest version — older versions CAN break things on your system! Those who have used it say it works well and makes configuration easier, and probably would eliminate the need to follow most or all of the instructions below. The catch is that the original version only worked with FreePBX 2.8, due to internal changes made starting in FreePBX 2.9. Patches have been provided to make it work with FreePBX 2.9, but by certain FreePBX developers, not by the original author. So, while this module could make Google Voice configuration a whole lot easier, you do run the risk that it might no longer work if you upgrade FreePBX to a new major version at some point in the future. Anyway, the following instructions are for those NOT using this module.
Once you have the prerequisites you can proceed to create the files you need. You’re going to need to make or modify four files in the /etc/asterisk directory. The first is gtalk.conf. If you have nano installed, you can do this:
touch /etc/asterisk/gtalk.conf
nano /etc/asterisk/gtalk.conf
Or, use any editor you prefer (the same applies to all the files we’ll deal with here). Then paste the following text into that file:
[general] allowguest=yes context=googlein stunaddr=stun01.sipphone.com [guest] disallow=all allow=ulaw connection=asterisk context=googlein
Next, create the file jingle.conf (touch /etc/asterisk/jingle.conf) but don’t put anything in it. If it already exists, use an editor to make sure every line inside is commented out (with a semicolon at the start of the line) or remove it.
Next we must create jabber.conf (touch /etc/asterisk/jabber.conf). Into this file we will put our user details.
EDIT: I’m interrupting this article here to say that once you’ve got this far in the process, you have the option to beta test a BASH shell script to help you with the rest of the configuration. If you’re not scratching your head wondering “what’s a shell script?” then I’d suggest you at least take a look at it, because using that script should make this process easier (particularly if you intend to have more than one Google Voice account coming into your system). If you don’t wish to use the script then you can continue on with configuration of jabber.conf.
In the sample configuration below you will see username, where username is the part of the Gmail address before the @ on the associated Gmail account (don’t neglect to change the context name [username], in addition to replacing username in the line username=username@gmail.com/Talk). For each additional Google Voice user you can add another username context. So, here’s what jabber.conf must contain:
[general] debug=no autoprune=no autoregister=yes [username] type=client serverhost=talk.google.com username=username@gmail.com/Talk secret=account_password priority=1 port=5222 usetls=yes usesasl=yes status=Available statusmessage="I am an Asterisk Server" timeout=100 keepalive=yes
The settings in the general context are just preferences that can be set differently if you prefer, but they’re not what we’re really concerned about. The main thing is the username context, and again, you should replace username with the part of the Gmail address before the @ sign. Duplicate the username context as often as you need to for each Google Voice user you have, and be sure you change the context name, username, and secret for each additional context.
Finally there are the additions to /etc/asterisk/extensions_custom.conf. We will need to add at least two contexts to that file. The first handles inbound calls from Google Voice. You only need ONE of these no matter how many Google Voice users you have, but you have a choice between two contexts. Remember that at the start of this article I said you had to decide whether you want to answer the call as soon as it comes into your system, or defer answering until a destination extension picks up. Well, if you decided to let Asterisk answer the call as soon at it arrives, then you’ll need to add this context:
[googlein]
exten => _[0-9a-z].,1,Noop(Incoming Google Voice call for ${EXTEN})
exten => _[0-9a-z].,n,Set(CALLERID(name)=${CUT(CALLERID(name),@,1)})
exten => _[0-9a-z].,n,GotoIf($["${CALLERID(name):0:2}" != "+1"]?notrim)
exten => _[0-9a-z].,n,Set(CALLERID(name)=${CALLERID(name):2})
exten => _[0-9a-z].,n(notrim),Set(CALLERID(number)=${CALLERID(name)})
exten => _[0-9a-z].,n,Wait(1)
exten => _[0-9a-z].,n,Answer
exten => _[0-9a-z].,n,Wait(1)
exten => _[0-9a-z].,n,SendDTMF(1)
exten => _[0-9a-z].,n,Goto(from-trunk,gv-incoming-${CUT(EXTEN,@,1)},1)
exten => h,1,Macro(hangupcall,)
BUT if you want to defer answering until a destination extension picks up, then you’ll want to use this context instead:
[googlein]
exten => _[0-9a-z].,1,Noop(Incoming Google Voice call for ${EXTEN})
exten => _[0-9a-z].,n,Set(CALLERID(name)=${CUT(CALLERID(name),@,1)})
exten => _[0-9a-z].,n,GotoIf($["${CALLERID(name):0:2}" != "+1"]?notrim)
exten => _[0-9a-z].,n,Set(CALLERID(name)=${CALLERID(name):2})
exten => _[0-9a-z].,n(notrim),Set(CALLERID(number)=${CALLERID(name)})
exten => _[0-9a-z].,n,Set(DIAL_OPTIONS=${DIAL_OPTIONS}aD(:1))
exten => _[0-9a-z].,n,Goto(from-trunk,gv-incoming-${CUT(EXTEN,@,1)},1)
exten => h,1,Macro(hangupcall,)
DON’T USE BOTH OF THOSE! Pick one or the other. That will take care of your incoming calls (except for your FreePBX configuration, which we’ll talk about in a second). EDIT: Note that if you use the beta BASH shell script I mentioned above, it will generate a separate inbound context for each of your Google Voice accounts, which means that you can defer answering until the extension picks up on some of your accounts, but answer the call as soon as it arrives on your system with other accounts. The contexts above don’t give you that flexibility — you have to pick one method or the other for all your accounts (unless you know what you’re doing and can make the necessary tweaks yourself). Also note that there was an error in the above contexts prior to February 5, 2011 – where you see _[0-9a-z]. I was using _[@Xa-z]. which is wrong (and which I had seen in a post on a forum somewhere), but which would still work with any Gmail address that doesn’t begin with a number. The _[0-9a-z]. will work with any Gmail address that begins with a lowercase letter or a digit, and I’ve never seen a Gmail address with uppercase characters. Thanks to voipRookie for pointing this out in the comments.
Now, for OUTGOING calls, you’ll unfortunately need to add a separate context added to /etc/asterisk/extensions_custom.conf for each user (it’s just easier that way). Fortunately they are short — each context should look like this:
[gvoice-username]
exten => _X.,1,Dial(Gtalk/username/+${EXTEN}@voice.google.com)
exten => _X.,n,Noop(GVoice Call to ${EXTEN} failed)
exten => h,1,Macro(hangupcall,)
Once again you need to replace both instances of username (including in the context name [gvoice-username]) with the part of the Gmail address before the @ sign. Don’t leave out the “Noop” line — it’s important that there be at least one line (not including the hangup context) after the Dial line, otherwise unpredictable things might happen. Don’t forget to save your changes to extensions_custom.conf, and be happy — the hard part is over!
Now for the FreePBX configuration. Inbound calls will come in on inbound routes, the same as calls from DID’s or VoIP providers. The only difference is that instead of specifying a DID number, you’ll use gv-incoming-username as the DID, with the usual substitution for username. FreePBX will give you a hard time about it when you try to save it:
Just click OK and you should be fine. If you’d prefer to use the Google Voice phone number(s) for your DID(s), I’ll tell you how you can do that at the end of this article, but I suggest you get at least one Google Voice number working the way I’ve shown here so you know that it works (it will be easy to change the DID later).
For outgoing calls, you’ll need to create a CUSTOM Trunk for each Google Voice user. Click on Trunks, then Add Trunk, then Add Custom Trunk. For the Trunk Name, use anything you like that makes sense to you, but I suggest including the username in the trunk name so you can keep the trunks straight if you have more than one account. For the Dialed Number Manipulation Rules, put a 1 before the + (first field), and NXXNXXXXXX in the last field (leave the middle one blank). For the Custom Dial String, use local/$OUTNUM$@gvoice-username (substituting for username as we have done previously). Remember that the gvoice-username part must match an outgoing context you previously created in /etc/asterisk/extensions_custom.conf (it looked like [gvoice-username] in the above instructions).
After you’ve created your trunk(s), just use them as you would any trunk. If you only want a particular user to have access to a particular Google Voice trunk, then set up an Outbound Route specifically for that user and make that trunk the first (or only) trunk selection. Keep in mind that you can restrict an Outbound Route to a particular extension (or group of extensions) by utilizing the fourth field of the “Dial Patterns that will use this Route” section — see A couple tidbits for Asterisk and FreePBX users for more information. Any such “restricted” Outbound Routes must be above (higher in priority than) any other routes containing the same or similar dial patterns but no extension restrictions.
One final thing you will need to do in order to make this work is to go to the Asterisk CLI and issue one of the following commands: core restart now or, if you think there might be calls in progress, core restart when convenient — the latter will wait until there are no calls in progress. This is necessary to load the Gtalk configuration into Asterisk — for some reason an “orange bar reload” in FreePBX doesn’t do it.
Hopefully, if you do all that, it will work for you. If it doesn’t, check to see if you’ve missed any steps. The only thing I ask is that you don’t try to mix up my instructions with something you found on some other site, then come asking for help if it doesn’t work. It probably won’t work if you do it that way.
ADDENDUM: I suppose that some people would prefer to use the Google Voice number as the DID, rather than gv-incoming-username, if only to stop FreePBX from complaining every time you make a change to an inbound route. If that’s your desire, it’s easy to accomplish. Just change one line in your [googlein] context in extensions_custom.conf, as follows:
Change this line:
exten => _[0-9a-z].,n,Goto(from-trunk,gv-incoming-${CUT(EXTEN,@,1)},1)
to this:
exten => _[0-9a-z].,n,Goto(from-google-voice,${CUT(EXTEN,@,1)},1)
Next, underneath the end of the [googlein] context, create a new context called [from-google-voice] and put one line it it for each Google Voice account you have, followed by a hangup context as shown below:
[from-google-voice] exten => username1,1,Goto(from-trunk,gvnumber1,1) exten => username2,1,Goto(from-trunk,gvnumber2,1) exten => username3,1,Goto(from-trunk,gvnumber3,1) exten => h,1,Macro(hangupcall,)
Replace username1, username2, username3, etc. with the part of the Gmail address before the @ sign. Replace gvnumber1, gvnumber2, gvnumber3, etc. with the ten digit Google Voice number associated with the account. Of course, you would use as many lines as you have accounts (which, unless you’re doing something unusual, would be the same as the number of user accounts you have enabled in jabber.conf). Save your changes, go to your inbound routes and change the DID(s) for each Google Voice account to the associated ten digit Google Voice number, and you’re all set — no more complaints from FreePBX!




zanophol said
Wow…I wish you had written this about a month ago. I could have saved a great many hours, but I probably would not have learned as much. Great article that will save some newbies (I am only a half-newbie now) much time.
mavis said
Can you get things configured without FreePBX? I’m happy just to have google voice and asterisk talking to each other – other than configuration, I don’t need the rest of the GUI.
michigantelephone said
Well, of course you CAN – if FreePBX can do it then it CAN be done in Asterisk without FreePBX. FreePBX is simply a GUI and an Asterisk dial plan writer, at the most basic level.
Oh, were you perchance asking if I could or would do it? Are you kidding? If you want to torture yourself by running bare Asterisk without any kind of GUI, be my guest – that probably means you’re either a lot smarter, or a lot more patient (or perhaps both) than I am. But you’re going to have to put some of that superior brain power or extraordinary patience to use as you try to figure out how to make this work in bare-metal Asterisk (unless, of course, you can find someone else who’s done it via a Google search).
Or, you know, you could just install FreePBX and have everything up and working in a few hours. It’s entirely up to you. Some people just love to write entire Asterisk dial plans by hand, and I would not dream of denying them that joy, but it’s not an activity I’d ever care to engage in.
mavis said
Thanks for the reply – I guess I should have been more clear. I am a newbie to all of this and just simply wanted to use my old ATA with google voice, running asterisk on my mac mini server, for which this article has been very helpful. Installing asterisk was easy on my mac but FreePBX gave me one too many problems and I gave up.
What I really meant by my question was whether any of the actual functionality of asterisk relied on freePBX, because I didn’t want to continue with the torture of trying to install FreePBX if I didn’t need to. I ended up installing the Increcible PBX and taking all the /etc/asterisk files from that and copying them to my mac installation of asterisk. Everything is working great! Thanks again.
ed said
thanks for this guide, it helped out a ton,
I can receive calls but I can’t make any…. any ideas?
michigantelephone said
Did you restart Asterisk after making all your changes? Go to the CLI and enter this:
jabber show connections
If your account isn’t listed with the word “Connected” after it then either something is wrong with your configuration, or you need to restart Asterisk so it will attempt to register (Asterisk doesn’t seem to see changes in jaber.conf until you restart Asterisk, as mentioned in the article). It used to be that sometimes you had to run “jabber test <connection>” from the CLI to keep things working, but that’s no longer necessary if you have there latest version of Asterisk. Which is one other thing to check – from the CLI do “core show version” and make absolutely sure you have Asterisk 1.8.1.1 or better yet, 1.8.2-rc1. If you don’t have one of those two versions, it isn’t going to work until you upgrade Asterisk!
michigantelephone said
mavis, I’m not sure what would make you think that FreePBX could be run on a Mac Mini (unless maybe you were running Linux rather than OS X). FreePBX works best under CentOS Linux, but can be coaxed to work under Ubuntu/Debian with a little effort, and under some more esoteric versions of Linux with considerable effort (such as the efforts to make it run on some very low power devices). But I’ve never heard of anyone successfully getting it to run under OS X (now watch someone come along and say they did it — and if they do, I’m not going to believe it unless they can point me to the posted instructions they used to make it happen. One of my pet peeves is guys who haunt online forums and claim they did this or that, but who are never willing to share their code or their technique. Talk is cheap).
ed said
thanks for the insight.
When I put in “jabber show connections” into the asterisk cli I get an error stating
No such command ‘jabber show connections’ (type ‘core show help jabber show connections’ for other possible commands
I’m running Asterisk 1.8.1.1
This is puzzling, I’m pretty sure I have jabber installed as I can receive calls…
ed said
ok last thing, oops i just tried the command
Jabber test connection and got this:
Unable to find client ”!
Command ‘jabber test ‘ failed.
I’ll google around and find out why jabber can’t find the client.
I did reboot asterisk btw… anyways, Thanks!
michigantelephone said
Almost sounds like maybe your jabber module didn’t get installed correctly? Reread the article, especially the part about “make menuselect” and make sure that chan_gtalk, chan_jingle, and res_jabber are all enabled. I do agree that it’s strange that you can receive and not make calls. But if the jabber commands aren’t working from the CLI, I’d take that as an indication that perhaps Jabber isn’t working either, so check with “make menuselect” and see if it shows those modules as installed.
ed said
i checked and verified all the modules are installed. i’m reinstalling asterisk 1.8.1.1 and see i get better luck. We’ll see. Thanks for the advice.
ed said
still no luck at all.. when i test connection it fails. I’m out of ideas lol
“Unable to find client ”!
Command ‘jabber test ‘ failed.” is the error
michigantelephone said
The ONLY other thing I can think of is a permissions or file ownership issue (the modules exist but have the wrong permissions or ownership). That will sometimes cause the type of error you’re encountering, where everything appears to be in place and yet when you go to use it, Asterisk acts as though it isn’t there. That SHOULD not happen if Asterisk originally built the modules and you were running as root (or used sudo) during the installation, but who knows?
Plan B: Get a copy of the so-called “Incredible PBX” and install it (select the “purple” edition from the installation menu). It will completely wipe your hard drive and then install CentOS, Asterisk, and FreePBX, plus some other pieces of both useful and useless software, and it will do some things that ultimately you may decide you don’t like, but when it finishes you should have a working installation that will let you make and receive Google Voice calls. I tend to recommend this only as a last resort because I just tend to disagree with the way they have done certain things, but that’s probably in part because I’ve been running FreePBX and Asterisk for so long that I know exactly what I want and what I don’t want, and there are a few things in that distribution I know I don’t want. If you’re just starting out, however, it’s a great way to get your feet wet, and to get a system that will work. Once you learn enough, you can go through and pull out or reduce some of the unnecessary waits in their configurations, so that your calls will go through faster.
Other than those, I have no other suggestions for you.
ed said
thanks, but going to PIAF is a complete no no. i mean, you got what i need about 90% i can receive calls just fine. I’ll continue to google around and see what I can do man. I might even install 1.8.2 RCL
Thanks again!!
michigantelephone said
ed, when you figure it out, I hope you will come back and tell us what the issue was, so that we may all learn from the experience.
ed said
I GOT IT TO WORK!! THANK YOU
As presumed, the error was caused by the user (me)
Where it says user in jabber.conf i did not change the first line to my google username i just left it username!!!! THANKS!!!
IT WORKS IM SO HAPPY WORKED ON IT ALL WEEKEND AND I COULDN’T DO IT WITHOUT YOU!!
[username]
type=client
serverhost=talk.google.com
username=username@gmail.com/Talk
secret=account_password
port=5222
usetls=yes
usesasl=yes
status=Available
statusmessage=”I am an Asterisk Server”
timeout=100
keepalive=yes
michigantelephone said
Glad to hear you got it working, ed! I’ve attempted to clarify in the instructions that you do need to change the context name also, so hopefully no one else will have to struggle with this. But I do know the frustration of overlooking one little thing and then wondering why something doesn’t work, so I guess the takeaway is that when things don’t work, sometimes it’s best to go back and make sure you followed the instructions completely (and that comment is not specifically directed at you, ed, as I’m sure you’ve already learned that from this experience – it’s directed at anyone else in a similar situation that may be wondering why it’s not working).
davidrol said
I followed the above instructions to success. An easy-to-follow and comprehensive write-up. Thank you! Inbound could use a tweak: GV rings my extensions on the 3rd ring – leaving me two-rings to answer before going to voicemail.
Is there a way to shorten the time between when a call initiates and when my PBX actually receives it as an inbound call.
Again, thank you. Your contribution has been very helpful.
Regards ~D
michigantelephone said
davidrol, I am surprised it takes three rings — on my system there’s usually a one ring delay, however I am answering the call as it comes in. So callers typically hear one ring from Google Voice, then a short bit of silence, then after the call is answered they hear ringing from Asterisk. I have a feeling it may have something to do with whatever CLEC Google Voice is using for call completion to your chosen Google Voice number — some CLECs make the PSTN to SIP transition much faster than others, it seems. The only other thing I can suggest is to be aware of what happens to your call after it hits your inbound route — try temporarily turning off any FAX detection and/or Caller ID lookup you may have enabled, and see if that makes a difference. If you are using the Caller ID Superfecta, for example, be aware that a couple of their lookup sources are pretty slow (which is the fault of the lookup source, or possibly your Internet connection) and you probably don’t want to use those slower sources (I’d also limit maximum lookup time to 2 seconds). Your extension won’t start ringing until any Caller ID lookups have completed.
The way to know where the problem lies is to watch the CLI as you call your Google Voice number, and note when you first see activity related to the call vs. when your extension starts ringing. If it takes a long time to see activity and your extension rings almost immediately thereafter, there’s probably not much you can do. But if you see activity early on and then it takes quite some time before the extension starts ringing, look at the things I mentioned above.
davidrol said
Wonderful, Wonderful! I followed your tip regarding the CID Superfecta setup, removed 4-lookup sources and adjusted the timeout to 1 second. My findings are that the number of lookups caused the delay.
Thanks so much for the prompt response/solution.
Best Regards, ~D
Anonymous said
Would it be mostly acceptable to use PIAX-purple as a base? Without installing The Incredible PBX, and following your instructions from there?
This is what ive done, but there seems to be a lot of nasty preconfiguration that may conflict. Also, im a linux moron, and cant seem to execute menuselect since its already made. But I would assume PIAX-purple would have everything you need for this already installed
michigantelephone said
I assume you mean PBX in a Flash purple, and yes, this should work with that provided the version of Asterisk they include is 1.8.1.1 or later — if not you’ll have to upgrade it, as the article says. All the drivers you need should already be installed (I would think) so unless they are giving you an old version of Asterisk (which you can check using core show version from the asterisk CLI) you should be all set to start working with the configuration files. My understanding is that when you install PBX in a Flash they pull in the most recent version of Asterisk, but I may be wrong about that. If you find any preconfiguration that conflicts, just copy the existing file to a backup and then if necessary you can erase any conflicting settings or contexts (if you mess up, copy the original file back).
Regarding “make menuselect”, you have to be in the Asterisk source directory when you run that, and it may be that PBX in a Flash doesn’t give you source, but that’s okay as long as the necessary modules are present, and I’m pretty sure they are. Just skip that part and go on with configuration.
By the way – if you are truly inexperienced with Linux, you may want to know that there is a dual-pane file manager called “Midnight Commander” that you can get to by typing mc at a command prompt (if it’s not installed, you may have to do yum install mc first). It’s similar to the old Norton Commander, Total Commander, etc. and makes it a bit easier to find and edit files, do things like changing permissions and ownership, etc. Plus, it has a built-in editor that works great for making small edits to text and configuration files.
michigantelephone said
In case anyone is following this post, I just want to call your attention to the new addendum at the bottom of the article. If you’d rather use the ten digit Google Voice numbers as your DID in your inbound routes (instead of gv-incoming-username), the addendum tells you what to change to make that possible.
jbrukardt said
Hi michigantelecom. We’ve had a few interactions over on the PIAF forums, where you were very helpful, regarding both what your article above discusses, and some virtualization problems. I just wanted to thank you for all your help thus far, and wondered if as a seeming voice of reason, you could take a look at my continuing problem: http://pbxinaflash.com/forum/showthread.php?t=9241
The attitude of some others is unfortunately bit hostile sometimes.
michigantelephone said
jbrukardt, tell me about attitude — but in all fairness, it’s not confined to the PiaF community. I see a lot of it in almost all of the various projects having to do with VoIP telephony. Either that, or (NOT talking about PiaF here) they make someone who’s not very knowledgeable a forum moderator, and that person proceeds to give out a lot of nonsense advice (such folks exist in other forums, but they usually don’t make them moderators).
Anyway, I don’t know if you’ll stop back here, but in case you do, I’ll say something that it would not be appropriate to say in the PiaF forums, and that is that sometimes attempting to use PiaF can be an exercise in frustration for some people. I sometimes read their forums and occasionally try to help people out, but on the occasions where I’ve actually tried to use PiaF, I’ve always wound up wiping it out and going with a different distribution. I’m not saying it isn’t right for anyone; it’s quite obvious that they have a number of users who more or less love it, but I’ve just not been able to get it to work the way I wanted it to. In both cases, installing a different FreePBX-based distribution cured the majority of the issues I’d been having. I’m not going to go into the reasons I didn’t like/couldn’t use PiaF, because they may not be (probably aren’t) applicable to everyone. And let’s face it, a lot of people would never have gotten their feet wet with Asterisk and FreePBX had it not been for PiaF. But still, as I’ve alluded to in the past, they do a lot of things that make me wonder “why???” (one of my pet peeves with that project is wasteful code that just eats CPU cycles, and even worse, the excessive use of the Asterisk “Wait” statement. They’ve had a tendency to use “Wait” where it either isn’t needed at all, or is only needed for one second but they’ll insert a two or three second wait, presumably because everyone likes a couple extra seconds of contemplation while waiting for a call to go through, and callers just love being delayed a little bit longer prior to being connected to the person they’re calling).
Unfortunately, however, at this time (January 2011) PiaF is the only distribution that gives you the option of installing Asterisk 1.8, and you need Asterisk 1.8 to really make Google Voice work properly. So you either have to use PiaF, or you can do what I did and use another distribution but upgrade Asterisk to the 1.8 branch. And doing that is not something I’d recommend for a beginner (though it’s a lot easier now than it would have been with previous versions).
What I really wish was that there were a great online community for Asterisk and FreePBX users, but without the know-it-alls and the people who insist you have to do things their way, or spend money you probably don’t have, or use a particular piece of software instead of the one you know how to use, or already have available. We could also do without those who think it’s appropriate to blow off someone asking for help with an “RTFM” or “F…ing Google it!” type response (if all you can do is throw documentation at someone asking a question, go throw yourself in a lake instead — it would be a lot more productive for both of you). It’s probably wishful thinking on my part, but if about five or ten people would just leave the various VoIP-related forums and never post again (and no other a—holes came along to take their place), not only would the forums be much friendlier places, but I think a lot of others who actually know what they are doing would be more inclined to participate.
Over the past few years I’ve seen several knowledgeable people who could have contributed a lot to a project (and I’m speaking of people who actually know how to write decent code) chased out by people who can barely program “Hello, World” but fancy themselves as knowledgeable coders (and only manage to pull off that deception because the only other people willing to stick around in the forums are primarily those who don’t know how to code at all, and therefore are impressed by any idiot that can write a DO loop).
But to get back to the topic at hand, I have a sneaking suspicion that many of the problems you’ve experienced would go away if you had the ability to install a different FreePBX/Asterisk-based distribution and then upgrade Asterisk to version 1.8, and then set up your own Google Voice configuration using the instructions in this article. It seems to me that something is getting hosed during your installs, and it may be an incompatibility between your hardware and PiaF, or it may be some other issue. Again, I can only tell you that in my own personal experience, the two times I’ve attempted to use PiaF I wound up dumping it, mostly because of weird problems that magically disappeared upon installing a different distribution. But again, I must point out that many other people seem perfectly happy with PiaF, and I cannot explain why it seems to work well for some and not for others.
Ultimately, I keep hoping that someday one of the GUI’s for FreeSWITCH will be as well developed as FreePBX — I’d really like to try a FreeSWITCH-based distribution someday, but I’m just not going to write dialplan by hand in XML, and the currently-available GUI’s just aren’t mature (even if I could figure out how to use one of them, they aren’t nearly as functional as FreePBX — but I keep hoping that will change).
michigantelephone said
For anyone tracking comments on this article, I’ve made a small change in the [googlein] context to correct a bug in the Caller ID display when handling incoming calls that are either anonymous, or from a country not in the North American Numbering Plan area. See A small fix for “How to use Google Voice for free calls on an Asterisk 1.8+/FreePBX 2.8 system (the easy way)” for additional information.
Jues Wat said
I want my client use google talk call to my sip , do you have this installation service?
michigantelephone said
I want my commenters use meaningful English post to my blog , do you have this translation service?
(Sorry, but I get really annoyed when people write nonsense and expect me to decipher it just because English isn’t their native language. Maybe i shouldn’t, but I do.)
sean said
hi, its me again to talk about this. Obviously something I’m doing is cauing this to fail but I’m not certain since I’m now using your script.
I briefly had this working and then it quit. I want a DID to act as a conference number so I made an incoming route with the gv# and set it to the conference. The number rings for only gv even when the inbound route is set to my extension. I used the script you now created to prevent any typos on my end but I can’t dial out, either.I get a message: “all circuits are busy. please try your call later” Error message in the log is
channel.c: No channel type registered for ‘Gtalk’ and right before that: WARNING[17498] app_dial.c: Unable to create channel of type ‘Gtalk’ (cause 66 – Channel not implemented)
I searched a little and this is indicative of drivers not installed but the make menuconfig shows chan_gtalk, chan_jingle, and res_jabber to be installed.
http://tinypic.com/r/b651g4/7
here is jabber info:
[general]
debug=no
autoprune=no
autoregister=yes
[username]
type=client
serverhost=talk.google.com
username=@gmail.com/Talk
secret=
port=5222
usetls=yes
usesasl=yes
status=Available
statusmessage=”No Information Available”
timeout=100
keepalive=yes
[googlein]
exten =>
username@gmail.com,1,Set(CALLERID(name)=${CUT(CALLERID(name),@,1)})
exten => username@gmail.com,n,GotoIf($["${CALLERID(name):0:2}"
!= "+1"]?notrim)
exten =>
username@gmail.com,n,Set(CALLERID(name)=${CALLERID(name):2})
exten =>
username@gmail.com,n(notrim),Set(CALLERID(number)=${CALLERID(name)})
exten => username@gmail.com,n,Answer
exten => username@gmail.com,n,Wait(1)
exten => username@gmail.com,n,SendDTMF(1)
exten => username@gmail.com,n,Goto(from-trunk,5045345203,1)
exten => h,1,Macro(hangupcall,)
[gvoice-username]
exten => _X.,1,Dial(Gtalk/username/+${EXTEN}@voice.google.com)
exten => _X.,n,Noop(GVoice Call to ${EXTEN} failed)
exten => h,1,Macro(hangupcall,)
so as you can see, the script did a pretty good job creating everything correctly but it still won’t act as a did or outgoing number.
Can you explain what the purpose of creating the dialplan in the trunk is for? Does it mean you would dial a 1 if you want to use the gv#?
The most interesting thing so far is that it WAS working and now nothing at all.
[root@asterisx modules]# locate res_jabber.so
/usr/lib/asterisk/modules/res_jabber.so
/usr/src/asterisk-1.8.2/res/res_jabber.so
[root@asterisx modules]# locate chan_gtalk.so
/usr/lib/asterisk/modules/chan_gtalk.so
/usr/src/asterisk-1.8.2/channels/chan_gtalk.so
But when I do module show like gtalk & module show like jabber always reports: 0 modules loaded is the asterisk command line.
using asterisk 1.8.2 on freepbx 2.8.0 and centos 5.5 final
michigantelephone said
sean: From the error messages you’re reporting I’m starting to think your installation is hosed, however if you think it’s a problem with my script feel free to try one of the other methods (note it says in that article that if you use it you get to be a beta tester!). But realistically I’m wondering if either something’s going wrong during your initial installations or if maybe you’re having a hardware issue (bad memory, perhaps? Fried capacitors on the motherboard?). The reason for the dialplan in the trunk is so that if you allow ten digit numbers to pass through your route, the trunk will prepend the “1″ that Google Voice requires (they also require a plus sign, but the [gvoice-username] context adds that). So you can dial either an 11 digit number starting with “1″ (in which case the trunk dial rule doesn’t apply) or a 10 digit number, assuming your routes are set up to allow that.
Unfortunately, I’m now going to exercise my prerogative to stand by the statement in my comment policy: “I am not your technical support.” I suggest that from here on out, until you figure out what is wrong with your system, that you not be trying to apply add-ons from my site (or any other site, for that matter). It’s not that I don’t want this to work for you, but there are hundreds of reasons it might not be working, from the things I mentioned above to something neither of us has considered yet, and without being able to get my hands on your system (which I wouldn’t want to do anyway) there is no way I can tell what is wrong. I can’t tell you how many times I’ve tried scripts or programs posted on other sites and while they apparently worked great for the original author, they wouldn’t work for me. In a few cases I finally figured out what the problem was (and it was usually something stupid like a permissions or ownership error, or the program looking for a dependency in the wrong place or something) but in a great number of other cases it never did work right. I don’t think any piece of software every made has run perfectly for everyone that’s attempted to use it.
You could always try installing the “Incredible PBX” (again?) and see if it will work for you (http://incrediblepbx.com/) — I’m not crazy about how they do Google Voice (too many “waits” for my taste) but if you can’t get it working at all with what you have now, and installing that will make it work, then at least you’re ahead of the game. And if even THAT won’t work for you, that’s a pretty good indication that it might be time to start looking for some different hardware.
sean said
I posted it on this blog because it was discussing google voice in more detail than the one on discussion of the script you made.
I don’t think the script is wrong at all and in fact, I’m glad you made it because looking at old configurations I initially did, I missed a couple things. I also don’t blame you for not wanting to diagnose my personal issue as your own issue, but feel free to pass along any other forums or blogs with similar issues as mine. Also, reporting the problem may help other readers of your blog realize possible mistakes they make.
It is entirely possible my freepbx install is hosed, BUT it does seem like everything else works without any issue. Quite frankly I’m willing to rule the hardware out right now and look at this only as a freepbx/asterisk issue. The server is a dell poweredge 1850 and seems to do everything else quite fine.
So I have a couple things I may try:
-install freepbx in a box on another machine
-re-install oS & freepbx over again on the 1850
-install os, freepbx, and asterisk on a different machine
-don’t worry about accumulating DIDs
thanks for everything
Greg Franklin said
michigantelephone –
Hello. Thanks for the article. I have gotten my asterisk and GV to work properly for the most part. The place I am getting stuck is making this work with multiple GV accounts.
I have 2 accounts registered to my asterisk box. Inbound calls are working perfectly, but when i try to call outbound from the new second line, it still rings with my primary line. I can’t get it to make outbound calls with my secondary line.
any help would be appreciated. I have added two entries of:
[gvoice-xxxxxxx]
exten => _X.,1,Dial(Gtalk/xxxxxxx/+${EXTEN}@voice.google.com)
exten => _X.,n,Noop(GVoice Call to ${EXTEN} failed)
exten => h,1,Macro(hangupcall,)
to the extenstions_custom.conf file. I have also setup the trunk, inbound and outbound routes the way it is stated. Is this all that i need to do for the outbound part. I have added your addendum part to the ext.cnf file too, utilizing the DID instead of the callers name.
Any help would be appreciated.
thanks,
Greg
How To: Use Google Voice and OBi for all your calls (free) said
[...] guides online that help the adventurous set up Asterisk/FreePBX and Google Voice from scratch (one of the best is published by the excellent Michigan Telephone blog). Be forewarned: This is not for the typical [...]
michigantelephone said
Greg, in case you haven’t already figured it out, your outbound routes that are extension-specific (that specify an extension or extension pattern in the fourth field of each dial pattern) need to be higher in priority than any routes with similar dial patterns that do not specify an extension or extension pattern.
Gregory Gleason said
Dear Sir,
Thank you for this. I had initially tried this using the incredible pbx, and got frustrated at the amount of bloat, not to mention a huge delay from the time that I saw jabber stuff happening to the time that it actually ran my extensions.
I saw this, then, and started over with a minimal centos5.5 system, installing asterisk from source with freepbx. FreePBX took the longest for me, but I got a nice base installation with no bloat, and your write-up was outstanding.
The only issue I had is that the FreePBX GUI didn’t allow enough characters for the custom trunk dial string, as my gvoice account name for this is very obscure (30 characters). I ended up changing changing the context name in extensions_custom.conf to something that would fit in the custom dial string field in FreePBX.
I highly doubt anyone else would run into this as they probably aren’t using such huge google account usernames, but I thought I’d share.
Again, thank you. Your work is very much appreciated.
-Gregory
sean said
Nice going on isolating the issue, Gregory.
My update is now that I can call OUT on at least one of the numbers when when I call in from a completely separate number, the trunk fails.
[root@asterisx ~]# asterisk -rvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Verbosity is at least 44
== Starting Gtalk/+xxxxxxxxxx-bf3a at googlein,x@gmail.com,1 failed so falling back to exten ‘s’
== Starting Gtalk/+xxxxxxxxxx-bf3a at googlein,s,1 still failed so falling back to context ‘default’
— Executing [s@default:1] Playback(“Gtalk/+xxxxxxxxxx-bf3a”, “vm-goodbye”) in new stack
— Playing ‘vm-goodbye.ulaw’ (language ‘en’)
— Executing [s@default:2] Macro(“Gtalk/+xxxxxxxxxx-bf3a”, “hangupcall”) in new stack
— Executing [s@macro-hangupcall:1] GotoIf(“Gtalk/+xxxxxxxxxx-bf3a”, “1?skiprg”) in new stack
— Goto (macro-hangupcall,s,4)
— Executing [s@macro-hangupcall:4] GotoIf(“Gtalk/+xxxxxxxxxx-bf3a”, “1?skipblkvm”) in new stack
— Goto (macro-hangupcall,s,7)
— Executing [s@macro-hangupcall:7] GotoIf(“Gtalk/+xxxxxxxxxx-bf3a”, “1?theend”) in new stack
— Goto (macro-hangupcall,s,9)
— Executing [s@macro-hangupcall:9] Hangup(“Gtalk/+xxxxxxxxxx-bf3a”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 9) exited non-zero on ‘Gtalk/+xxxxxxxxxx-bf3a’ in macro ‘hangupcall’
== Spawn extension (default, s, 2) exited non-zero on ‘Gtalk/+xxxxxxxxxx-bf3a’
— Executing [h@default:1] Macro(“Gtalk/+xxxxxxxxxx-bf3a”, “hangupcall,”) in new stack
— Executing [s@macro-hangupcall:1] GotoIf(“Gtalk/+xxxxxxxxxx-bf3a”, “1?skiprg”) in new stack
— Goto (macro-hangupcall,s,4)
— Executing [s@macro-hangupcall:4] GotoIf(“Gtalk/+xxxxxxxxxx-bf3a”, “1?skipblkvm”) in new stack
— Goto (macro-hangupcall,s,7)
— Executing [s@macro-hangupcall:7] GotoIf(“Gtalk/+xxxxxxxxxx-bf3a”, “1?theend”) in new stack
— Goto (macro-hangupcall,s,9)
— Executing [s@macro-hangupcall:9] Hangup(“Gtalk/+xxxxxxxxxx-bf3a”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 9) exited non-zero on ‘Gtalk/+xxxxxxxxxx-bf3a’ in macro ‘hangupcall’
== Spawn extension (default, h, 1) exited non-zero on ‘Gtalk/+xxxxxxxxxx-bf3a’
jabber.conf
[general]
debug=no
autoprune=no
autoregister=yes
[x]
type=client
serverhost=talk.google.com
username=x@gmail.com/Talk
secret=[redacted by moderator]
port=5222
usetls=yes
usesasl=yes
status=Available
statusmessage=”No Information Available”
timeout=100
keepalive=yes
gtalk.conf
[general]
allowguest=yes
context=googlein
stunaddr=stun01.sipphone.com
[guest]
disallow=all
allow=ulaw
connection=asterisk
context=googlein
[googlein]
exten =>
x@gmail.com,1,Set(CALLERID(name)=${CUT(CALLERID(name),@,1)})
exten => x@gmail.com,n,GotoIf($["${CALLERID(name):0:2}"
!= "+1"]?notrim)
exten =>
x@gmail.com,n,Set(CALLERID(name)=${CALLERID(name):2})
exten =>
x@gmail.com,n(notrim),Set(CALLERID(number)=${CALLERID(name)})
exten => x@gmail.com,n,Answer
exten => x@gmail.com,n,Wait(1)
exten => x@gmail.com,n,SendDTMF(1)
exten => x@gmail.com,n,Goto(from-trunk,[redacted by moderator],1)
exten =>
gvoice-x]
exten => _X.,1,Dial(Gtalk/x/+${EXTEN}@voice.google.com)
exten => _X.,n,Noop(GVoice Call to ${EXTEN} failed)
exten => h,1,Macro(hangupcall,)
so it looks at least hopeful that the asterisk system sees the attempted call in and it can make out but now I just need to complete it. Since asterisk doesn’t answer the call, it just goes to google voicemail.
Greg Franklin said
michigantelephone said
January 29, 2011 @ 2:59 am
Greg, in case you haven’t already figured it out, your outbound routes that are extension-specific (that specify an extension or extension pattern in the fourth field of each dial pattern) need to be higher in priority than any routes with similar dial patterns that do not specify an extension or extension pattern.
Michigantelephone –
Im not sure I completely follow you. I did move my routes up and down to see how they worked out, and it would call out from whichever number is the first listed. Both of my outbound routes have the same dial plans.
1NXXNXXXXXX
1 NXXNXXXXXX
1765 NXXXXXX
Is there a way to make it so when I want to dial out from my work like, I preface it with a 9 or something, or a way to change my dial plans to make this work properly?
thanks again for everything. It is great having this setup.
sean said
Greg,
We are accomplishing the opposite things.
I am able to call out on three different numbers (gv1, gv2, and the voip #). for the GV accounts, I went into the dial plan of the outbound route and in the middle box added an 8 for one account and a 9 for the other. The last box has the regular 1NXXNXXXXXX.
So to use it I dial 8 1 and then the full number.
My NEW issue is I can’t get the routes to go to the correct location. One route is for wakeup calls and the other is supposed to go to a conference room but BOTH now go to the same place.
michigantelephone said
Greg, first see A couple tidbits for Asterisk and FreePBX users – hopefully that will explain what I’m talking about.
Greg Franklin said
sean said
January 30, 2011 @ 11:50 am
Greg,
We are accomplishing the opposite things.
I am able to call out on three different numbers (gv1, gv2, and the voip #). for the GV accounts, I went into the dial plan of the outbound route and in the middle box added an 8 for one account and a 9 for the other. The last box has the regular 1NXXNXXXXXX.
So to use it I dial 8 1 and then the full number.
My NEW issue is I can’t get the routes to go to the correct location. One route is for wakeup calls and the other is supposed to go to a conference room but BOTH now go to the same place
Sean –
So do you have outbound routes for each of your accounts? I am setup that way. I went into my work trunk, and made it look like this:
9 1NXXNXXXXXX
91 NXXNXXXXXX
91765 NXXXXXX
1NXXNXXXXXX
I’m not sure if I made that correctly, but if that works, i should be able to pickup any line registered to any extension, and dial 9 to dial out using my work trunk. The way I am setup now, ext. 1000 – 1001 are registered to my personal number, and ext. 1002 is registered to my home number, but for outbound, all that matters is how its prefaced?
I managed to get all the inbound working with this setup in my config files.
;google caling setup
[from-google]
exten => _[@Xa-z].,1,Noop(Incoming Google Voice call for ${EXTEN})
exten => _[@Xa-z].,n,Set(CALLERID(name)=${CUT(CALLERID(name),@,1)})
exten => _[@Xa-z].,n,GotoIf($["${CALLERID(name):0:2}" != "+1"]?notrim)
exten => _[@Xa-z].,n,Set(CALLERID(name)=${CALLERID(name):2})
exten => _[@Xa-z].,n(notrim),Set(CALLERID(number)=${CALLERID(name)})
exten => _[@Xa-z].,n,Set(DIAL_OPTIONS=${DIAL_OPTIONS}aD(:1))
exten => _[@Xa-z].,n,Goto(from-google-voice,${CUT(EXTEN,@,1)},1)
exten => h,1,Macro(hangupcall,)
[from-google-voice]
exten => user1,1,Goto(from-trunk,xxxxxxxxxx,1)
exten => user2,1,Goto(from-trunk,xxxxxxxxxx,1)
exten => h,1,Macro(hangupcall,)
[gvoice-user1]
exten => _X.,1,Dial(Gtalk/user1/+${EXTEN}@voice.google.com)
exten => _X.,n,Noop(GVoice Call to ${EXTEN} failed)
exten => h,1,Macro(hangupcall,)
[gvoice-user2]
exten => _X.,1,Dial(Gtalk/user2/+${EXTEN}@voice.google.com)
exten => _X.,n,Noop(GVoice Call to ${EXTEN} failed)
exten => h,1,Macro(hangupcall,)
Dishjuarez said
I can use this manual for use in elastix 2.0?…
voipRookie said
Wow you’re correct that this is “the easy way” compared to another method that was published and I was using! I’ve converted to your method and it works great.
However, I’m having a difficult time understanding your pattern matching string and was hoping you could enlighten me. If I’m following along correctly, your pattern matching string “_[@Xa-z].” is trying to match patterns of the form “username@gmail.com”.
I understand the leading ‘_’ signals that what follows is a pattern matching string and the trailing ‘.’ matches one or more characters no matter what they are.
It’s whats in the square brackets that has me confused. The square brackets signal to match a single character from the list of characters inside the square brackets. The list of characters is ‘@’, ‘X’, ‘a’ through ‘z’.
So the pattern matching string seems to match all strings whose first character is ‘@’ or ‘X’ or a lower case letter and then is followed by one or more characters.
This seems to match patterns that are not of the form “username@gmail.com”. What am I not understanding?
Thanks
michigantelephone said
voipRookie: Probably that the “X” stands for “any digit”, so you can match on names like “detroit187@gmail.com” or any other gmail address that contains one or more digits. Remember that we’re doing Asterisk pattern matching here, not Regular Expressions (which are another animal entirely).
I’ve never seen a Gmail address with uppercase letters, so no allowance is made for those.
Also, it doesn’t matter if it could match on non-email addresses, because none will ever get to this context. If the call gets here, unless something is very wrong, the value of $EXTEN will be some Gmail address and we just need to make sure we match it.
voipRookie said
michigantelephone: I thought based on the location of the square brackets in the pattern match string that they will only be used to match the first character of the name. So a name like “detroit87@gmail.com” would be matched by the a-z and not by the X. The X would catch a name like “57chevy@gmail.com”.
michigantelephone said
voipRookie: You’re right — I had taken the . (period) character to mean “one or more occurrences of the previous character” but in fact it actually means “wildcard, matches one or more characters” according to http://www.voip-info.org/wiki/view/Asterisk+Dialplan+Patterns — and in fact, the way I interpret that, the actual string bracketed string should be [0-9a-z] to match any gmail address, including those that might start with a number (such as your 57chevy example). I’m actually surprised no one caught this before; thanks for bringing it to my attention (even though it means I have to change a bunch of things now)!
I think you can stop calling yourself a “Rookie” now!
voipRookie said
michigantelephone: I was thinking a pattern match string of “_.@gmail[.]com” would match all possible gmail user names. I just don’t know how the “[.]” would be interpreted by asterisk. One possible interpretation would be match the ‘.’ character. Another interpretation could be match any character.
michigantelephone said
voipRookie: That comment earns you your “Rookie” designation back
(just kidding). _. is the pattern you should NEVER use in Asterisk (if you watch it compile a dial plan it will complain mightily if you use it) because it matches on ANYTHING — including, as the page I linked to in my previous comment points out, Asterisk special extensions like i, t, h, etc. So they always tell you to use something like _X. if your extension is numeric. But at this point it’s not, so we have to use _[0-9a-z]. which will match on any Gmail address starting with a letter or a number.
But you’re forgiven for thinking it’s okay to do that, because even the FreePBX developers used to do that before they figured out they shouldn’t!
voipRookie said
michigantelephone: The referenced link stated to never use the “_.” pattern since it matches every extension including the asterisk special extensions. I don’t understand how the “_.@gmail[.]com” pattern is equivalent to the “_.” pattern. The “_.@gmail[.]com” pattern should not match an asterisk special extension since the asterisk special extensions are single characters that don’t end with “@gmail.com”. Oh well, asterisk sure is supplying a lot of fun stuff to learn about and play with. Thank you for the time you spend on your blog I’ve learned a lot from reading it.
michigantelephone said
Oh, sorry, all I saw was _. and that’s because I know that the period character is a pattern end character (so is the exclamation point, btw). I don’t know what would happen if you put characters after the period, but I have never seen it done (and it’s one of those things that, even if it works the way you expect in one version of Asterisk, might not in another). So what I believe would happen if you used “_.@gmail[.]com” is that everything after the first period would be ignored. I’ve been bitten before by doing things the “wrong” way, where it still worked fine in most situations, but eventually something comes along and bites you in the Asterisk
(ask me how I spent yesterday — go ahead, I dare you
)
The pattern _[0-9a-z]. is shorter AND safer than _.@gmail[.]com, even IF the latter would actually work as you think it does, and we don’t know that it would (or always will). However, I think we’ve both learned a few things out of this exchange, so I much appreciate your input.
Greg Franklin said
all,
I am having some issues getting a Cisco 7961 phone sitting in a friends hose to properly register and receive inbound calls. It will make outbound calls properly, but when calling his gv number, it goes straight to voice mail after 8 or so rings. I have looked over his setup, he has all the ports forwarded to his phones IP address. I honestly dont know exactly what to look at next. The only thing that I see as a possible issue is where the asterisk info for the SIP extensions shows his phone on the same subnet as me.
2000/2000 192.168.1.115 D A 5060 Unmonitored
With the 7960 phones you have to set the extension to nat=no and qualify to = no.
thanks for the help, and from my previous issue I reread your article on dial plans and got it to work properly.
thanks,
Greg
sean said
Sorry but I don’t know much about the 7960, so if you’ve read to set nat=no, that’s more than I know.
Are you using freepbx? If you are, locate the module asterisk sip settings and have it auto config for the nat. It may be a good idea to sign up for a dyndns.org account and use a subdomain as opposed to an IP address if you’re doing this remotely.
What ports do you have open? Generally they need to point to the asterisk box.
I was having a very hard time getting gv to accept incoming calls but I found my error: not following directions / not understanding it the first dozen times I read them.
Read the extensions_custom.conf and make sure it has the appropriate code BEFORE the exten => h,1,Macro(hangupcall,)
what does the log show when you dial the GV number and it just keeps ringing and ringing?
Greg Franklin said
I have done so much testing, and brought the phone back to my house and done more testing. For some reason it wont receive inbound calls at all. I have also tried two different phones. I don’t know if the config file are limiting me, but I have added it below.
[from-google]
exten => _[@Xa-z].,1,Noop(Incoming Google Voice call for ${EXTEN})
exten => _[@Xa-z].,n,Set(CALLERID(name)=${CUT(CALLERID(name),@,1)})
exten => _[@Xa-z].,n,GotoIf($["${CALLERID(name):0:2}" != "+1"]?notrim)
exten => _[@Xa-z].,n,Set(CALLERID(name)=${CALLERID(name):2})
exten => _[@Xa-z].,n(notrim),Set(CALLERID(number)=${CALLERID(name)})
exten => _[@Xa-z].,n,Set(DIAL_OPTIONS=${DIAL_OPTIONS}aD(:1))
exten => _[@Xa-z].,n,Goto(from-google-voice,${CUT(EXTEN,@,1)},1)
exten => h,1,Macro(hangupcall,)
[from-google-voice]
exten => greg,1,Goto(from-trunk,aaaaaaaaaa,1)
exten => elisabeth,1,Goto(from-trunk,bbbbbbbbbb,1)
exten => sunny,1,Goto(from-trunk,cccccccccc,1)
exten => h,1,Macro(hangupcall,)
[gvoice-aaaa]
exten => _X.,1,Dial(Gtalk/aaaa/+${EXTEN}@voice.google.com)
exten => _X.,n,Noop(GVoice Call to ${EXTEN} failed)
exten => h,1,Macro(hangupcall,)
[gvoice-bbbb]
exten => _X.,1,Dial(Gtalk/bbbb/+${EXTEN}@voice.google.com)
exten => _X.,n,Noop(GVoice Call to ${EXTEN} failed)
exten => h,1,Macro(hangupcall,)
[gvoice-cccc]
exten => _X.,1,Dial(Gtalk/cccc/+${EXTEN}@voice.google.com)
exten => _X.,n,Noop(GVoice Call to ${EXTEN} failed)
exten => h,1,Macro(hangupcall,)
I have my Trunks and Routes setup looking exactly like one another. I can make and receive calls on aaaa and bbbb above, but not cccc.
The google voice accounts are setup the same. I am at a loss.
when I watch the call on asterisk, it shows it ringing through, and answered by GVoices voicemail. when i check the info on the FreePBX admin page it shows as answered.
I set the phone up to a different extention and it worked great. So my belief is that my current config file (extensions_custom.conf) is limited to only the 2 accounts. If anyone has other ideas that would be great.
Sorry, still a NOOB, but trying to learn it.
thanks,
Greg
michigantelephone said
Greg, I suggest you try the shell script. Not only does it offer more flexibility but it will help you avoid making mistakes, if you can cut and paste without attempting to second-guess the script and changing anything.
voipRookie said
Greg, Have you verified the /etc/asterisk/jabber.conf entry for username cccc is correct? In particular, the username and secret values.
voipRookie said
Greg, Another thought. I’m assuming that you have sanitized your configuration and cccc is not the real username. If the real username for cccc begins with a number then you might want to incorporate the modified pattern match string into your configuration (see the beginning of this blog for the modified pattern match string). I have mine working with three google voice numbers so I know it can be done.
hintss said
hey, so, to dial out, you add a line in extensions.conf that is just like the other lines, except it has a different extension, username, and says jabber instead of SIP, right?
and I’m trying to get inbound calls to go straight to a set of IVR menus. How would I do this?
and lastly, what is the difference between extensions.conf and extensions_custom.conf
michigantelephone said
hintss — The answer to your first question is “wrong.” To your second, in your Inbound Route you make the destination an IVR. And to your third, the difference is that (assuming you’re running FreePBX) extensions_custom.conf is where you have to make your changes if you don’t want them overwritten by FreePBX.
Don’t try to second-guess this – just follow the instructions in the article precisely (and if you can, use the shell script). If you don’t want to do that (or if you’re not running a FreePBX system) then these instructions probably won’t help you much.
Carlo said
Michigantelephone,
Many thanks for this. I used your script and it works great both for incoming and outgoing calls.
The only issue I have is when I set asterisk NOT to answer immediately and my incoming route points to a ring group instead of an extension. In these cases the phones in the ring group never ring and the caller hears a ring tone until the GV voicemails picks up. Have you encountered that?
Many thanks for your help.
Carlo
Barry said
Hello MT,
Thank You much for the very easy to read Asterisk, FreePBX, Google Voice walk through! Can’t believe for a rookie( I have tried asterisk in the past but finally gave up), my incoming and outgoing calls are working as expected on two GV accounts.
One question,,,(of course,,,ay),,,
For the second GV account I made a second trunk and of course a second outbound route for GV2 account. It rings out fine,and voice works as expected,,,but,,,the number shown on the receiving phone is that of GV1 phone number.
I DO have GV2 trunk chosen for GV2 outbound route in FreePBX.
Ideas?
I m sure you can pinpoint it.
Thanks Again,
Barry
michigantelephone said
EDIT: Irrelevant reply removed. I should never try to answer questions while talking on the phone to someone else at the same time — my mind does not multitask well!
michigantelephone said
Barry, the second outbound route is probably never being selected — remember that Asterisk will always use the FIRST matching dial pattern, so if you have two outbound routes and each selects a different trunk then only the first will be used. Typically you’d either use one outbound route with both trunks (so it would go to GV1 first, of if that’s busy then GV2) OR you would do what you’re doing but use the fourth field of the outbound route dial patterns to specify an extension (or pattern for a group of extensions) that can match on that pattern and therefore use that route and trunk. Either way, the Caller ID that the called party receives will be that of the Google Voice account that’s actually used to place the call.
Note that any extension-specific routes must be higher in priority than any routes with similar patterns but no extensions specified. And again remember, once a pattern has been matched on Asterisk will not look at any other patterns or routes, even if the call fails on that route. However, you can put the same trunk as a selection in multiple routes (in the same or different positions in the trunk list).
Carlo said
MT,
If that were the cause of the problem you would expect that (i) the phones in the ring group would ring but (ii) nothing would happen when one of the phones answered the call because asterisk forgot to send the DTMF “1″ back to GV. Instead the phones in the ring group don’t ring at all. Any thoughts?
Thank you.
Carlo
michigantelephone said
Okay, when you say it that way, that’s strange, and you are correct in your expectation of how that should play out. If I’m understanding you correctly now, you are saying is that in your inbound route, you can set the destination as an extension and it works, but if you then do nothing other than change the destination of the inbound route to a ring group, none of the extensions in the ring group ring. So my first question is, if you call the ring group directly from another extension, do the phones in the ring group ring? And are you saying that if you set it up so that Asterisk answers immediately that all the phones in the Ring Group ring? I’m having a difficult time understanding that, because there is nothing I know of that is different in the two methods that should cause the phones in a ring group to not ring at all, while allowing individual extensions to ring. I’m not actually sure what I was thinking when I originally read your question, but that’s what I get for trying to answer a question while trying to talk on the phone with someone else – I’m NO good at that type of mental multitasking!
As I say, what puzzles me is that if the call reaches the inbound route correctly, then you should be able to select any destination, assuming that destination is actually valid. If the call were not reaching the inbound route in the first place, that would be another matter altogether. It might be informative to see sanitized output from the CLI while a call is going through (you could paste it into a pastebin, but make sure you obliterate any phone numbers, passwords, IP addresses and other identifying information, and put an expiration on it) – I’m basically curious as to whether the call is ever getting to the ring group in the first place.
Other than that, I have to admit, you’ve stumped me on this one. I wonder if anyone else has experienced this?
Barry said
MT,
Thank You for the explanation. I do not quite understand the logic of asterisk,I guess as you have explained,although I am SURE it is for people like me to make stuff work more ‘transparently.
I guess it is not exactly possible to count on an given extension to show up on the receiving phone( in regards to caller ID) on the same asterisk server?….AKA: multiple trunks?
Thank You,
Barry
michigantelephone said
Barry, I don’t think you quite understand what I’m telling you. When you send a call out via Google Voice, it totally ignores any Caller ID that Asterisk sends (technically, there’s actually no way for Asterisk to send a Caller ID to Google Voice on an outgoing call) and simply uses the Caller ID associated with the account. Therefore, if all your outgoing calls are showing the same Caller ID, that means they’re all being sent out over the same Google Voice trunk. If any of them were going out the other trunk, they’d show the Caller ID associated with that Google Voice account.
michigantelephone said
Barry, one other thought – did you ever actually read this article? There’s a link to it in the original article but you might have missed it:
http://michigantelephone.wordpress.com/2010/12/01/a-couple-tidbits-for-asterisk-and-freepbx-users/
Barry said
MT,
Thank You!!! for the link! This is making a little more sense. I will give the provided ‘examples’ a try, to try and resolve my snafoo. I will report back in two days if this,in fact resolved my’ ‘wrong phone number being seen’ problem with my two GV account setup on my asterisk 1.8.2 setup.
thank You,
Barry
hintss said
A few questions:
can we put the extensions_custom.conf stuff into extensions.conf?
secondly, to dial out on google voice, we just add the line we’d add in the line in extensions.conf for SIP phones, except we replace SIP with jabber, and the name of the account with the GVoice username, right?
and thirdly, how do I get incomming calls to go to an IVR menu?
Carlo said
MT,
On your various questions:
- yes, if the inbound route points to an extension, the extension rings while if I point the route to a ring group no phone rings
- yes, the ring group is valid and works if I call it from another extension or I direct a non-GV trunk to it
- yes, if I set up asterisk to answer the call immediately the extensions in the ring group ring
Here is a link to the CLI output. http://pastebin.com/27MkdPBN
One thing I noticed is that asterisk seem to crash and automatically restart when this happens (see the end of the output). Again, no such issue with SIP trunks or when I set asterisk to answer immediately GV trunk calls.
Carlo
michigantelephone said
Carlo, as far as I can tell you are not doing anything wrong, but Asterisk (or FreePBX) sure is. If Asterisk is crashing that would explain why nothing in the ring group is ringing — at the point where Asterisk crashes the incoming call is effectively left in a state of limbo because no further response is ever sent back to Google Voice. So after 25 seconds Google Voice just sends it on to voicemail. The Asterisk crash is the reason it’s not working and obviously, that’s not supposed to happen (and nothing in the dial plan should cause that to happen) so it’s either an Asterisk bug or something peculiar to your system (could be a memory problem, for example, though I’m not saying it is – that just one of several possibilities). I suppose it could be a FreePBX bug also (EDIT: and I notice it crashes right when dialparties.agi exits, and dialparties.agi is a FreePBX addition), but as I say you really shouldn’t be able to do anything in Asterisk dial plan (which is what FreePBX creates) that would cause that sort of crash short of a system call that goes astray, and we aren’t using any system calls. This is the equivalent of going to a web site and your browser crashing – it shouldn’t happen, and if it does, it’s likely a problem in the browser’s code, or a memory leak or something of that nature. (EDIT: Or I suppose it could be something in dialparties.agi that’s causing the problem).
The other far out theory that occurs to me: Are the extension in the ring group by any chance run directly off of cards installed in your Asterisk box? If so, and if you have more than one set to ring simultaneously, it could be an issue where the cards are drawing too much current trying to ring the phones, and the voltages in the system are taking a dive. Although, if they ring normally when the ring group is called from another extension then that’s likely not the issue. I’m just saying that a lot of things could cause something like that to happen, and I’m sorry but I have no clue what the problem is in your particular case.
If you know how, I’d upgrade Asterisk to the latest version if you are not running it already – if it’s a bug in Asterisk, hopefully they have fixed it, or will. That’s really about all I can suggest.
Barry said
Can someone tell me what i have wrong?
Two GV accounts.Both extensions are working fine inbound and outbound other than GV2 dial out shows GV1 ‘s number
For GV1 dial pattern, I have:
_ _ 1NXXNXXXXXX
1 _ NXXNXXXXXX
1555 _ NXXXXXX
For GV2 account I have switched outbound route2 and Trunk2 dialing pattern to:
9 _ 1NXXNXXXXXX
91 _ NXXNXXXXXX
91555 _ NXXXXXX
,,,with Trunk2 selected for outbound route2 in FreePBX
# After changing to the above dial pattern GV2 phone gets Service unavailable (503) outbound calls.
# previously I had both dialing patterns ,trunks, outbound routes identical other than context’s to ‘try’ and force GV2 to GV2 trunk/outbound route. Works fine,,,but GV2 phone shows GV1 phone number on receiving phone
Anyone have any ideas what I have wrong?
Thank You,
Barry
michigantelephone said
I THINK what you want (assuming these are TRUNK patterns and nor ROUTE patterns) is this (note that in most cases TRUNK patterns that do not either add or strip digits are useless – there’s an exception but it doesn’t apply in your case):
GV1 dial pattern:
1 + NXXNXXXXXX
1555 + NXXXXXX
GV2 dialing pattern:
9 | 1NXXNXXXXXX
1 + 9 | NXXNXXXXXX
1555 + 9 | NXXXXXX
This will ONLY work if your endpoints will let you dial the 9 selector. For example, if you dial 9-1-800-555-1212 and your endpoint is set up for seven digit calling, it might send 918-0055 to Asterisk. That’s why I try to avoid using that sort of thing, but for test purposes you can do it to determine if there is something wrong with your GV2 setup.
Barry said
MT,
Thank You for the advice.
When I tried the dial pattern in the GV2 outbound route I received” Service unavailable (503) error on the GV2 extension.
Not sure why?
I need to do some more reading on how Asterisk dial patterns match ,etc.
I switched back and forth between outbound route with the dial pattern you provided,and then to the trunk pattern as well,with the (503) error.
Thanks again,
Barry
michigantelephone said
Barry, I’m thinking there’s something wrong with the way your GV2 trunk is configured. Maybe you missed a detail, maybe you had a typo you didn’t catch, I don’t know but for whatever reason it’s not doing your outbound calls properly. If you receive incoming calls on the number associated with that trunk with no problems, then look specifically at the custom trunk and the context it points to in extensions_custom.conf. SOMETHING is not right.
Barry said
[Resolved]
Wanted to post up what I got to work with the second Google Voice (GV2) account for outbound calls. In both the outbound route and the trunk2 I used the following dial pattern:
_ 8 1NXXNXXXXXX
( I have to dial 8 + 1 + area code + prefix + number)
# for the first GV1 extension I had the following dial pattern for trunk1 and outbound route1
_ _ 1NXXNXXXXXX
1 _ NXXNXXXXXX
1555 _ NXXXXXX
I am sure there is probably a more sane way of making this work,but,bottom line,the receiving phone sees GV2 GV phone number now,and GV1 shows the GV1 phone number.
Wonder if possibly FreePBX-2.8.1.0 handles trunks,outbound routes slightly different than previous FreePBX versions? Don’t know?
Hope this may help someone else.
Thanks again to all who gave pointers. It is appreciated.,
Barry
michigantelephone said
Barry, I just want to reprise what I said two days ago:
Frankly, you have me so confused right now that I’m not sure exactly what you’re doing, but I’m pretty sure you’re still not understanding how this all fits together, and by determination and blind luck you’ve apparently stumbled onto a solution that works “well enough” for you. Even your patterns in your posts don’t make sense (an underscore is meaningless in any position but the first of a pattern, and that’s only if you’re writing dial plans by hand, or using them in some other part of the FreePBX GUI — they’re never used in outbound routes or trunks because FreePBX inserts them automatically when needed).
Anyway, the solution you have arrived at is probably one that most people would never want to use, nor should they. I’m happy if it works well enough for you that you’re happy with it, but really, you shouldn’t be — you should persevere until you really, truly understand how all this works. I know it’s harder now because of the changes made in FreePBX 2.8 that renders a lot of the older documentation somewhat obsolete, but some principles never change — like the fact that once FreePBX “sees” a matching pattern in an outbound route, it stops searching and will never for ANY reason go on to another outbound route (unless you use some pretty advanced techniques to force that to happen).
If anyone else is having a similar problem I strongly advise that if possible, use the BASH shell script mentioned in the article — if you can cut and paste, and follow instructions, it will help steer you around some of the pitfalls. Please do not just forge ahead trying all sort of things that no one suggested, finally cobble together a “duct tape and bailing wire” solution, and then suggest that your solution may help someone else. Because, really, at that point I just might lose it.
kanishka said
my gtalk user is not getting registered, why is that ? what can i do to fix this
abber Users and their status:
User: user@gmail.com/Talk – Disconnected
Barry said
Hello MT,
I just wanted to clarify that my underscores, in my dial pattern examples were suppose to represent the place holders that are in FreePBX. Sort of a ASCII illustration thing.
Next time I am going to try the shell script you provided. Now that it is all said and done, I believe the dial patterns that I wound up with do not match one another GV1 & GV2 so the GV2 trunk is now being used.
I am sure I would have saved myself a lot of leg work if I would have went through the shell script routine,you have listed.
If nothing else I have a better understanding of the outbound route/trunk functionality now. I need to do a lot more reading on Asterisk for sure. And dialing patterns .
But bottom line the GV2 extension is now being seen as GV2 phone number. Were it wasnt before. And yes I am sure it was blind luck on my part,,,:)…
Thanks again,
Barry
kanishka said
can you guys help me please
michigantelephone said
kanishka – run the BASH shell script and follow the instructions.
kanishka said
thank you michigantelephone, thank a million, i got it to work, but now i get no sound. call goes it shows connected , but no sount at all, i tried removeing stunaddr=stun01.sipphone.com, but not working. my asterisk server is outside the network. can anyone help me please
gtalk.conf
[general]
allowguest=yes
context=google-in
stunaddr=stun01.sipphone.com
[guest]
disallow=all
allow=ulaw
connection=asterisk
context=google-in
jabber.conf
[general]
debug=yes
autoprune=no
autoregister=yes
[asterisk]
type=client
serverhost=talk.google.com
username=asterisk@gmail.com/Talk
secret=passwordport=5222
usetls=yes
usesasl=yes
status=Available
statusmessage=I am a asterisk server
timeout=100
keepalive=yes
michigantelephone said
Audio issues can be tough to resolve. You can take a look at the suggestions in this document on the FreePBX site, although it’s probably a bit dated now:
HOWTO: Resolving Audio Problems
Other than that I suggest asking in the FreePBX forums – those guys probably have a lot more experience with audio issues than I do. Hopefully you’ll get a response from someone who knows what they’re talking about, and not some guy who likes to hang out on the forum and give only marginally correct advice (they have both kinds over there).
hintss said
I have incomming calling working now, I think. THANKS!!
Robb said
I am having some trouble after I followed your guide. Basically I have had to learn a lot about linux and astrerix because I went the not so easy route of installing astrerisk on debian. However now I think everything is working correctly except when I try to make an outbound call. I get the following error.
WARNING[3180] channel.c: No channel type registered for ‘ local’
WARNING[3180] app_dial.c: Unable to create channel of type ‘ local’ (cause 66 – Channel not implemented)
I have double checked all of my config files and settings in freepbx about 4x and I still can’t figure it out. Can you point me in the right direction?
michigantelephone said
Robb, I have no idea — looks like an Asterisk configuration issue of some kind. If outbound calls work despite the error, either ignore it or ask in an Asterisk forum. If your calls don’t work I’ll wish you “good luck”, but don’t have the foggiest notion what might be causing that. Anyone else that might know the answer, please feel free to chime in.
Barry said
Hello,
Wondering if anyone has experienced any changes in their Asterisk ,GV setup over the last week. I have setup Asterisk ,GV from this tutorial and has worked fine, both inbound and outbound calls.
Strange thing is in the last week when doing an inbound call to asterisk from an external phone the asterisk voicemail does kick in as expected if this extension is turned off for example(wifi phone),but instead of hearing the asterisk voicemail greeter immediately like in the past,I end up hearing the Google Voice voicemail after 5 rings.
From the asterisk CLI I can see that in fact the asterisk voicemail picks up immediately and is sending the “unavaliable message” (I believe) back to the Google Voice server? ( In the past I would hear this message on the calling phone immediately of course) .
Bottom line after making an call this way I end up with both a voicemail message in GV as well as a blank message voicemail in Asterisk.
I have updated the FreePBX Core to (2.8.1.4) at the same time so I am guessing the dialing patterns or something tweaked something in the background..
It is not a big deal,but just makes me wonder what has changed. I have looked through most of the configs and they ‘appear’ the same.
Note: I am using the second [googlein] example of the two posted in this tutorial.
Thanks,
Barry
Barry said
,,,continuing
,,Next day thoughts,,,
After having thought about the above GV, Asterisk voicemail scenario,it would appear that GV is not ‘accepting’ the asterisk voicemail response as a valid DTMF tone,as Asterisk(voicemail) is sending the response to GV but GV continues to ring asterisk server, and will not ‘pick up’ until I actually answer the target extension.
Not sure what in the Asterisk configs would have changed this behaviour.
Anyone with any ideas on this?
Thanks,
Barry
Brad Furst said
Thanks for the script and instructions, both worked great! The only issue I had was even though everything was configured correctly, I actually had to reboot my system before the changes to gtalk.conf would take affect. Was banging my head into a wall until I did this, and then when I changed the name of the contexts, I had to do it again-inbound calls were not going to the correct context until I rebooted. I am having the same issue as Barry, it seems if I let the phone ring twice, I don’t have to push 1 to accept the message, but if I pick it up right away, I have to push 1. Shouldn’t Asterisk be answering the call and sending DTMF 1 before even sending it on to my extension?
Just curious, thanks again!
michigantelephone said
I sympathize with those who are having issues, but since I don’t see them here, I have no idea what the cause(s) might be. But if you ever figure it out, please post a follow-up comment — I’d really like to know how to fix this, if there is a fix.
Craig Johnson said
I started having the same issue as the last few posters (I have mine set to only answer when an extension picks). It seems like it only started a few days ago, too. When I pick up, after a few seconds it asks me to press 1 to accept – this works, and the call continues as normal, but it didn’t used to do this before and I haven’t touched the asterisk config is awhile.
michigantelephone said
Craig and anyone else experiencing this issue, I have only one suggestion, and I don’t know if it will help. In the line
exten => _[0-9a-z].,n,Set(DIAL_OPTIONS=${DIAL_OPTIONS}aD(:1))
Add a half second wait, like so:
exten => _[0-9a-z].,n,Set(DIAL_OPTIONS=${DIAL_OPTIONS}aD(w:1))
(Note the added "w")
This (in theory) will answer the line and wait one half second before sending the DTMF "1" tone. It may not help, but it's worth a shot. Don't forget that you have to do an "orange bar reload" in FreePBX before the change actually takes effect (so resubmit any active configuration page, then click the orange bar). If this works, please let me know. If it doesn't work, it's likely a problem at Google Voice (something is really bogged down there, and it's not immediately responding to the tone).
Sean said
This is happening to me as well. I re-imaged and reconfigured my asterisk server due to some unrelated issues and when I setup google voice with it, I must also press 1 to connect the call. This is a real drag now because I cannot use a separate google voice number to connect directly to a conference since the caller never hears the prompts.
Perhaps google has caught onto to the rise in their trunk usages and taken some action to require you to press 1 regardless of the google voice settings.
voipRookie said
Hello,
I’m using the extensions_custom.conf configuration where asterisk answers the call as soon as it arrives. However, it seems the SendDTMF(1) is getting lost and I have to press ’1′ when I pick up the call on my extension in order to complete the connection. Until I press ’1′ the caller continues to hear ringing. My configuration had been working flawlessly until this issue.
I can see in /var/log/asterisk/full where the SendDTMF(1) gets executed. Oh well, I guess we have to expect a few hiccups every once in a while considering google is providing this service for free!
Zack said
I’m having the same problems with dialing 1 as well – I configured Asterisk (as above) so that the GV call is answered only when I pick up the phone. As far as I can tell, the option to dial 1 is now only offered *once I start speaking* (i.e., only after I’ve said “hello”). If I’m right, perhaps this is a new modification Google has added (and would be hard to get around with an Asterisk configuration, I imagine).
michigantelephone said
Google Voice has messed us all up (well many of us) — perhaps you saw the article I posted today, Google Voice incoming calls broken with Asterisk 1.8. I will note that for the moment only Asterisk users seem to be affected — neither FreeSWITCH nor Obihai device users seem to be having any problems with Google Voice. And, I know that Digium is aware of the issue — see this thread on the PBX in a Flash forum for additional information. Ultimately, I believe it’s going to be up to Digium to determine what causes this problem, and to fix the issue. In the meantime, that thread offers some stopgap solutions that have worked (more or less) for some users.
sean said
This is probably something google has edited. All in all, I can live with it but it also means I can’t have a dedicated DID for a conference which sucks.
Trent said
Thanks for that update. I wish I had seen it earlier. I have wasted many hours trying to figure out why all of a sudden GV stopped functioning this past Monday. Everyone I asked for guidance was pointing the finger at my system, or my network.
Zack said
Interestingly, the “Dial 1″ problem doesn’t seem to exist if you access GV via pbxes.org.
BERNIE said
Is this problem only for direct ext dialing? Does this also happen if g-voice is answered immediatly with a directory choice by the autio attendent?
wantng to use asterisk-freepbx
jonathan matthies said
Thank you for this write-up. I may have learned less overall by following this guide instead of slamming my junk into a door for 3 weeks; but I prefer the easier method.
2 days ago all I had was an .iso of AsteriskNOW; and now I have a functional, if ugly looking, set of spaghetti. I may have gone about this the wrong way (old copy of AsteriskNOW with 2.6, manually upgrading to 2.8, recompile with –with-ssl=/lib, blah blah); but it works and the vast majority of the thanks goes to this blog.
So thank you for an excellent writeup
Jorge said
I have fallow this tutorial couple times and made it work perfect, but i have couple day trying to set up my freepbx agian, my problem is very simple, when i set up my inbound to and IVR, never answer (if i view the debug, i can see asterisk is giving the IVR options to anonymous call), but if i change the IVR to a Quote, my extensions ring ok.. no idea how to fix it
Trent said
I have recently started getting that “dial 1″ issue and have even disabled Google Talk as a destination. This is getting ridiculous.
Zack said
It’s worth repeating that, when you access Google Voice through pbxes.org, the dial-1 problem doesn’t exist. It’s weird, because pbxes.org seems to use a very Asterisk-like interface (it even lets you see the source code, which is basically Asterisk source), and I always assumed it actually used Asterisk to access Google Voice. I wonder if pbxes.org has some special deal with Google or if their software somehow identifies itself differently to Google Talk or uses a modified jabber client. BTW, a pbxes.org account is free and gives you full access to GV (if you set the account up with an Android phone). It’s a good solution to this problem, though you need to use an intermediary.
michigantelephone said
For those tired of waiting for a fix to the incoming calls problem, here is One way you might not have considered to get a DID for incoming Google Voice calls.
How to use Google Voice for free calls on an Asterisk 1.8+/FreePBX 2.8 system (the easy way) « The Michigan Telephone blog | mike's Blog said
[...] How to use Google Voice for free calls on an Asterisk 1.8+/FreePBX 2.8 system (the easy way) « The … This entry was posted in Uncategorized. Bookmark the permalink. ← Nikon DSLR GPS Smack Down Results | Terry White’s Tech Blog LikeBe the first to like this post. [...]
Christopher Roge said
Silly question, can you add to this article how to add an extension to associate with the added Google voice account? Very sorry to ask such a basic question but I suspect the extension is where I am falling short.
Robert Green said
I am using asterisk 1.8.5.0 with FreePBX 2.9.0.7. I got the point that implementing google voice with freepbx 2.9 will require a patch and I have downloaded it but I am really confused how to install the patch and where? I mean where to apply the patch ??
I tried it without the patch and it says .. “All circuits are busy now. Please try your call again later.”
Robert Green said
Sorry to bother … I got it and I have successfully installed the patch and have configured it.
Issuing command “jabber show connections” gives output as -
“Jabber Users and their status:
[robert8170.ovlg] robert8170.ovlg@gmail.com/Talk – Connected
—-
Number of users: 1
”
But whenever I am dialing a number, its saying ” could not complete your call… please try again.
RB said
My install is works great. Thx.
I’m trying to figure out how this all works behind
the scenes for an outgoing call.
This is my stupid guess (which is wrong).
1 Logs into talk.google.com with user/pw from jabber.conf
with jabber protocol on port 5222
2 Pass the string 1112223333@voice.google.com to the gtalk
server with some sort of XMPP/Jingle msg command to dial.
3 Asterisk connects the local extension with the destination
phone call.
Are there any web pages that detail how this really works?
michigantelephone said
Just a note that I added
priority=1
into the jabber.conf context, because of this post at the PBX in a Flash site. Figured it couldn’t hurt and might actually help with some of the inbound calling issues. If you are maintaining your own iptables firewall, you might want to see the two previous posts (#98 & #99) in that thread as well.
Trent said
Guess what…GV and Asterisk is back to that bug of giving a fake ring.
This is maddening,
jim@domain.com said
Well hopefully GV will be extended for free throughout 2012 to allow asterisk folks time to develop a more substantial fix.
Stephan Demers said
There’s a much easier way to do it with a build called PBX in a Flash http://sourceforge.net/projects/pbxinaflash/ which sets up asterisk 1.8 and FreePBX for you and then this page explains how to set it up with Google Voice without even the need to do anything through the console. It works beautifully because i now have inbound and outbound capability. See instructions here about half way down the page: http://nerdvittles.com/ Seems too good to be true but so far it rocks and I got it all setup within two hours.
Amignom said
This procedure is very complete and usefull!!
I setup GV on elastix 2.2 in few minutes. Just some issues due to file edit errors. After all is ok.
Thanks a lot…
Jeff said
Amignom,
Can you share exactly what you did on E 2.2?
Trent said
Wish I could get it to function. Have not had GV in almost two months
michigantelephone said
I’d be curious to know that also. At present I find I simply cannot use Google Voice for incoming calls unless I send them to a DID that comes into the system. This seems to be in part because Google Voice changed some things in the past year and the Asterisk folks simply have not kept up with the changes. As far as I know, FreeSWITCH users are not experiencing this issue, nor are Obihai device users – it’s only Asterisk users, and I get the distinct impression that Digium doesn’t consider Google Voice support very important. So if anyone is currently getting this to work with Asterisk WITHOUT the use of a DID, or some other external method such as Bill Simon’s Google Voice-SIP gateway (more information here), I’d sure be interested to know how you did it (assuming, of course that you know why yours works – just saying that you’ve never had this issue would not be a very helpful response unless you can say exactly why).
Trent said
This can probably solve everyone’s problem who can no longer use GV with Asterisk.
http://wiki.freeswitch.org/wiki/OpenWrt
davidrol said
Malcolm Davenport has written working instructions to connect Google Voice via Asterisk without a DID. I have used this solution for about a year without loss of service (other than having to apply the required patches). His instructions are concise, manual edits to jabber, gtalk, and extension.conf files. No third party modules, DIDs or devises are needed. Have a look: https://wiki.asterisk.org/wiki/display/AST/Calling+using+Google
Of course the Phone Configuration peer can be personalized as long as it is in conjunction with your dialplan: exten => s,n,Dial(SIP/malcolm,20)
michigantelephone said
davidrol, I think most existing scripts and solutions that use Asterisk are based upon Malcolm Davenport’s instructions (which, you must understand, are NOT written with FreePBX in mind). But here is the problem I have with his instructions (which is actually a problem with the channel driver). I quote:
This same thing has been suggested on the PBX in a Flash forum. My response to that is, “Oh, FUCK no!!!” Because there is already a short time overhead between the time the caller hears ringing and the time Google Voice actually connects to the server, on the order of 2 to 4 seconds, and now you are going to add another eight seconds?!?! So your callers AND Google Voice think that the called phone has been ringing for 10-12 seconds longer than it actually has. And remember, if by some chance you’re not answering the call the moment it arrives on your system (which is really not a nice thing to have to do to your callers to begin with, since a few of them may still be paying PSTN toll charges), Google Voice only waits 25 seconds from the time it thinks ringing has commenced to snatch the call back and send it to their voicemail, and you cannot change that length of time. So in that case you only have two to three rings to answer the call, or it goes to their voicemail. And even if you do answer the call prematurely in Asterisk, as most of us are forced to do, your callers still think the called phone has been ringing for about two more rings than it actually has, so they will be more likely to hang up before you can answer (people are not getting any more patient these days!).
With an Obihai device, the phone begins to ring almost immediately after the caller hears the ringing tone commence. I haven’t tried FreeSWITCH, but haven’t heard any complaints from their users about this issue. It’s only Asterisk that has this problem, and it’s as if the developers have decided that as long as the module works at all, just leave it alone. Which is their prerogative, I suppose, but it also tends to give all the cool kids one more reason to experiment with FreeSWITCH. It’s also a reason for the rest of us (who want calls to come in reliably and WITHOUT delays) to look for other solutions, such as the use of DID’s, or Obihai devices as gateways, or Bill Simon’s gateway (see link in my previous comment), or even running FreeSWITCH just as a gateway to Google Voice. One could hope that at this point the Digium folks are simply thinking, “We’ll wait and see if the Google Voice service will continue to be offered (and free) in 2012″ before they commit any resources to fixing it, but unfortunately I have the feeling that Google Voice support is a very low priority in their grand scheme of things, and that even if the service continues they still won’t commit another second of time toward fixing their broken module. They seem to be living in some kind of la-la reality where they think that adding an additional 8 to 12 seconds of wait time before ringing commences at the called extension is perfectly acceptable, and it’s NOT.
davidrol said
As of this writing, my setup with vanilla Asterisk 1.8.2, Mac G5 PowerPC, Leopard Server 10.5.8 works without a problem. With a wait time of (1) second, I get 4 rings before it goes to voicemail. Although, 6 rings would be more sufficient, I am unable to extend ring time to longer than that. Also, I use the Asterisk GUI 2.1.0.rc1 for plain and simple configuration.
This setup doesn’t come with all the bells and whistles readily installed with FreePBX. Additional features must be installed as needed, e.g. Usermin, Webmin, Samba, etc. The advantages AFIK, are that I dont need a separate computer/device to run Asterisk/GV, it runs transparently on my workstation with about a 2% cpu load. I run Terminal.app in a small window to monitor CLI. I find the Mac environment to be the most stable. All files are easily accessed edited through the user friendlier Asterisk GUI/ Mac GUI or using Webmin. I have much more flexibility than using a pc running Centos OS.
Joe said
I setup Google voice on Asterisk 1.8.6 and FreePBX 2.8.1
the system is working fine, but the only problem i have when I call some body from asterisk server the phone is ringing when that person pick up the phone, my asterisk server contunuous ring.
can some help me about that ” Thanks’
michigantelephone said
Joe, a lot of folks are experiencing similar issues (see this thread on the PBX in a Flash forum, especially the posts made relatively recently: http://pbxinaflash.com/forum/showthread.php?t=9868). My primary suggestions continue to be:
1) If you can get one, use a DID to bring the calls into your system. Yes, it costs Google Voice money to terminate calls that way, but it’s reliable. in part because turning off call screening actually works when you use a DID. If you’re having trouble getting a DID, see One way you might not have considered to get a DID for incoming Google Voice calls.
2) Purchase an Obihai OBi100 or OBi110 (either will work) and use that as a gateway to bring calls into your system (if you read the linked article, be sure to also read the comments underneath). Unlike the Digium folks, the Obihai programmers seem to have resolved this issue, if they ever had a problem in the first place.
3) Install FreeSWITCH on your server alongside Asterisk, and use that to bring calls into your system. Unlike the Digium folks, the FreeSWITCH programmers seem to have resolved this issue, if they ever had a problem in the first place.
4) Use Bill Simon’s Google Voice-SIP gateway (more information here) to bring calls into your system. Unlike the Digium folks… well, I’m sure you’re getting the drift here.
5) Dink around with various half-assed “solutions” proposed in various forums that involve adding extra-long waits, etc. These annoy callers and have proven to be unreliable, but they are free (of course, so are all the solutions mentioned above except for #2). One approach that I have not tried that may prove to be useful is plying a bit of “background noise” to Google Voice after answering the call, as suggested in this post. While I appreciate the thought and effort that folks are putting into trying to come up with such solutions, the fact is that they have a tendency to work for a while and then stop working the minute Google Voice changes something.
You may also find that the comments under the article Google Voice incoming calls broken with Asterisk 1.8 contain other suggestions and information (I won’t opine on whether any of it is actually helpful or not).
Having said all that, please keep in mind that as I write this we are only guaranteed free access to Google Voice service for approximately three more weeks. I would personally HOPE that if Google Voice plans to make any changes to the terms under which their service is offered they’d give us more than three weeks’ notice, and last year they didn’t announce that the service would be free through 2011 until right around the day of the winter solstice. But some folks may not want to spend money or put a lot of effort into getting this to work until they are sure it will actually be around in 2012.
davidrol said
Heres my setup. The exten=s,n,SendDTMF(1) will stop your phone from ringing and answer:
exten=s,1,Set(crazygooglecid=${CALLERID(name)})
exten=s,n,Set(stripcrazysuffix=${CUT(crazygooglecid,@,1)})
exten=s,n,Set(stripleadingplus=${CUT(stripcrazysuffix,+,2)})
exten=s,n,Set(CALLERID(all)=${stripleadingplus})
exten=s,n(strip1),Set(CALLERID(num)=${CALLERID(num):1})
exten=s,n,Answer()
exten=s,n,Wait(1)
exten=s,n,SendDTMF(1)
exten=s,n,AGI(dialectic-asterisk-incoming-call-monitor.agi)
exten=s,n,Dial(IAX2/6000&SIP/6000&SIP/6001&IAX2/6001&SIP/6002&SIP/6003&SIP/6004&SIP/6005,20,D(:1))
ignorepat=9
include=default
include=trunklocal
include=iaxtel700
include=trunktollfree
include=iaxprovider
include=parkedcalls
Bill said
Just dropping by to say hi. I’m thoroughly amused by the ongoing conversation on this thread a year later. Why? Because I’m still getting comments on my year+ old post on the same subject. Sorry everyone. When these threads were initially posted it worked pretty reliably. Not anymore.
The whole subject just needs a pile of disclaimers. Your mileage may vary. Beta. No warranty or guarantee express or implied. Must accept radio interference; must not cause radio interference.
michigantelephone said
Bill, you are correct. Early on, if someone left a comment saying “this isn’t working for me” or something to that effect, I assumed there was a flaw in my instructions. But ultimately I came to realize that the Gtalk channel driver in Asterisk 1.8 is pretty sucky and leaves a lot to be desired (especially when attempting to handle incoming calls), and what’s more, the Digium folks don’t seem to give a flying f-ck anymore. And besides that, this is the year I came to realize that I want nothing more to do with F—PBX, and that some of that ill will has spilled over onto Asterisk as far as I’m concerned. So now, when folks write and say it doesn’t work, my thought process is along the lines of “It’s probably not a flaw in my instructions; it’s probably not anything that I can do anything about; if I expend any mental energy on the subject I will just get angry or frustrated; and frankly I just don’t care anymore.” If I’m in an exceptionally good mood and can make a suggestion that might actually help I may do so, but these days even thinking about this stuff often takes me to a dark place where I really don’t want to go.
I’m still hoping that one of these days someone will publish a comprehensive guide to using FreeSWITCH and either blue.box or FusionPBX and put it online. If I still have enough of my senses left at that point (I am NOT getting any younger, and it seems my mental acuity is not quite what it used to be) I may try setting that up. Maybe that will even seem like a fun project at the time, although lately almost nothing having to do with computers or technology has been more fun than frustration. Maybe that’s just something that happens as you get older – the kids take to the new technology, while you gradually find it more difficult to remember which button to press on the remote control. I know you might be thinking that many remotes do have too many buttons these days, but this was a garage door opener!
Aaron said
Hi MT,
First, let me start by saying that I followed your instructions and it IS working (on FreePBX 2.9.0.7 and Asterisk 1.8.8.0) , I’ve got multiple Google Voice numbers that will can take and generate calls (separate area codes). So that being said, Thank you!
I do however have an issue that I believe you might be able to assist me with. SMS…. I’ve got app_sms and smsq installed, but I’m not sure how to set my extensions_custom.conf to send the SMS out, or receive it for that matter.
Thanks,
Aaron
davidrol said
A recent discovery. My incoming call to Asterisk 1.8 stopped. Outgoing worked as expected. I resorted to PBXes as a temporary trunk untill I could sort things out.
As it appears, instructions to firewall settings are inconsistent. Some would say to include port 5222 udp, others 5222 tcp, others 5222 &5223.
The truth is this. And, this is the STABLE data: ports 5222 and 5223, tcp and udp, should be open in your firewall for things to work correctly.
Dave Rosengarden said
Hey all – real good dialogue here! Way to go keeping Digium on their toes (and too bad on the defensive vs. the customer service approach!)
Also HUGE thanks to the users who continue to battle and tackle this issue, come up with fixes, AND share them with the likes of little old me! You truly are an OpenSource asset!
I have a question – I am about to embark on a mission to have an Asterisk/FreePBX server set up that will integrate with my vTiger installation. (vTiger already has some nice built in functionality that allows for integration with an Asterisk Box.)
I have been told that it is only wise to have vTiger and Asterisk running on two separate machines – especially for the Asterisk side since the telephony services could be interrupted or deteriorated due to server over load. (How true is this anyway?)
I currently have my vTiger install running on a GoDaddy free economy Linux hosting (comes free with purchase of my domain – woo hoo! And it is more than sufficient for my three user current setup.)
But what about the Asterisk/FreePBX instance? Where can I put this on a hosted environment and get as great of a price as I get with my vTiger right now? (I believe the domain costs me like $12/year or something- less if I buy more time – and THAT’s IT! So full functioning CRM for about $1/month – can’t beat it!!!)
Does Asterisk/FreePBX NEED to be dedicated hosted or has anyone been ‘getting away’ with shared hosted and have just as much success? (and clear and full quality calls – of course!)
Thanks in advance for your kind advice and experiences!