The gtalk/skype/sip/irc asynchronous UC mashup
I’m a regular visitor to the Voipuser’s conference – which is a weekly conference call about VoIP. The call is hosted on ZipDX’s wideband conference bridge. The quality of the guests combined with the HD audio on the bridge means that the recordings make decent pod casts.
For about a year now, we have been running a Skype gateway so that people who couldn’t or didn’t have time to set up a SIP device could call in (free) via skype.
Like most conference calls, it works best with a text back channel so that URLs, part numbers, email addresses etc don’t need to be laboriously spelled out. For historical reasons this is an IRC channel on freenode.net . So a typical user would have a softphone fired up on their laptop for the audio and an IRC client for the text.
Skype users are very loyal to skype chat, so a few weeks ago I started looking at trying to bring the IRC chat to them in a more convenient way. Last week I got an experimental system running that did just that. Here is a sample of the result:
In some ways that looks like an ordinary skype chat. Indeed for the skype user, that is exactly how it behaves, except that messages from the vuc.me user are in fact from multiple IRC users.
If you look a little more carefully, you’ll see that there is discussion of a gtalk connection (google talk). That’s because I’d also made the system support connections from gtalk too.
So users from all three of the ‘islands’ in the VoIP world (SIP, Skype and GoogleTalk) could all participate on an equal basis in a conference about VoIP. Not only that, but their IM messages were also exchanged freely, all with the correct attribution.
How was this done?
Asterisk is the key ‘glue’ here, with it’s support for Skype and Gtalk channels. But even Asterisk doesn’t support the kind of gatewaying we needed for the IRC . For that we needed the (excellent) asterisk-java package which communicates with Asterisk and allows you to manage and control calls in Java. I used the PircBot package to implement an IRC connection in Java.
As this was a prototype, I didn’t want to get bogged down in writing the gateway in Java, I wanted to use something more expressive and easier on the keyboard, so I used Groovy.
The end result was a very few lines of Groovy, here is the meat of it (sorry Jay) :
Now the fun and powerful thing about this code is that it is asynchronous and event driven. Each event from Asterisk is checked to see if it triggers any of our desired actions, but this triggering is done on a fine grain – in the last block we are only interested in Skype chat messages that are to the skype id ‘vuc.me’. We can write expressive filters in code to do the matching, then define the action to carry out in just a few lines. The over all effect is like the syntax of unix’s AWK pattern matching language.
This is quite different from the kind of scripting you see in twilio, asterisk dialplan, tropo and other telephony scripting environments. They are all about call control, this is about call enhancement. A traditional telephony scripting language sets up the call, but once the 2 (or more) parties are talking they step out of the way. Here I’m adorning a live call with extra asynchronous information.
There are systems that do this sort of adornment – ZIP DX sends messages to the SIP clients throughout a call allowing phones to display the name of the current speaker – but that’s more of an endpoint feature (see also the very cool thrutu). In this case the adornment is taking place in the middle of the network and in the middle of the call – and thats new (at least to me).
I’ll be polishing the prototype and hopefully have it deployed in a stable basis in time for next Friday’s VUC.