Success initiating Google Voice call via XMPP

I changed a single setting in my Asterisk 1.8 gtalk.conf and bingo my Google Voice call worked. The setting was to specify a stunaddr rather than specifying an externip. It’s probably got something to do with the Amazon EC2 instance my test Asterisk server is running on being behind a NAT. With the call working I was finally to see the raw XMPP packets being sent and copy them into my own C# app and have it initiate a Google Voice call over XMPP.

The code is pretty useless in its current form, all it can do is get a phone to ring. No audio is available. However in theory that’s the hardest part out of the way and it shouldn’t be difficult to translate an incoming SIP request into an outgoing XMPP request.

For anyone curious the XMPP packets that need to be sent to initate a Google Voice call are shown below. Whatever is sending those packets will need to be authenticated prior to sending them but at least that part of it follows the XMPP standards.

<iq from='me@gmail.com/Talk-12312' id='1234' to='+1818338xxxx@voice.google.com/srvres' type='set'>
    <session xmlns='http://www.google.com/session' type='initiate' id='abcdef12344' initiator='me@gmail.com/Talk-12312'>
        <description xmlns='http://www.google.com/session/phone'>
            <payload-type id='0' name='PCMU' bitrate='64000' clockrate='8000' />
            <payload-type id='100' name='EG711U' bitrate='64000' clockrate='8000' />
            <payload-type id='101' name='telephone-event' clockrate='8000' />
        </description>
    </session>
</iq>

<iq from='me@gmail.com/Talk-12312' id='1234' to='+1818338xxxx@voice.google.com/srvres' type='set'>
    <session xmlns='http://www.google.com/session' type='candidates' id='abcdef12344' initiator='me@gmail.com/Talk-12312'>
        <candidate 
            name='rtp'
            address='121.223.xxx.xxx'
            port='10202'
            username='asdasdoas'
            password='dshasjja84'
            preference='1.0'
            protocol='udp'
            type='stun'
            network='0'
            generation='0' />
        <transport xmlns='http://www.google.com/transport/p2p'/>
    </session>
</iq>
  1. Justin’s avatar

    Wow.. so if I’m reading correctly, that means no more need for gizmo5/sipgate/etc?

    Reply

  2. Mike Telis’s avatar

    Eagerly waiting for updated version of sys.GoogleVoiceCall. I’ll incorporate it into the dialplan soon after your whistle! 🙂

    Reply

  3. sipsorcery’s avatar

    In theory it would mean no more need for a callback provider such as gizmo, sipgate etc. And also in theory it would also mean Google Voice could be just another provider. Something I know Mike has been looking forward to for a long time :).

    However please note the “in theory” bits. There’s many a slip between a cup and a lip.

    Reply

  4. MrChris’s avatar

    I bet PSTN providers are gonna love this. 🙂 However If things get out of control It wouldn’t surprise me if Google Voice puts some type of limiter or something in place.

    However I doubt that will stop or even slow down the vast growth and possibility’s that SIP and other Voice Transmissions are able to provide in the not too distant future.

    Keep up the good work.

    ~MC

    Reply

  5. xur17’s avatar

    This is awesome news. Do you know what codecs are available for calls via xmpp? I see PCMU and EG711U listed above if I am reading it correctly.

    Reply

    1. sipsorcery’s avatar

      Going by the Jingle standard dealing with RTP (http://xmpp.org/extensions/xep-0167.html) any codec that can be used in a SIP call, i.e. in an SDP payload, can be used in Jingle. As to what codecs Google Voice support I’d imagine it’s all the common ones: ulaw, alaw, g729, gsm etc. My bet is their XMPP gateway converts call requests to SIP and hands them over to the GrandCentral SIP infrastructure they bought and integrated a couple of years ago.

      Reply

    2. The Chosen One’s avatar

      I would find it mildly hilarious if you got some fancy letter from Google offering you a job working on Google Voice. (I wouldn’t be surprised if they put “PS: You have to deactivate SIP Sorcery” a la The Gizmo Project)

      Reply

      1. sipsorcery’s avatar

        It would be trivial for Google to block external parties from originating XMPP calls to them. It will be interesting to see what happens there as FreeSWITCH and Asterisk support XMPP call origination and they are much more widely used than sipsorcery. It’s a magnitude or order easier to originate free calls to Google Voice now than with the HTTP request hacks. I’d imagine Google Voice are going to get a rapid increase in people hooking up their FreeSWITCH and Asterisk PBX’s.

        Reply

        1. The Chosen One’s avatar

          Another thought: Since a majority of people use SS simply for it’s semi-integrated GV support, then maybe people will start dropping GV and start using other XMPP-supporting services, thereby relieving the strain on the SS servers.

          Reply

        2. tom’s avatar

          i am actually surprised that at least in the mobile VOIP apps world we have not already seen many apps using this connection method. for example fring and nimbuzz have not added support and they both do XMPP already as well as multiple protocol VOIP.

          Reply

          1. sipsorcery’s avatar

            Well the information on how to integrate with Google Voice via XMPP is not actually easy to find if it exists at all. I never managed to find it. The Google Voice gateway is also not using Jingle, which is the XMPP extensions designed for initiating media/RTP sessions. I only know of two applications that use the Google Voice XMPP gateway and that’s FreeSWITCH and Asterisk. The code went into FreeSWITCH a month before Asterisk got it so I suspect the Asterisk effort was a copy. So Anthony Minessale of FreeSWITCH either got some information about the way to talk to the Google Voice XMPP gateway from a Google source or he was clever enough to work it out by himself. I’d rate that one 50-50. The other interesting thing is that neither the Gmail dialler or the GTalk client use the Google Voice XMPP gateway, at least not directly, so who have Google opened it up for?

            Reply

            1. Seth Wisely’s avatar

              Is gtalk SIMPLE capable if not jingle?

              http://old.iptel.org/ser/doc/jabgw/xjab-manual.html

              I would be more interested in non-google xmpp applications… jabber.org , talkr.im , jappix.com , chatme.im , xmpp-hosting.de [last two are feature rich but slightly wonky]

              Reply

            2. sipsorcery’s avatar

              No gTalk is not SIMPLE capable. SIMPLE is a SIP extension and gTalk does not implement SIP. Plus it wouldn’t make lot of sense for gTalk to do so since SIMPLE is really a poor man’s attempt at XMPP.

              Reply

            3. David Jonas’s avatar

              Me and reggie over at 1SRC are putting up a $2,000 bounty for anyone who can successfully send and receive a MMS message using their google voice number in both directions without any initial 3rd party interaction directly or indirectly.

              Reply

              1. Tom’s avatar

                Is there a link explaining this any further?

                Reply

              2. kingbyu’s avatar

                Does this still work? I’m more interested in receiving calls from Google Voice, but about a week ago I stopped receiving session IQ stanzas in the xmpp stream.

                Reply

                1. sipsorcery’s avatar

                  I haven’t tried it for a while. I’ll check it out in the next few days.

                  Update: Just tried out the test program (http://sipsorcery.codeplex.com/SourceControl/changeset/view/72644#1237798) I wrote 1 year and a half ago and it’s still working fine.

                  Reply

Reply

Your email address will not be published. Required fields are marked *