Freeswitch on Raspberry Pi

I’ve recently been playing about with Freeswitch and the Raspberry Pi, and I’m now running our small office PBX system on one.

What you need:

  • A Raspberry Pi
  • An SD card loaded with Raspbian Wheezy (the default Pi OS)
  • A SIP phone (of soft SIP phone on another PC)
  • Some sort of SIP gateway if you want to talk to the outside world

I control My Pi through SSH, but you could easily configure it with a keyboard and an HDMI monitor if you have them lying around.

1. Upgrade your OS

All of the following commands need to be run as the root user. That means you need to prefix them with


However, if you’re feeling lazy, just open a shell as the root user using

sudo bash

And ignore all the sudos. Of course, be careful as you could entirely mess your system in unexpected ways yada yada…. Of course, if you’re using a Raspberry Pi then the worst case scenario is that you’ll lost a couple of hours work and have to flash Raspbian onto the SD card again. Before running a command as root, think about why you’re running it, and why you need to be root to achieve it.

To fetch the latest repo index and upgrade any packages:

sudo apt-get update && sudo apt-get upgrade

2. Install pre-requisites

This is the minimum set of packages required to build on the RPi:

apt-get install autoconf automake gawk g++ git-core libjpeg62-dev libncurses5-dev libtool make python-dev gawk pkg-config  libperl-dev libgdbm-dev libdb-dev libssl-dev

3. Clone the stable version of Freeswitch

Don’t bother trying to find pre-built packages of freeswitch, it seems to be a fruitless exercise. Building from source is the way to go, and luckily git makes it pretty straightforward. Full details are on the Freeswitch wiki installation guide.

cd /usr/local/src
git clone -b v1.2.stable git://

4. Build

Building Freeswitch from source on the Pi is going to take a long time. In theory you could cross-compile using a different machine. I’ve tried doing this using an Ubuntu VM running on my normal desktop and I couldn’t get it to work, so personally I would have found it easier just to build straight away on the Pi itself. Luckily, this isn’t your main computer, so you can just leave the build running and get on with something else.

A note on screen

To that end, it’s very useful to use screen, especially if you’re connecting via SSH. Your shell runs inside screen, and if you disconnect your SSH session you can just open it again and reconnect to the screen session without losing all your work.

To install screen:

sudo apt-get install screen

You’ll see a shell. Work away as normal, disconnect your SSH session, and when you reconnect run

screen -r

and your session is restored.

Building Freeswitch

This includes the sounds for the demo voicemail and IVR, and music on hold, which is recommended. If you want to save a bit of time and storage space then miss off the “make all cd-sounds…” step. CD sounds are the best quality, and hence recommended for a demo, but there are lower quality sounds available – check the freeswtch wiki.

cd /usr/local/src/freeswitch
sudo ./
sudo ./configure
sudo make && sudo make install && sudo make all cd-sounds-install cd-moh-install

The last line will take a few hours to complete; I left it running in a screen session overnight.

5. Test

sudo /usr/local/freeswitch/bin/freeswitch

You can check which IP addrss and port Freeswitch is using for SIP by running

sofia status
from the freeswitch command line. Try registering a SIP phone as user "1000" using password "1000".

6. Run on startup

Follow the guide for debian on the Freeswitch wiki.
If you copy and paste the init script it uses a different group to the one you assigned to the Freeswitch user using the “adduser” command. Edit


and set


and you should be fine. Now your Pi should start Freeswitch on every boot.
Have fun!

HP 620 Laptop Wifi Problems – Ralink RT3090

I’ve suffered from intermittent problems connecting to new Wifi networks with my HP 620 laptop for ages, and after a bit of testing with a new home network, I’ve finally figured it out:
HP laptops CANNOT see wireless (802.11) networks using Channels 12 & 13 – even those laptops built for EU markets!

For a bit of background, Wifi networks run on one of several different frequencies – the ideal if for everyone in your neighbourhood to be using a different (preferably non-overlapping) channel for the best performance  Apps like Wifi Analyser for Android will show you which channels are being used by networks around you.

For reasons best known to themselves, regulators in the EU decided to support 13 channels, and regulators in the US just the first 11 – leaving two channels, 12 & 13 that can’t be used in the US.

Because of this, most Wifi routers will use a channel from 1-11 for their default configuration, as it’s easier to use the same configuration worldwide. However, if you want to get better performance out of your home network it can be worth running it on Channel 13, as there’s likely to be fewer people using it. This is exactly what I did with my new router, and I was able to successfully connect:

  • A netbook
  • Two phones
  • A kindle
  • An iPad
  • A desktop PC
  • and a Raspberry Pi with a cheap Wifi adaptor

in fact every single Wifi device I could lay my hands on, with the sole exception of my work laptop, an HP 620. It turns out that the Wifi adaptor built into this laptop is stuck in American mode, and won’t show you any networks running on channel 12 & 13 – they might as well be invisible, they don’t show up at all.

I’ve run into this problem a couple of times visiting customers where I can’t see a Wifi network that everyone else can, and this is the reason why. It’s very frustrating, and there’s only two ways round it:

  • Use an external Wifi adaptor, or
  • Run your Wifi network on channels 1-11

Neither of these are ideal, but they’re the only ones open to you.

If you have the same problem with a different laptop, you could try seeing if you can change the region in your device driver software (using device manager and then going to the “Advanced” tab in the properties of your network card). However, as far as I can tell, this option isn’t available for those of us with an HP 620. If you do find a way to make this laptop work with channel 12 and channel 13, please let me know in the comments!

OpenELEC and Raspbmc compared

I’ve had my Raspberry Pi for a couple of weeks and I’ve been trying to get it working on and off as a media centre. There are two main competitors for the crown of getting an easy to use XBMC install onto our TVs; OpenELEC or Raspbmc. I’ve tried them both so you don’t have to.

OpenELEC (August nightlies)

This is an entire linux distribution, based off Debian, that is built entirely around XBMC. Think of it like the firmware you might have on your router or NAS. There are several official versions, one for each supported platform, with the RPi being the newest platform supported


  • Self-updating
  • Entire distribution
  • Huge community


  • No official RPi binaries means you need to build it yourself or trust other people’s build systems.
  • Builds take hours and need a dedicated linux machine with plenty of RAM – don’t try building in VirtualBox!
  • Updates should be easy but are actually a hassle because of the rebuilding needed
  • Even with nightly builds, only works with H264. I couldn’t get it to play XviD.

Raspbmc (RC4)

Again, a complete distribution, but especially for the Raspberry Pi means that it is tweaked entirely to fit around its idiosyncrasies (for example, performing a safe overclock to 800MHz through config.txt by default).


  • Brilliant installer. Different to any other RPi distribution – just download a small installer exe, which flashes a bootstrap script onto an SD card. Boot this, and the Raspberry Pi will then download all the files it needs, and repartition its own SD card. This makes installation an absolute breeze.
  • Video “just works”. DivX and XviD works in hi-def out of the box.
  • Similar self-updating structure.


  • Just one developer, and no git access. Sam is clearly a talented guy, but the project has already been brought to its knees by a DDOS attack on the update server which stopped users with an older version from rebooting. This reliance on the generosity of one person worries me.

Winner: Raspbmc

The reliance on one developer worries me, but at the end of the day it’s a breeze to install and works straight away. Even if the project died tomorrow I’d have a working XBMC install running on my TV on hardware that cost under £30; Raspbmc should certainly be your first point of call for a Raspberry Pi based media centre.

Hello, world!

I often find other blogs useful, especially when they write up how to achieve unusual things (more problems cross-compiling in a virtual machine, less how to BBQ a penguin). This is place I intend to do the same.