Raspberry Pi and Asterisk

Asterisk running on Raspberry Pi

I’ve been playing around with a Raspberry Pi for a few weeks now and thought I’d see how well Asterisk Open Source PBX works on it.

<%ThickBox(http://blog.provu.co.uk/media/4/20120618-raspi.jpg|Raspberry Pi)%>Raspberry Pi running on my desk

I’ve tried a couple of different versions of Debian on this device and have settled with Raspbian since this makes use of the floating point co-processor that is emulated in the normal Debian Armel packages. It’s early days for Raspbian yet and all the Debian packages have to be re-compiled but most stuff seems to be done and it works very well. Raspbian should perform better for tasks relying on the not-very-powerful ARM11 CPU on the Raspberry Pi.

As for Asterisk, proper Debian packages already exist for the Armel compiled operating system and it is simply a case of running “apt-get install asterisk” on the Raspberry Pi and it installs and works.

At the moment there is no package for Raspbian and also, I wanted to try out Asterisk 10. So I compiled from source.

The steps I took were:

  • Download the source from the Asterisk website, extract the tar archive
  • I started from the “hexxeh” Raspbian image which can be found on the Raspbian website. This already comes with most tools needed to build software, if you have installed from somewhere else just make sure you have got the build-essential Debian package
  • You will also need to install these packages: libncurses5-dev, libsqlite3-dev, libssl-dev (or chan_sip will be automatically unselected, this isn’t needed if you don’t want SIP)
  • Possibly more packages if using a different image of Raspbian or you’ve built your own.
  • Now back in the Asterisk 10 source folder you just extracted, issue the command “./configure –disable-xmldoc”. The option is to allow it to continue without installing the libxml2 development package
  • Now before running the build, it’s a good idea to check the modules you need will actually be built, the command: “make menuselect” will bring up a text menu that allows you to check the modules. In particular make sure chan_sip in the channels section is selected!
  • After that simply run: “make”. This will now compile Asterisk and all the modules you’ve selected. This will take around an hour on the Raspberry Pi native hardware! Note: you can use a cross compiler on more powerful hardware to build packages much quicker.
  • Now run: “make install” which will install the compiled software
    • <%ThickBox(http://blog.provu.co.uk/media/4/20120618-raspbian_asterisk.png|Asterisk 10 running)%>Asterisk 10 running

      Now you have installed Asterisk, you can run “make samples” to generate sample Asterisk config or write your own.

      So how well does it work?
      Surprisingly well I thought for a CPU that is generally thought to be approximately equivalent to a Pentium II 300 MHz. I have not done serious load testing but I set up a conference bridge (using the new confbridge feature in Asterisk 10) and it very easily handled 4 local SIP extensions in a conference at once. It’ll be interesting to see how much transcoding it can handle.

      This doesn’t mean that we’re going to start selling IP-PBX based on the Raspberry Pi. The hardware is still a bit too new and untested for the time being and the software is still very much in development. The main reason though is that for low-end hardware to run a PBX off, things like Sheevaplug make more sense. This has a more powerful CPU, more memory and by the time you factor in storage, power & casing for the Raspberry Pi, a Sheevaplug isn’t much more expensive.

      The Raspberry Pi’s CPU is a couple of generations out of date ARM11 core with ARMv6 instruction set. Where the devices shines is the GPU attached to it. This is a Broadcom VideoCore GPU and is pretty impressive indeed. It’s intense graphical processing that the Pi does best, that fact it can decode 1080p30 h264 “HD” video is very impressive (and I have tested this too).

      So while it runs Asterisk quite nicely for just a few phones not doing very much, it seems a bit of a waste to use the Pi for this since it’s not using it’s powerful graphics engine at all. I need to think of some graphical uses for it! Perhaps a fancy OpenGL-ES based call centre wall board system.