And I don’t mean an advert for radio.

On the 25th of August 2010 Google Voice announced calls could now be made from within the Gmail web browser interface. Fine, handy, I didn’t think much of it at the time and assumed it was just an HTTP request from Gmail to the Google Voice web service to initiate the call and that included a new trick to avoid the need for a callback.

I didn’t think anything more of it until I saw a post on the recent Asterisk 1.8 release. I’d already seen that Asterisk 1.8 supported making calls via Google Voice and again assumed it was done using HTTP. However this particular article stated that wasn’t the case and that Asterisk was using XMPP and the Jingle extension and an Asterisk wiki article on the topic seemingly confirms it.

Being able to initiate calls through Google Voice via XMPP was something I found interesting. Not because I find the existing HTTP callback mechanism clunky, although it is, I just don’t need to make any calls to the US. But it’s always fun integrating voice technologies and being able to place calls to the PSTN through a major service with XMPP was something new, at least in my experience.

There are XMPP libraries around and in fact sipsorcery already uses the AG Software XMPP library to for the sys.GTalk dialplan method. For fun I decided to spend Saturday seeing how far I could get towards placing a call to Google Voice via XMPP from scratch. XMPP is a bit different from SIP and revolves around the concept of XML streams. Having worked a lot with XML over the years it wasn’t hard to grasp. By the end of the day I was able to successfully connect, authenticate and send instant messages to a GTalk client. However at the next step of initiating a call to Google Voice I ran into a bit of a dead end.

I obviously wasn’t the first programmer to try this as there was already the Asterisk 1.8 implementation that had been in existence for at least 3 weeks. And after a little bit more digging it appears the FreeSWITCH implementation was around for at least a month before that, I’m guessing the Asterisk implementation borrowed from the FreeSWITCH one. I therefore assume Google Voice must have documented or blogged about what was required to connect with them over XMPP. Although one thing I found strange was that there is no facility in Google’s own XMPP client, GTalk, to initiate a call to the PSTN, at least not for me. After a bit more searching I haven’t really made any headway and it looks like I’m going to have to fire up gdb and attach to Asterisk (I’m more capable of driving it than FreeSWITCH). The FreeSWITCH and/or Asterisk programmers got the knowledge from somewhere and I’m wondering if it was reverse engineering the GMail calls or not…

The exercise has left me wondering about Google Voice and XMPP. Given the level of activity around the various mechanisms to make Google Voice calls from SIP I would have thought that more people would have picked up on the new capability of originating calls via XMPP. To translate a SIP call to XMPP is actually very simple compared to the sort of mechanism sipsorcery uses with the HTTP request and the use of a callback provider. My main driver is curiosity but there are a lot of people out there that take it a personal challenge to get free calls as easily and conveniently as possible and it’s curious that they haven’t picked up on this yet.

Oh and if I’ve missed a reference which specifies the format for the Jingle calls to Google Voice, which is entirely possible, I’d be grateful for any information :).

Update (couple of hours after original post): I started trying the different call request formats I stumbled across in a Google Talk API reference. After a few attempts I was still getting nowhere and then I got a error message back with a redirect destination. That looked promising so I parsed that out and resent the call request. This time I got back what looked like a pending response but then after about 10 seconds I got a “pho:recipient-unavailable session timed” out error message. I tried a few different numbers and number formats just to make sure but still couldn’t get past that message or get any of my numbers to ring. Still it’s a step closer.

Advertisements