I’ve wanted to get a VoIP application working on my N770 pretty much since day 1: the trouble is I’m rather picky…

I want to be able to use it without pain from any WiFi point I happen to find myself at and I can’t use the N800 version of Skype, but that’s fine by me as I want to have some control over my datastream. It does however pretty much rule out most SIP-based solutions, as one-way audio is the best to hope for without control of NAT port forwarding (and that isn’t something hotels/coffee shops are going to have much truck with).

I would like to be able to use it for free for pure VoIP calls, but would also like the option of paying not-silly prices for real landline interconnects, and for extra points voicemail and multiple country phone network numbers would be a huge advantage (so callers get to choose the cheapest way to talk to me).

The biggest point, though, is that my family must have a really, really simple way of keeping in touch with me as work-related overseas travel is looking more and more likely (after a delightful five year hiatus). Yes, I could ssh-tunnel SIP, but making lossy UDP channels into TCP ones is a lesson in pain waiting to happen, but equally it’s not something I expect anyone else in my family would want to setup just to be able to chat for 3 or 4 minutes.

I have the 2007HE OS on the N770 (as the original 2006 is just painful) so Google Talk is integrated very nicely, but unfortunately, even after sharing board members between Apple and Google there’s still no voice support for GTalk in iChat 🙁 In fact, unless you have Windows, forget Google Talk – and that’s a very annoying thing to have to do.

I’ve tried using the rather intriguing GTalk 2 Voip service but have had problems getting the system to work for more than just a ringing tone, and although I have a real UK number for my home SIP phone, I didn’t want to have to pay to call it just for testing, although by all accounts that aspect should work fairly well. The next stop was the Gizmo Project for the N770, but that isn’t 100% stable (could be the 2007HE, of course) and again suffered from not wanting to do more than ring my other phone, or create one-way audio channels.

Finally, I took the obvious course of action: installing Asterisk 1.4 beta on my Qube 2, giving it it’s own Google email address and configuring the GTalk<>SIP gateway… Bam: working two way calling !

There are some downsides: I can’t seem to get the basic Asterisk installation to talk via text with me (I need to investigate some primitive AGI bot) so I can only initiate a GTalk voice call to the Qube, at which point I can only create a call to a specific SIP device as I have no way of sending DTMF data via the native N770 Google Talk client. This isn’t so bad for my immediate use as I can simply create as many Google Accounts as I require outgoing call destination, and considering that I can’t bridge to my own home land line (yet), that means having an account with an external provider setup to pay for the UK leg, so it’s of limited use. I only really need to call two main numbers when away for work anyway, and one of those is a SIP destination which works very nicely directly from Asterisk. I have also setup the Asterisk box to login into Sipgate in order to have a UK landline for the box, which I can then easily forward to GTalk or bounce to Voicemail.

Or so I thought, until I wandered over to my neighbour to get his Asterisk talking IAX2 to mine, and found that my N770 would ring when on his LAN, but not get any further. Some asterisk -vvvvv sessions later (yup, logged into my Asterisk box via ssh from the N770, of course !) and it turns out that Asterisk is sending packets out to GTalk with the main WAN IP of the box, and then the LAN IP and alternating during the call setup. Very odd, but a few vi edits later (yup, still via the N770: it’s getting mighty masochistic at this point) and all of the relevant binaddr lines have been changed from 0.0.0.0 to just specify the WAN IP. Hooray.

Except it’s still alternating WAN and LAN in the GTalk packets. Hmm. Poking around in the channel/chan_gtalk.c file proved to be very worthwhile though, as at like 762 (Asterisk 1.4.11) there’s the following comment:

/* XXX We should really stun for this one not just go with externip XXX */

To which my only response is “Yes, you should”. Adding in a line just before the if statement along the lines of:

sprintf(externip,"1.2.3.4");

(but with my WAN IP) and voila – working calls !

As this is beta software I fully expect the STUN issue to be resolved in time, but for now I have a UK number which can be called from my home SIP phone for free (or the main landline at reasonable rates – 5.5p/hr evenings and weekends) that rings my N770 whenever it’s logged into GTalk. I have tried a couple of access points that are the standard ‘home NAT’ setup and it works just fine with two way audio, and the separation of the speaker and mic on the N770 is so well done that conversations are far less of a problem than my normal phone in speakerphone mode. I have had some reports of slight clipping at the start of a sentence, so maybe my silence suppression needs a look, but changing the angle I spoke into the N770 was enough to get by for that call.