My Life Is A House

My daily life with all things Libre and Open

Tuesday, August 17, 2010

In the end - final report of my GSoC

Hi everyone!

It's have been great 12 weeks. While I failed to complete half of my plan (Telepathy Tubes support), I got working VoIP call recording - which was a reason why I get involved in this Google Summer of Code in first place. But before that I have little story how I got there. For just to see how it works, see this video I made during conversation with friend of mine (sorry for faulty cheap headset, which forced to cut middle section of conversation with Pitivi, as headset just died on me). You can see me running Jokosher, choosing contact, doing recording and pressing stop and getting waveform redrawn, and in the end doing playback of recorded conversation.

First of all, I got old Michael Sheldon's code in which he tried to get all accounts, connect them, and then you could choose contact and call him (or her). Code has been rotten for some time in Launchpad branch, and Telepathy has changed lot of things here and there. First of all, I run old branch and saw that nothing worked. Piece after piece I gathered information how to connect to network, how to get contact handles, etc. People at Telepathy IRC channel (#telepathy at Freenode) were very helpful. Also I have to give thumbs up for Telepathy spec documentation - if you start to understand concepts, it is mostly all you will need. Also Python bindings have excelent examples.

In fact, things change so fast in Telepathy world, that I had to build newer Ubuntu package for Python bindings, as Ubuntu Lucid one lacks Account Manager support. With a tip from Michael I made newer one using 'checkinstall' program, which allows fast and dirty Debian package building. If you plan to test my code in Lucid, download it from here and install it over your current version. If you want to build it yourself, get a git repository checkout, build it, execute 'checkinstall' in bindings directory, change settings (name of package, what does it provide, etc. - make sure they fit current naming/version scheme of python-telepathy package) and run it. It will build a package and install it. For other distros just be sure you have newest Telepathy and it's Python bindings installed. Additionally, for all distributions you will need Farsight Python bindings and Farsight/Telepathy glue library bindings too (named python-farsight and python-tpfarsight in Ubuntu).

After completing basic connection and retrieving information about accounts, I started to work on doing actual call. At first, I simply hooked autoaudiosrc and autoaudiosink as way to hear and record for call. It was first time I stuck, because implementing a call properly within Jokosher required to understand what actually happens there. In the end, it was very important to add watch for Gstreamer pipeline bus so Telepathy/Farsight would know what happens and could act on that. After that I could do calls, but there was no recording done.

For actually recording it, I had to join all Farsight pipeline stuff with Jokosher inner recording system. Jokosher records each instrument using separated bin, which are put together in one big pipeline (allowing to set states in masse). Not wanting to complicate things, I just extended current Farsight pipeline with two tees and split output and input so I could record and send my voice to remote participant in same time - and I could record and hear voice of from other side too. Recording is done by similar bins as for normal instruments, just tweaked for VoIP streams. This is where I stuck quite seriously. In the end, actual solution to my problem was quite logical - Farsight sink pad for sending voice to remote end and source pad for getting it from there - gets created only after whole pipeline is set to playing state. That means that those pads expects any other element to be set to playing before it gets linked to it. Thanks Tester from #farsight@Freenode for explaining it.

Before SoC deadline I tried to fix all small things which have popped up during implementing call support. I failed to link VoIP pipeline into main one (so it would have proper refresh and waveform redrawn regularly), but it requires too much changing of current state, so I hope to deal with that together with Michael post-SoC.

So, for now I got a call recording working, but it lacks waveform redrawing during conversation, and all is done separately from main pipeline, so it is not perfect yet. However, it gets job done (today I recorded conversation with my friend for 30 mins), so anyone can get cracking recording their podcasts and meetings. First, make sure you have all dependencies I mentioned above. Second, I would suggest to use Pulseaudio to get software mixing of audio streams so nothing would block playback. Third, pull a code from my branch (bzr branch lp:~pecisk-gmail/jokosher/telepathy-ng). Then go to telepathy-ng directory and launch Jokosher with 'Jokosher/Jokosher'. Add VoIP instrument (VoIP Local will be added automatically), Then change playback system to PulseAudio (Edit => Preferences). After that, choose your conversation partner using 'File => Instrument inputs...'. After that press Record button and wait. As I haven't find a way to bind pipelines yet, there is no "Waiting..." message. When your partner will accept call, event for each instrument will appear. Then conversation (and it's recording) will be started. After finishing call just press stop to put pipeline into null state and redraw waveform for each file.

Please, report all bugs and suggestions to me, pecisk at gmail dot com, as code will have long way to be officially included in Jokosher, so let's not bother Launchpad with bug reports yet. I hope to get call support in user friendly state till the end of August so we can try to include it in newest Jokosher release.

Labels: , , , ,