Alsuren

April 13, 2010

Gateway to the West

Filed under: collabora — Tags: , , , , , , , , , , — alsuren @ 12:16 pm

It has occurred to me that I should probably write a blog about the project that I’ve been working on recently. We have named it Fargo. Its job is to act as a gateway between the XMPP and SIP networks. The aim is to let you make voice calls from your XMPP client to your SIP contacts without needing to run a SIP-capable client on your local machine. It also allows you to receive incoming calls from SIP contacts from your XMPP client.

The program runs as a standard gateway, so if Fargo were running on sip.fargo.im, then you would tell the details of your SIP account to sip.fargo.im. Once registered, whenever you log into your XMPP account, the gateway will sign you into your SIP account so that you can send/receive calls. For example, if I were to call you, you would see an incoming call from alsuren%opensips.org@sip.fargo.im, and it would behave exactly like a call from one of your XMPP contacts. If you wanted to call me then you would just add “alsuren%opensips.org@sip.fargo.im” to your XMPP contacts, and then click the call button.

Now, if you wanted to make a one-off call to me, but you didn’t want to have to add me to to your contact list and then remove me again afterwards, Empathy/Gabble already lets you do this (thanks to an extension that we wrote). Just open up the “New Call” dialog, and type in alsuren%opensips.org@sip.fargo.im.

So what goes on behind the scenes? When you make a call, your XMPP client opens up a pair of ports in your router (most likely using STUN or UPnP). It then sends your public IP address and port numbers to alsuren%opensips.org@sip.fargo.im along with a list of which codecs it supports (this is pretty much the same as what it would do if you were calling someone who is using Google’s official client, or the echo@test.collabora.co.uk echo service). Fargo then reads this information and sends it over dbus to telepathy-sofiasip, which forwards it on to me via SIP. My SIP client then sends back some IP/port pairs, and a list of supported codecs (as if it were talking to an X-Lite user, or the echo@iptel.org echo service).

Once both sides are aware of each other’s addresses and codecs, they can start sending media directly to each other using theReal-time Transport Protocol. The gateway is only involved in setting up and tearing down the call, so I can keep you on the phone chatting about the meaning of life for an hour, and the gateway will only be woken up to say “bye” when one of us hangs up. This means that the cost of making an hour long call through the gateway is remarkably small.

Fargo has been extensively tested with telepathy-gabble, both on the n900 and under Empathy. There are some corner cases which don’t always work as well as they could (eg NAT boxes which don’t support hairpin routing, which only work if the SIP server provides a media relay) because many SIP implementations (including telepathy-sofiasip) don’t support ICE candidate negotiation. Also, if there are no compatible codecs between the XMPP client and the SIP client then the call will fail. All other cases which we tested seem to work fine though.

In addition, have some test scripts which demonstrate a Fargo + ejabberd combination comfortably sustaining a rate of two new logins and two new calls per second on a single-core VM. Calls were limited to 10 seconds each in our tests, but since Fargo is only involved in setup and teardown, the length of calls shouldn’t be very important anyway. Fargo also plays nicely with ejabberd’s “bare_source” load balancing method, so if your gateway becomes too popular, you can just add a few servers and cluster.

Currently, Fargo doesn’t relay IMs, and only supports negotiating raw-udp transports, so it’s probably best used in conjunction with a SIP server that includes a media relay. It also relies on your XMPP server to store your roster rather than trying to store one itself. The program is written in Python (using twisted) and utilises telepathy-sofiasip for the SIP side of things (this could in theory be replaced with another connection manager to handle other protocols). Don’t hesitate to get in touch if you want to know more, or get involved.

October 16, 2009

Mind Control

Filed under: collabora, facebook — Tags: , , , , , , , , — alsuren @ 5:35 pm

My echo bot has received a bit of attention since my last post.

Add echo@test.collabora.co.uk to your jabber/gtalk friends, and you can see what I mean.

Note that it currently doesn’t automatically restart itself when it goes down. This is so that I can try to debug crashes rather than leaving them unnoticed. If echo@test.collabora.co.uk seems unresponsive, try gabble.echo@test.collabora.co.uk for now, and send me an email. I will try to add a watchdog bot soon, so that we can have a more reliable service, but I’m dancing all this weekend.

October 9, 2009

Telepathic Reverberations

Filed under: collabora, facebook — Tags: , , , , , , , , , , , , — alsuren @ 4:05 pm

If you have ever had a call with someone where something wasn’t working, and you’ve wondered whether it was your computer or your contact’s that was broken, I have the answer for you. It takes the form of a user that you can add to your contact list, and call to test your setup. If your contact does the same, then it should be very simple to narrow down where the problem lies.

If you are using XMPP (or Google Talk or Jabber if you hate acronyms), then gabble.echo@test.collabora.co.uk is the user you want. You can add it to your contact list and it will add you back. You can send it a message and it will send it back to you. If you call it, it will send your audio/video straight back to you. It might be a good idea to put headphones in before you do this though, to avoid feedback loops.

The bot is written in Python, and source can be found at http://git.collabora.co.uk/?p=user/alsuren/telepathy-ashes.git. It uses telepathy-gabble to connect to the server and Farsight for the streaming. This means that it has all of the same capabilities and limitations as Empathy on Linux. This makes it good for testing interoperability. If you try it out and have problems, feel free to leave a comment here, or join us in #telepathy on freenode and I (alsuren) will be happy to help you out.

A few things to note if you are having problems:

Users of the Google Mail interface are currently limited to audio only, because Google only uses the h.264 video codec, which cannot legally be distributed with Empathy. If enough people report this problem to them, then maybe they will include Theora as a fallback. There are ways that I could work around this problem for the echo service, but then it wouldn’t be a very good tool for testing whether you’re capable of calling Empathy users ;-).

If you are using Ubuntu Jaunty and pulseaudio, you may notice high CPU usage and a really long lag in your audio. This is a known issue and is fixed in the pulseaudio that ships with Karmic.

Watch this space for an MSN echo service (since telepathy-butterfly now supports voice/video for MSN). Also, if you are interested in writing multi-protocol chat bots, I’m planning to re-factor the code and distribute it as part of telepathy-python. If you want a say in the new API, speak now.

September 11, 2009

Telepathic Ramblings

Filed under: collabora — Tags: , , , , , , — alsuren @ 11:09 am

Okay, so I should probably inform people of what I’ve been working on recently.

A few of you might remember my cupsandstring Telepathy (IM) client from a few years back. Well I’ve recently revisited that, because someone was asking on IRC, so if you want to read the source, it won’t make you want to puke quite so much these days.

I made a skeleton Skype connection manager way back when too. (Don’t get excited: it’s based on the public Skype API provided by their UI, and only connects to your currently configured account). It never really got off the ground though. A few weeks back (go check the bzr log if you care) I picked it up again. I got it to the point where I could use it for text chat, and have been using it to replace the ugly bits of the Skype UI. It’s currently made of gaff and verbose, and has to be run in a konsole because I make it drop into a debugger whenever anything unexpected happens. This will continue to be the case until I have a decent testing framework for it.

Guess what my next project is: A testing framework! The spec has been discussed on the Telepathy mailing list. I’m trying to make it as generic as possible, so that I can try it on a well-tested connection manager (gabble) and then move on to butterfly, and then spyke when I’m feeling brave. Since I don’t want it to depend on the protocol too much, I’ve designed it around the idea of an echo bot (which can run remotely or locally) and a set of test scripts, which mostly just poke the echo service (like Skype’s echo123), and expect a sane reply. The bonus of this is that you can test interoperability between haze and gabble/butterfly/idle (and Kopete’s protocol code if it ever becomes telepathic) for free.

Due to all of my noise in Telepathy-related communication channels, daf suggested that I apply for a job at Collabora. I did so, and officially started on Wed. That was a fun day. I arrived in the office, and daf and wjt greet me with “Hey. We’ve thought what we want you to work on first: an echo service”. To which, I could only respond “What? Like this one?”, flashing my eee at them. Turns out their priority is something that works with gabble, and handles media streams (initially just using gstreamer’s audiotestsrc but eventually actually echoing stuff, and then doing things like disabling codecs). Hopefully I will get something workable by the time daf moves to America, but I would like to write a few automated tests for the text functionality before I start adding lots of crazy features.

Also, I’ve had to re-wrap most of the functionality from python’s telepathy.client library, because it contains too much magic, and is impossible to inherit from. I’ve tried to do it in a way that could feasibly be auto-generated from the spec, so that’s a project for when I’m done with my echo service. Maybe I’ll even push it into telepathy.client. It’s great to be working on Open Source software again. :)

February 9, 2008

Fail

Filed under: Uncategorized — Tags: , — alsuren @ 1:07 pm

So, erm… Yeah… some of you may have noticed that I’ve stopped dancing. This is because Gill and I broke up, and it was decided that it would be best if one of us stopped going for a bit. This means that I may end up doing salsa or tango or yoga or something to substitute.

This week, I have been mostly being reclusive, and tarting about with telepathy stuffs. It’s quite annoying, because the voice/video chat part of telepathy is mostly “bonged”. I seem to be developing a hacker beard (of sorts) as well. Also: If you hear odd sounds coming from the jcr-mail machine, it’s because I’m trying stuff out (and that’s the only other machine that I have admin access to). I’ll try writing a proposal for what I want voice/video calling to behave like in the next week or so, once I have worked out the extent of the mess it’s in now.

Now, I believe that it is food time, and then work time.

December 10, 2007

Telepathy

Filed under: Uncategorized — Tags: , , , , , — alsuren @ 8:48 pm

Some of you may be aware that I have been messing about with a lot of projects based on telepathy. If anyone wants to see what telepathy is currently capable of, try (in gutsy):

sudo aptitude install empathy telepathy-haze
empathy

Empathy is a gnome-based front-end, which seems to work reasonably well. Haze is the libpurple (gaim) based connection manager (so it can connect you to msn, jabber and suchlike). There is also a connection manager called gabble, which is a dedicated jabber connection manager, supporting jingle voice/video (though the only client that understands video is the one on the nokia n800.)

(Cambridge prisoners should note that running tsocks empathy might not work as expected, because the connection managers are automatically started by dbus. Try tsocks dbus-launch empathy. That should work.)

The WordPress Classic Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.