Improvements

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-1.8.13.0-rc2/
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
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';
quit

Then:

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

Then:

/usr/src/freepbx-2.10.0/install_amp
/usr/src/freepbx-2.10.0/apply_conf.sh

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>
        <Directory /var/www/html/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

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

replace

[AMPMGRUSER]
secret = AMPMGRPASS

with

[admin]
secret = amp111

Then

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.

Enjoy…

First compile

Finally after receiving my own Raspberry Pi (I didn’t seem to make it onto the first-to-be-delivered list) I successfully compiled the latest Asterisk:

apt-get -y install make gcc g++ libxml2 libxml2-dev ssh libncurses5 libncursesw5 libncurses5-dev libncursesw5-dev linux-libc-dev sqlite libnewt-dev libusb-dev zlib1g-dev libmysqlclient15-dev libsqlite0 libsqlite0-dev bison openssl libssl-dev libeditline0 libeditline-dev libedit-dev mc sox libedit2 libedit-dev curl libcurl4-gnutls-dev apache2 libapache2-mod-php5 php-pear openssh-server build-essential openssh-client zlib1g zlib1g-dev libtiff4 libtiff4-dev libnet-telnet-perl mime-construct libipc-signal-perl libmime-types-perl libproc-waitstat-perl mpg123 libiksemel-dev
cd /usr/src/
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8.13.0-rc2.tar.gz
tar -xvzf asterisk-1.8.13.0-rc2.tar.gz
cd asterisk-1.8.13.0-rc2
./configure
make menuconfig
make
make install
make samples
make config

I was not required to add the PROC=arm line to makeopts.in as reported in other forums, the PROC setting seems to have been removed in Asterisk recently.

Next step will be to set up FreePBX…