555-LIAM

Let me just give my old friend Liam Neeson a quick call and see what he’s – oh, hello? Liam?

My midterm project for Redial is entitled “555-LIAM.” My computer runs a loop of that one scene that everyone knows from Taken, and at any time I feel like it, I can call in to have him tell me that he will find me, and he will kill me.

How did I do this? With a very particular set of skills, of course! My first thought was to set up a live streaming media server that would broadcast a separate video and audio stream. The video stream would be picked up by any old computer and played back. The audio stream would be accessed by our ITP Asterisk server using MP3Player and played back to any caller.

It didn’t take much research to find out that setting up my own live streaming server would be, among other things, very expensive. I looked into using UStream or Justin.TV as a live streaming service but as far as I could tell, they don’t offer a separate MP3 audio stream to accompany their video streams. So I decided to do it all locally.

This created a new challenge: if I were to build my streaming media server locally, I would also need Asterisk to be running locally. A bit of searching led me to AsteriskNOW, which is essentially CentOS with Asterisk all ready to go. I installed that in a VM through VirtualBox, and a few minutes later, had this:

Screen Shot 2013-03-07 at 4.33.51 PM

Success! The next step was to call in to confirm everything works as expected. I made an IAX softphone with Zoiper (running on my Galaxy Nexus through WiFi) and after changing my VM’s networking from NAT to Bridged (to give the VM its own IP on my router), I was able to call in and run a hello world program.

The last thing I needed to get Asterisk to do was to consume and playback an MP3 stream. Normally, this is easily handled with the MP3Player application, however it doesn’t seem to work out of the box with AsteriskNOW. Searching around led me to this forum post on VOIP-Info which first had me check for mpg123. It didn’t exist on my box, so installing and compiling that was step one. The forum post goes on to explain how you can then trick MP3Player into playing a stream hidden as a shell script with an .MP3 extension with some very dirty, bad-feeling code. But it works!

The last step was to create the audio stream. This was pretty straightforward. I used Nicecast, which listened to my looping video in Quicktime Player and made an MP3 stream out of it. Using the shell-script-MP3 trick from before, I got Asterisk to find that stream on my local network and play it back to the caller.

At this point I realized that Nicecast doesn’t just make local streams; it makes publicly accessible ones as well. So I probably could have skipped all the local Asterisk business and just tried plugging my computer’s IP into ITP’s Asterisk server. A few firewall issues would probably have come up, so it might have been just as much effort to make work. Regardless, I was really happy to have Asterisk set up on my VM so I could go and take a peek at everything under the hood. And, of course, to add Liam Neeson to my contacts.