Thursday, December 9, 2010

Outbound Google Voice dialing "proper" fix

As I mentioned in http://supermario-world.blogspot.com/2010/12/nov-30th-break-of-asterisk-18-w-gv.html, proper Google Voice outbound dialing got busted at the start of the month because of a protocol change on Google's servers.

While upstream worked on the patch (as detailed in https://issues.asterisk.org/view.php?id=18412), I had a workaround that used an AGI call back for the dialer.

Well a final patch has been developed now that accounts for the protocol changes and accepted into 1.8.x svn (https://issues.asterisk.org/file_download.php?file_id=27904&type=bug).  I expect there will eventually be a 1.8.1 maintenance release that includes this patch.

In the interim, i've rev'ed my packages to 1.8.0-2 and include this patch now.  You just need to opkg upgrade and you should receive the updates.

# opkg update
# opkg upgrade

You should undo any AGI dialer hacks that were added and revert to the original outbound google talk dialer.  If you have been using my dialplan, this should just be a two line change to comment out the AGI line and uncomment the Talk line.

so the outbound section of your extensions.conf should look like this:


[outbound]
include => seven-digit
include => local-devices
include => tollfree
include => talk-gmail-outbound
include => talk-numeric-outbound
include => dial-uri


As always, you can view my dialplan and settings at http://www.arctangent.net/~superm1/gv_configs/ in case you are missing something or joining in late.

And thanks to everyone who helped to make this patch happen!

31 comments:

  1. great mario! I was waiting for this.

    BTW it seems you forgot something in your instructions, or maybe I should had guess:

    # opkg upgrade
    opkg: the ``upgrade'' command requires at least one argument

    So I used:
    # opkg upgrade asterisk18 asterisk18-chan-gtalk asterisk18-codec-alaw asterisk18-codec-g722 asterisk18-func-db asterisk18-res-musiconhold asterisk18-res-rtp-asterisk

    ReplyDelete
  2. Hey Carlos:

    Peculiar that you had to list argument for opkg upgrade to work. I didn't have to...

    ReplyDelete
  3. Mario,

    A while ago I was trying to get Google Voice integration through pbxes.org and I got really mad, as around the time I was doing my test, invitations to gchat to half of my contact list were sent. Well guess what it happens again, just when I restarted the asterisk service after installing this patched package.

    This time I went to my contact list in gchat and I cleaned any person that didn't have a gmail.com address as to make things worst these are the people receiving the invitations, they were showing there as "invited", do you have any information on this? Do you think the cleaning of the contact list will prevent this from ever happening again? It is very embarrassing, I have email address in my contact address book of people I don't want to be sending these kind of emails.

    Thanks,
    Carlos

    ReplyDelete
  4. Hey Carlos:
    Sorry, no advice on this matter. I've not hit it myself (or if I did, no one told me they got these), but it does sound awfully annoying.

    I think the fortunate part is that it shouldn't be doing it anymore if you're staying signed in all the time.

    ReplyDelete
  5. OK, let me see if it doesn't happen again.

    People in this thread are talking about it:
    http://www3.pbxes.com/forum/thread.php?threadid=1289421168&sid=a051574c11c0041bad31912d76232b30&page=3

    I did what they recommend let see.

    Thanks anyway

    ReplyDelete
  6. I have the same issue of upgrading need argument. However, when I reinstalled all of the asterisk18 packages, I still had the same error as before, i.e., only rings but no connection and the log showed "gtalk_parser: Remote peer reported an error, trying to establish the call anyway" etc. BTW, I am using the brcm-2.4 packages. Have you upgraded the brcm branch yet?

    ReplyDelete
  7. Oh I was a little pre-emptive on the blog post, the brcm-2.4 were still building. They should be up there now though.

    ReplyDelete
  8. The file asterisk18-res-rtp-asterisk was missing. It has still not come up yet but it is always delayed anyway from my previous experience. I guess I just have to wait a little bit.

    ReplyDelete
  9. Mario:
    O.K. Now it works perfectly! Thank you for your effort and super result!
    I also noticed that you updated the patch files with the latest "fix" included. It will try it to see if it work this time. Thanks again.

    ReplyDelete
  10. Mario:
    Does your google-in still work properly? I noticed that your dialplan posted still has the two line hack. I tried removing it, but still don't have incoming calls working. I'm on Ubuntu using the backports from https://launchpad.net/~dajhorn/+archive/pkg-voip, which also includes the fix.

    Thanks!

    ReplyDelete
  11. Hi Brian:

    Just double checked my google-in using an incoming call from the google.com/voice website. Still works fine.

    I've still got the 2 line hack around google-in purposefuly actually. It's there so that I can re-enable the AGI hack again should the protocol change again. As long as the database doesn't have a gv_channel in it (as it shouldn't by default) the hack will behave like a no-op.

    ReplyDelete
  12. I've been trying desperately to integrate an ENUM dialing plan into your script - I know it's a bit off topic, but do you happen to have such a thing? Or perhaps interest in developing one for your loyal readers to utilize? :)

    ReplyDelete
  13. Hi Craig:
    Before your comment I hadn't really even heard of ENUM.

    After reading a little on http://www.voip-info.org/wiki/view/ENUM it sounds like you'll need a third party brokerage service and then follow one of the howto's like http://www.geek-pages.com/articles-for-geeks-mainmenu-2/15-asterisk/19-setting-up-enum-for-outbound-calls-on-asterisk-at-home

    So let me see if I understand this correctly the only real benefits happen when two ENUM enabled boxes are calling one another. With the way that (At least) i'm using google voice, it doesn't make as much sense to do on incoming calls.

    My google voice number rings both my mobile phone and my asterisk as the same time. If someone with ENUM called me and I had ENUM turned on, that would mean my mobile number would never ring anymore. Unless I set up some Locale rules on my phone to toggle what Asterisk is doing, I'd expect this would yield more missed calls than benefits.

    Now however for outbound dialing it can be useful, but only if a significant number of people that I'm calling started using it. Is there a good resource to determine if a number is ENUM enabled? I'd like to at least test out some of the conference call bridges that I regularly call for work to see if they are. If so, then this certainly sounds like something useful in me implementing to my dialplan setup.

    ReplyDelete
  14. Craig:
    Actually I should have google'd first, I came across an ENUM lookup at http://www.sipbroker.com/sipbroker/action/enumLookup

    I checked the conference call numbers that I call into regularly, and none of them came up in the ENUM lookup. So probably not too much utility to implement at least with the way I use GV and Asterisk.

    ReplyDelete
  15. Mario:
    In stalled your asterisk 1.8 packages on ASUS 500GP V2. It works very well. In particular, the power consumption of the unit is less than 2 watts. Except for its size, it is nice platform, at least for my purpose.
    After corrected MD5 problem, I manages to compile the needed files for Dockstar Openwrt using your diff file. (I didn't compile all of the files because some issues but all of the 7 files I installed on the routers are included.) Unfortunately, the results are exactly the same as for Debian installation. It can only log in with null password and always complain about there is no No RTP engine was found. So it is not a debian problem but more a Kirkwood/Asterisk incompatibility issue. The only thing I have not try is to install Openwrt in internal flash. I still don't have a working CA-42 cable yet. This is next thing I will try once get the cable.

    ReplyDelete
  16. Twinclouds:

    Glad to hear it's working well on the ASUS. For your error about no RTP engine found, make sure you have
    "asterisk18-res-rtp-asterisk" installed on the machine. RTP was broken out in a separate package nowadays.

    ReplyDelete
  17. Mario:
    Thanks.
    Yes. I did include this package. It is the same problem all over again as on Debian. Maybe somebody at Marwell should take a look. I am waiting for more experiments on internal flash done before bringing up this issue to them.

    ReplyDelete
  18. Mario:
    I used the config files for sometime now and they all work well. I use them also on Optware Asterisk 1.8 on Dockstar and they also works well. (As far as I know, this is the only Optware is the only platform on which Asterisk 1.8 works on Dockstar.
    One question I have is that it appears that I can only use extension 101 to make calls. For extensions 102, call cannot be completed. Is this the right behavior? Is there anyway for more than 1 extensions to make outgoing calls?

    ReplyDelete
  19. Twinclouds:
    I'm able to make calls from both of my extensions - but not simultaneously. Was that your problem maybe?

    ReplyDelete
  20. Trying this on 1.8.1, set up as suggested, but:


    Dial("DAHDI/4-1", "Gtalk//@voice.google.com") in new stack
    [Jan 5 16:26:22] ERROR[3129]: chan_gtalk.c:1871 gtalk_request: No XMPP client to talk to, us (partial JID) :

    Any thoughts?

    sean

    ReplyDelete
  21. sean:

    That sounds like a misconfigured Jabber conf. Make sure you included your secret password in jabber.conf.

    ReplyDelete
  22. Mario:
    I tried it again and it works this time. Not sure what was wrong last time. Sorry for the confusions.

    ReplyDelete
  23. Mario:
    I have been using your packages for Asterisk 1.8 for some time. They work very well on my ASUS routers. However, when trying to make Asterisk 1.8 Openwrt packages for Dockstar, here are always some issues. Recently, a guy figure out that the cause is because data alignment and proposed some fixes. The fixes involve modify 2 source files. I have verified that it works on Debian. However, for Openwrt, I guess I need to make patch files to make changes in the source files. Is there anyway, I can directly modify the source files. I thought they downloaded during compilation. If I need to make patches, how should I do that. I looked over your previous patch of 1.8.0. I know I can do a diff to generate the differences. However, in your patch, the first line (Index ...?) pointing the file need to be patched. Is this one manually added or generated automatically? Hope you can point me to the right way to do it. Thanks in advance.

    ReplyDelete
  24. twinclouds:

    by now i'm guessing you sorted this out right? if not, you just need to use the 'diff' utility in unified diff mode (-u).

    ReplyDelete
  25. Mario,

    Firstly I would like to say thanks for your detailed post here on how to get this to work on on a router.
    I have setup my WNDR3700v2 router with OpenWrt Backfire 10.0.3-RC5 running asterisk 1.8 and all is great. I have a Linksys PAP2T connecting to my asterisk server and all is well. I can make and receive calls no problem.
    I do have one slight problem.
    My ATA device does not ring unless I am logged out of gtalk from all other locations. It only rings when the asterisk server is the only client that connects to gtalk via jabber.
    Is there anything I can do to address this? Is anyone else having this problem. I'd like to get to the bottom of this so that i don't run the risk of not getting my calls routed to the phone.

    Let me know if you have any thoughts on this.

    Chirag

    ReplyDelete
  26. Chirag:
    You can mess with the priorities a bit, but beware you might break chat in other locations too.

    The best thing to do is not install the voice/video plugin wherever else you are logged in, or at least disable it. On my phone I just uncheck the option for voice/video and it lets my asterisk still ring.

    ReplyDelete
  27. Mario,

    I just returned here to post this solution to my question. You beat me to it.
    You are the man, simply because you actually responded to the question before I answered it.

    Anyhow, I fiddled around with the priority in jabber.conf and set it to a high value (1000 for now cuz i would rather have the phone ring than the computer ring). Now I am going sleep.
    Hopefully, there has to be a priority value which would allow all my devices gtalk chat plugin/asterisk devices to ring simultaneously. I just need to find that value.
    Will take some time.

    Cheers,
    Chirag

    ReplyDelete
  28. Mario,

    Okay, I have had the asterisk install up and running only for 1 day so can't say if this is normal or if this because I've set the priority=1000.

    Problem: My asterisk status overwrites my gtalk status whenever my gtalk client (or my android phone) goes into the "away" status. Some of my friends have already asked me whats this asterisk thingy? and I certainly haven't logged out of gtalk on my mobile phone so I think there is some issue here.
    Has this happened? is this common? or is this somethign having to do with the priority setting in jabber.conf?

    Thanks,
    Chirag

    ReplyDelete
  29. I think that's probably most likely caused by the priority change.

    I've not had anyone complain about a similar problem for me (but maybe people are used to it if it is happening), and I leave my android client signed in all day.

    ReplyDelete
  30. There seems to be some weird problem with incoming calls. I pick up sometimes and it seems to the caller that the phone is still ringing. I hang up the phone on my SIP deivce connected to the asterisk server, and it rings again. I try to pick it up, still nothing. This happens intermittently.
    Sometimes I pick up and it works like a charm.

    Is there an something that you can think of which causes this. I am using your extensions.conf as is, no change (except my email address).

    Thanks,
    Chirag

    ReplyDelete
  31. This used to happen a lot for me too before I did the google voice / sprint integration. I haven't had it happen since then though.

    ReplyDelete