FreeSWITCH on the Raspberry Pi

The $35 mean machine really comes out on top for slapping together a PBX very quickly.  Before I started this project, I saw Asterisk being ported over onto the Raspberry Pi, so I decided to take a shot at it a couple months back just before ClueCon for FreeSWITCH.  Here were the results:

You initially want to start out with a Raspian image (I used Wheezy): http://www.raspberrypi.org/downloads

DD the image onto your SD-card.  You can use the wiki located here for instructions on how to do it.

Be sure to go through the install process using raspi-config.  You will want to expand the partition, etc.

And now we begin…

I like to roll around as root so as soon as I logged in as the default ‘pi’ user, I immediately dropped into a sudo shell as root.

sudo -s

I immediately installed several other pieces of software/libraries I like to have for this build as well as for my own future use:

apt-get update
apt-get install screen default-jre mlocate autoconf automake libtool libncurses5-dev libjpeg8-dev default-jre git libperl-dev libdb-dev libiksemel-dev gnutls-bin libgnutls-dev

While we are at it here, lets link up a couple libraries:

ln -s /usr/lib/arm-linux-gnueabihf/libgdbm_compat.so.3 /usr/lib/libgdbm_compat.so
ln -s /usr/lib/arm-linux-gnueabihf/libgdbm.so.3 /usr/lib/libgdbm.so

The first thing to do here is to clone the git repo on the unit, but we have to change directories to:

cd /usr/local/src

For a stable release:

git clone -b v1.2.stable git://git.freeswitch.org/freeswitch.git

or if you want the latest and greatest

git clone git://git.freeswitch.org/freeswitch.git

From here we will change directories into the FreeSWITCH dir.

cd freeswitch

We then will want to run the boostrap to make the modules.conf file for us to edit

./bootstrap.sh

You can now edit the modules.conf if you want to add any additional modules by uncommenting them out.  (For my build, I uncommented mod_dingaling which gives support for Google Voice)

Once that step is done, lets configure:

./configure

After configure was done, I edited the makefile to remove the second instance of “-Werror” which is a flag that stops the build process on a warning.  Info: Not doing this will stop the build, so if you hate yourself and want to waste hours of RasPi CPU time, feel free to do this continuously.

vi makefile

just an FYI: if you get angry with the arrow keys in vi, you can

:set term=cons25

…which should make you happy again.

I went ahead and removed the second instance of “Werror” within the make file because I was getting possible irrelevant warnings that were stopping the compile process.  This is a cheap way around and probably isn’t recommended as it could create segfaults within FreeSWITCH…but I did it anyways. (This is proof of concept…what do you expect here?)

Once we are gucci, we can continue with make:

make

and then we shall install that puppy

make all install cd-sounds-install cd-moh-install

After many relentless hours of compiling; if there were no errors,  you have successfully built FreeSWITCH.  Lets run it!

/usr/local/freeswitch/bin/freeswitch

Alternatively, you could add some tricks to it like chowning the FS directory so it doesn’t run under root, but this was a quickie proof of concept to show that it is possible to run FS under the RasPI.

My close friend Intralanman over at FSS gave me the glorious idea of using distcc with the Pi to help speed along the process.  I may toss up notes or a new article including it.

If you feel like going back to raspian but want to save you current image, you can always dd it off using either your linux or mac box.  I usually dd and compress at the same time to save space.  It will compress nicely too:

dd if=/dev/disk2 | gzip > {image_destination}/freeswitch_image.dd.gz

Cheers!

4 thoughts on “FreeSWITCH on the Raspberry Pi

  1. Hi Kev,
    Great job on the post. Even a noob like me can make it through them.
    I think I found an important omission. When ran ./configure it threw these errors:
    configure: WARNING: OpenSSL include files were not found
    configure: error: OpenSSL and associaed developement headers
    I did an apt-get apt-get install libssl-dev and did re-ran ./configure and all seems to be well.
    TekMason

  2. Have you found a proper fix for the duplicate -Werror in the makefile?
    It takes an aweful long time to do the whole process so I’d like to end up with something stable in the end.
    TekMason

  3. Hey TekMason, there has been an update last time I checked, and the flag can now be taken out prior to compiling now which is a relief. This post was done before FS officially supported the raspi.

  4. Hey TekMason,
    That actually may be accurate. I do keep libssl-dev handy on my unit so I may have omitted this by accident on my post. Thanks for the update!

Leave a Reply

Your email address will not be published. Required fields are marked *