Tips: VoIP, PBX, Telephony

PBX with Ubuntu, Asterisk, and HylaFax

If you are anything like us, you would rather Ubuntu be your base OS distribution but like, or need, the latest and greatest software features of Asterisk. This is why I put this little HOWTO together on how to install Asterisk 11.8. I’ve tried to use as many as prepackaged requirement as possible that would work for us. Then also make things even easier for you with FreePBX web based GUI. After we got this up and running I did not like the fax options I had and wanted something more robust. IAXmodem with Hylafax did the trick.

Install Ubuntu 12.04 LTS server 64bit

First install a base Ubuntu 12.04 64bit LTS and just add ssh so you can login remotely. I’m guessing this will work with the 32bit also, but we are using 64bit here.

Then reboot and login to your new install.

Upgrade the distribution

sudo -i
apt-get update
apt-get dist-upgrade

reboot again if needed.

shutdown -r now

Install prerequisites

Note: This worked on Ubuntu 12.04 LTS. I know package names have changed on 14.04 but they give you plenty of hints to make the correct changes.

sudo apt-get install build-essential libncurses-dev \
libz-dev libssl-dev libxml2-dev libsqlite3-dev \
libspeex-dev libspeexdsp-dev libogg-dev libusb-dev \
libvorbis-dev libasound2-dev portaudio19-dev uuid-dev \
unixodbc-dev libsqlite0-dev libmysqlclient15-dev \
libgmime-2.6-dev liblua5.1-0-dev libopenh323-dev \
libgtk2.0-dev libmysqlclient-dev libradiusclient-ng-dev \
freetds-dev libiksemel-dev libcorosync-dev libnewt-dev \
libical-dev libspandsp-dev libjack-dev libresample-dev \
libsrtp-dev libgsm1-dev libedit-dev libldap-dev php5-curl \
openssh-server apache2 mysql-server mysql-client php5 \
php5-cli php5-mysql php-pear php-db php5-gd curl mpg123 \
sqlite3 libsqlite3-dev pkg-config automake autoconf \
libss7-dev libsdl-image1.2-dev doxygen libtool libxml2-dev \
libbluetooth-dev libneon27-dev binutils-dev libpopt-dev \
libpri-dev libnewt-dev libc-client-dev libsnmp-dev git \
libvpb-dev libcurl4-openssl-dev bison uuid subversion \
libpq-dev lua5.1 sox flex

Manual Installs


Ubuntu’s dahdi did not install for me so I manually installed.

make all
make install
make config (optional)
Asterisk – The PBX
tar zxvf aterisk-11*.tar.gz
cd asterisk-11
make menuselect
make install
make config
make progdocs


FreePBX – The Web GUI

cd /usr/src
tar zxvf freepbx-2.11.0.tar.gz

adduser asterisk --disabled-password --no-create-home --gecos "Asterisk User"
chown asterisk. /var/run/asterisk
chown -R asterisk. /etc/asterisk
chown -R asterisk. /var/{lib,log,spool}/asterisk
chown -R asterisk. /usr/lib/asterisk
mkdir /var/www/html
chown -R asterisk. /var/www/


php modifications

Edit php.ini

vi /etc/php5/apache2/php.ini

find – upload_max_filesize and make it 120M

upload_max_filesize = 120M


apache modifications

apache config

vi /etc/apache2/envvars

and change

export APACHE_RUN_USER=asterisk
export APACHE_RUN_GROUP=asterisk

Get owner fixed

chown -R asterisk. /var/lock/apache2

Restart the apache service

service apache2 restart


mysqladmin -u root create asterisk -p
mysqladmin -u root create asteriskcdrdb -p
cd /usr/src/freepbx-2.11.0
mysql -u root asterisk -p < SQL/newinstall.sql
mysql -u root asteriskcdrdb -p < SQL/cdr_mysql_table.sql

Make sure you change ‘amp109’ to what you configure in $asterisk_pass = “amp109” in install_amp

mysql -u root -p -e "GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';"
mysql -u root -p -e "GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';"
mysql -u root -p -e "flush privileges;"


export ASTERISK_DB_PW=amp109
./install_amp --username=asteriskuser --password=$ASTERISK_DB_PW --webroot /var/www
amportal a ma installall
amportal a reload
ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3
amportal start
ln -s /var/www/html/admin /var/www/admin
ln -s /var/www/html/recordings /var/www/recordings

Now you are ready to configure your PBX with the FreePBX web interface http://yourserver/html

HylaFax setup will be in another post. Hint we found the most stable way to do fax over VoIP was with HylaFax and IAXmodem. Don’t believe all the post all over the Internet that say VoIP can not do fax transmissions. We have fewer problems with this setup than we had with the analog modem setup.