Experiments with VoIP + Ruby

Adhearsion & Asterisk Overview

In recent months there seems to be a bit of attention building up with a project called Adhearsion which provides an excellent Ruby interface to the Asterisk VoIP open source server. I discovered these projects last week while researching into a VoIP based project that might end up doing.

Adhearsion provides a very simple way to control login in telephony applications that are powered by Asterisk and it’s AGI API. This allows developers to create bespoke switchboards systems very easily and quickly. While phone switchboards are seen as an annoyance, you can do some very nice things, and the examples provided show how one can integrate this with external API’s, such as weather and stock quotes very quickly.

To add to the existing Adhearsion / Asterisk bindings, I was interested in the possibility of looking at text-to-speech synthesis, because by default Adhearsion can only play back pre-recorded sounds such as GSM files. Likewise, to complement this, I also wanted to see how viable it was to use basic speech-recognition. I’ve not looked deeply into this, but this is something I plan to look at and maybe do follow up post / presentation about at some point in the future.

Using Text-To-Speech

Festival TTS, which can be easily installed with most Redhat/Debian based systems provides a simple means for providing text-to-speech. There are also some basic Ruby Bindings which simply wrap round the command line festival command.

Using Speech Recognition

Speech recognition is not so easy. Phones generally only have a 8Khz signal, which means letters such as F and S can easily get mixed up due to the loss of sound quality. For accurate speech-to-text recognition, you really need 16Khz signals. However using a very limited vocabulary (utterance is the technical term), one can do some privative recognition via CMU Sphinx.

Again CMU Sphinx 2.x can be installed easily on Debian/Redhat based distros. Sphinx 4 however is Java based and needs be installed manually from the binary packages provided on the CMU Sphinx website. If you are using Debian based distro’s you should be warned that it typically ships with the CGJ flavoured virtual machine which is much less efficient than the original Sun JVM, so you will want to do something like sudo apt-get instal sun-java-bin to resolve this.

Sphinx takes a while to load, so it would probably be best to setup some sort of daemon system, of which I have seen some Perl scripts for that might work.


While I’ve not covered anything in detail, if anyone is having to do a similar project, it might help point them in the right place. If there are people who want to know more (or know more and would like to collaborate with me on a possible tutorial) please give me a shout at jason at hybd dot net. If a number of people are interested, it would certainly motivate me to do a detailed post regarding the topic.

Listening to Electronic / Acid Jazz:
Treat Me Mean, I Need the Reputation - Xploding Plastix

Free Designs

Below are a handful of open source / free web designs