Speed Improvements, Security Fixes, Fax

Check the downloads page for the latest RasPBX image dated Jan 19th. It is upgraded with kernel and firmware version 3.6.11+, which gave us a considerable speed improvement compared to the previous image, even without overclocking! Very convenient, especially when working with the FreePBX GUI.

This image also features the latest Asterisk 11.1.2, fixing a DoS vulnerability that was present in all Asterisk versions. Read here for details. If you are already running Asterisk 11, you can upgrade to 11.1.2 by calling


or alternatively also with apt-get dist-upgrade. Asterisk 11.1.2 has been added to the RasPBX repository on January 10th. To see the version running on your RPi call

asterisk -r

Finally RasPBX has recently added fax capabilities with HylaFAX. An easy-to-use configuration script provides you with fax to email. Print to fax is available with any compatible HylaFAX client. See the documentation page for details.

P.S.: The image from Jan 16th has been replaced with an updated version due to a bug in the CDR reports. If you downloaded it, read instructions for fixing the bug here.

Asterisk 11

On October 25th Asterisk 11 has been officially released. It seems to be working well on the RPi so far. If you want to give it a try, install it with:

apt-get update
apt-get install asterisk11 freepbx

The latter will also install the latest FreePBX version 2.11.0beta1, which is compatible with Asterisk 11. The Asterisk package contains version 11.0.1. After installing the packages above, you will get continuous updates with apt-get dist-upgrade in the future.

To make the commands above work, you need to have the latest version from the downloads page, or at least the September version with upgrades installed.

Asterisk 11 and the latest FreePBX is still to be tested on the RPi. If you like to join the testing, your results and comments are highly appreciated!

P.S.: When upgrading from Asterisk 11.0.0 with apt-get dist-upgrade run

apt-get -f install

to fix some changed dependencies in the new Asterisk 11 packages.

Online Upgrades

A few improvements and additions are already in the pipeline, but I was looking for a convenient way to get new enhancements to existing installations for some time. System upgrades should be capable of:

  • Delivering bug fixes and security patches for all installed software packages
  • Add new software and configuration improvements to further enhance the system
  • Avoid the hassle of re-flashing the SD card and manually transferring all settings and customisations people made.

To achieve this, I wrote a small upgrade tool that is using an additional Debian repository specific to the RasPBX project. Bug fixes and security patches for software that was installed through the Raspbian repositories are already delivered through apt-get dist-upgrade. Patches for additional, non-Raspbian software will be delivered through the RasPBX Debian repository. On top, the upgrade tool also installs new packages to deliver enhancements and additions as well.

To take part in the upgrades, first-time installation needs to be done running this command on the console:

wget -O /tmp/raspbx-upgrade http://repo.raspbx.org/raspbx-upgrade && chmod 755 /tmp/raspbx-upgrade && /tmp/raspbx-upgrade

This step is required only once, subsequent upgrades can be performed by just running:


The downloads page will be continuously updated with short descriptions whenever new upgrades become available.

The new system has only been tested with the latest raspbx-12-09-2012 release, no guarantee if it works with previous versions as well.

Some additional background information:
The raspbx-upgrade tool calls apt-get dist-upgrade, thus security fixes of all Raspbian originated software will be installed. This is the recommended way to keep your system up to date anyhow. Raspbx-upgrade is installed as Debian package as well, thus if you manually run apt-get dist-upgrade, upgrades to raspbx-upgrade will be installed as well. This will however not directly install new software, you need to call raspbx-upgrade to get new additions on top. If you do not run raspbx-upgrade, nothing new will be installed to your system and you can still use apt-get dist-upgrade in the way you are used to it. There are no automatic upgrades happening for now.

Concerning expected installation lifetime: Debian Wheezy will be officially released as stable soon. From this day, Wheezy will be the stable distribution for at least 2 years. This is the expected time span during which upgrades can keep your installation up to date, maybe even for longer.

Raspbian Based Image

The first Raspbian (Debian7 / Wheezy) based image is finally available on the downloads page. Credits go to Hexxeh for providing the base image. Credits also go to the lame german for his excellent description on how to make FreePBX 2.10.0 work with PHP 5.4.

The documentation page is updated with instructions on how to complete an initial set-up.

A few details on the improvements:

1. Raspbian

Raspbian provides optimised performance on the Raspberry Pi by using the ARM processor’s hard float instruction set.

2. Exim4

For email delivery, Exim is robust and easy to configure. Check the documentation page on how to set up email for your RPi.

3. Watchdog

In case your RPi crashes sometimes, you might have chosen a non-suitable power supply. In order to at least reduce the downtime in such a case, the activated watchdog automatically reboots your RPi 10s after a serious crash.

4. SSH hostkeys

No hassle with regenerating your host keys. It is done automatically on the first boot.

Testing – Update

I would like to give a brief update on the crashes reported in the previous post. As my testing RPi is currently installed in a remote location, I was not able to try other power supplies yet. But thanks to Brandon’s great tip I have activated the BCM2708 watchdog function. The RPi is now automatically rebooting after every crash, thus leaving a downtime of maybe a few minutes per week.

Update, Nov. 1st 2012:
The issue seems to be resolved by setting

vm.min_free_kbytes = 16384

in /etc/sysctl.conf, according to this description:

After adding this line, the crashes went away. This fix is included in upgrade #4 as well as the latest image dated 01/11/2012.

I have been trying several different power supplies as well, but it did not really help. In the end, I am just using an old Samsung phone charger now and it just works fine.

Testing Results

Finally on July 22nd I had the opportunity to install the RPi in a real production environment in Germany. Since that day it is used as PBX of a non-profit organization, running a permanent installation of 7 extensions. For a period of 3 weeks following July 22nd several additional extensions were installed to support all kinds of organizational activity of a greater event. These 3 weeks gave me the opportunity to test the system running with greater load than usual. A few numbers:

Number of extensions: 19
Number of trunks: 9
Average number of calls per day: ~60

The RPi directly replaced a PC based Trixbox that was in service for almost 4 years. Voice quality was absolutely perfect, and overal service quality was in no way inferior to the previous Trixbox installation. Users did not notice their calls were now routed through the RPi instead, however none of them used the webinterface (which runs slower indeed compared to the old system). On peak days I recorded more than 100 calls per day. 3 concurrent calls were reported several times in the logs.
The whole installation is using SIP technology only. Most clients are AVM Fritzboxes, and several different Germany based SIP providers are used as trunks: 1und1.de, dus.net, easybell.de and partly sipkom.com

I consider the whole test a big success. However, some problems appeared as well: Directly after connecting the RPi to a PoE enabled HP V1910 switch it crashed very often. Disabling PoE on the port used by the RPi made the frequent crashes disappear, but still the device locked up every 3 to 4 days. It is hard to say what really caused this, but I am suspecting the unstable power grid at the place of installation as the source, because other devices also crashed sometimes. In order to find the cause for the crashes I will try different power supplies as soon as possible and will monitor the situation closely in the long term. The crashes need to be resolved definitely…


I’ve been testing the system for 2 weeks now at home, everything I tried worked very well. Only the CDR reports needed some fixing, they were not working yet in the image posted previously. To apply this to your setup run in a root shell:

apt-get install libmysqlclient-dev
cd /usr/src/asterisk-
make menuconfig

In section “Add-ons” select “res config mysql”, “app mysql” and “cdr mysql”. On top of this, select additional sounds in “Core Sound Packages”, “Music On Hold File Packages” and “Extras Sound Packages”. In all 3 sections I’ve selected wav, ulaw, alaw, gsm, and g729 just to be sure. This enables most of the voice messages Asterisk is playing in some occasions.

Then run:

make install
amportal restart

FreePBX up and running!

The good news: it works! And actually, it works very well! After having set up the latest FreePBX 2.10.0 + Asterisk successfully, everything is running very smoothly on my Raspberry Pi here. I was a bit afraid the Raspberry would not have enough CPU/RAM resources to power FreePBX + Asterisk, but it does. And it runs quite well, the web GUI is responsive enough to work completely normal. And I did not even use a lightweight webserver, just the regular Apache2 / PHP5.3 / Mysql 5.1.

After FreePBX was finally installed I set up 2 extensions to connect my Android phone with Sipdroid and an old FritzBox used as ATA. Test calls between both phones on my local network had perfect quality, and during the call the CPU usage of the asterisk stayed below 5%. It looks like the Raspberry could handle a few calls from a small office easily. However, I have not yet installed the FOP and also did not try transcoding / conferences or other stuff yet.

After my own install was complete I read Mo’s blog here, he has been using FreePBX 2.9. I have tried the new 2.10 version with the latest GUI myself and document my own install procedure below. During the install I encountered a few glitches and had to fix several things myself. It looks like the 2.10 installer has some issues, at least it did not work out of the box for me.

Make sure to have a 4GB card at least with the root partition expanded (using gparted should be the easiest way).

First install Asterisk as documented in the previous post. Then:

apt-get install -y apache2 php5 php5-cli mysql-server-5.1 php-pear php5-mysql php-db libapache2-mod-php5 php5-gd php5-curl
adduser asterisk --disabled-password --gecos "asterisk PBX" --home /var/lib/asterisk
adduser www-data asterisk

Set the mysql root password during it’s installer.  Then edit /etc/apache2/envvars and set user and group to “asterisk”. I had to do this here instead of in /etc/apache2/apache.conf

Then create the databases (requires mysql root pw):

mysql -u root -p

on the mysql prompt, enter:

create database asteriskcdrdb;
create database asterisk;
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';


cd /usr/src
wget http://mirror.freepbx.org/freepbx-2.10.0.tar.gz
tar -xvzf freepbx-2.10.0.tar.gz
cd freepbx-2.10.0
mysql -u asteriskuser -pamp109 asteriskcdrdb < /usr/src/freepbx-2.10.0/SQL/cdr_mysql_table.sql
mysql -u asteriskuser -pamp109 asterisk < /usr/src/freepbx-2.10.0/SQL/newinstall.sql
chown -R asterisk:asterisk /var/run/asterisk



I tried to set the webroot to /var/www but this failed completely. No way to get this working in reasonable time. So I kept the default /var/www/html and instead edited /etc/apache2/sites-available/default

       DocumentRoot /var/www/html
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        <Directory /var/www/html/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all

Then of course call /etc/init.d/apache2 restart. I also needed to fix /etc/asterisk/manager.conf




secret = amp111


amportal stop
amportal start
sudo -u asterisk /var/lib/asterisk/bin/module_admin upgradeall
sudo -u asterisk /var/lib/asterisk/bin/module_admin reload

On top I was missing some symbolic links I believe the installer should have created for me, but somehow I needed this to make it work:

cd /etc/asterisk
rm extensions.conf
ln -s /var/www/html/admin/modules/core/etc/extensions.conf extensions.conf
rm features.conf
ln -s /var/www/html/admin/modules/core/etc/features.conf features.conf
rm iax.conf
ln -s /var/www/html/admin/modules/core/etc/iax.conf iax.conf
rm logger.conf
ln -s /var/www/html/admin/modules/core/etc/logger.conf logger.conf
rm sip.conf
ln -s /var/www/html/admin/modules/core/etc/sip.conf sip.conf
rm sip_notify.conf
ln -s /var/www/html/admin/modules/core/etc/sip_notify.conf sip_notify.conf

At this point I was able to log into FreePBX, then enabled all modules in the module admin. Somehow I was unable to reload the configuration so I had to disable the modules “Custom Applications” and “Recordings” again, because they had missing mysql tables. Also not sure yet where to get these from.