Install Instructions on Ubuntu 8.04 server

Install required packages

apt-get install linux-headers-2.6.24-19-server php5-cli php5-mysql mysql-server php-pear php-db php5-gd curl sox libncurses5-dev libssl-dev libmysqlclient15-dev subversion

Change directories to where the programs to be manually installed will go
cd /usr/src

Grab the programs from svn
wget http://downloads.digium.com/pub/asterisk/asterisk-1.6-current.tar.gz
wget http://downloads.digium.com/pub/zaptel/zaptel-1.4.12.1.tar.gz
wget http://downloads.digium.com/pub/libpri/libpri-1.4.9.tar.gz
wget http://downloads.digium.com/pub/asterisk/asterisk-addons-1.6-current.tar.gz

Configure and install zaptel-1.4
cd zaptel-1.4
./configure
make install config

Install libpri-1.4
cd …/libpri-1.4
./configure
make install

Install Asterisk-1.6
cd …/asterisk-1.6.*
./configure
make install
make samples

Install Asterisk-Addons-1.6
./configure
make install

Create asterisk user/group and add www-data to asterisk group (so it can access apache)
adduser asterisk --disabled-password --gecos "asterisk PBX"
adduser www-data asterisk

Change apache2.conf and set user and group to asterisk
cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf-orig
sed -i “s/(^User )(.)/\1asterisk/” /etc/apache2/apache2.conf
sed -i “s/(^Group )(.)/\1asterisk/” /etc/apache2/apache2.conf

Restart apache
/etc/init.d/apache2 restart

Grab freepbx-2.5.1 from svn
cd …/
wget http://mirror.freepbx.org/freepbx-2.5.1.tar.gz

Untar freepbx-2.5.1.tar.gz
tar -xvzf freepbx-2.5.1.tar.gz

Set up mysql databases for freepbx-2.5.1
cd freepbx-2.5.1
mysqladmin create asterisk
mysqladmin create asteriskcdrdb
mysql asterisk < SQL/newinstall.sql
mysql asteriskcdrdb < SQL/cdr_mysql_table.sql

Set up users and grant permissions on tables in mysql
mysql
mysql> GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY ‘fsasterisk’;
mysql> GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY ‘fsasterisk’;
mysql> flush privileges;
mysql> \q

Install freepbx-2.5.1
./install_amp

Change php.ini to please freepbx-2.5.1 settings
cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini-orig
sed -i “s/(upload_max_filesize *= )(.)/\120M/” /etc/php5/apache2/php.ini
sed -i “s/(memory_limit *= )(.)/\1100M/” /etc/php5/apache2/php.ini
sed -i “s/(magic_quotes_gpc *= )(.)/\1Off/” /etc/php5/apache2/php.ini

Restart apache
/etc/init.d/apache2 restart

Add a dummy zaptel timer
modprobe ztdummy
NOTE: ztdummy is a Linux kernel module that will provide your Asterisk with a Zaptel timer even if you don’t have any Digium hardware installed in your Linux server.

Start amportal
amportal start

Direct your browser to http://ip.address.here/html/admin (/html is default, if you cahnged this in the installation, please note the address will be differant here)

Upgrade all packages that need updating by going to Module Admin and clicking “Check for updates online” . At the bottom there should be an option “Upgrade All” click this.

Testing
To test your Asterisk/FreePBX install you will need to use a softphone. Download X-Lite from http://www.counterpath.net/X-Lite-Download.html and install it. This works best from two computers, however only one is required.

Next you need to make some extensions to test

In the FreeBPX webadmin, make sure you are under the setup tab (not the tools tab) and click “Extensions”

The Device should be “Generic SIP device” if so, click Submit.
At the next screen you need to fill out the following

Add Extension
User Extension : 1000
Display Name: Tester1
Device Options
secret: 1234
Voicemail and Directory
Status: Enabled
Voicemail Password: 1234
Email Address: enter your email address
Email Attachment: yes
Play CID: yes
Play Envelope: yes

Then click submit. For the second test extension, make the extension 1001, name Tester2 and fill in the rest the same as the first.

You should now have two extensions <1000> Tester1 and <1001> Tester2

Click the “Apply Configuration Changes” at the top.

Now test on X-Lite

On the first start up you should see a screen that says “SIP Accounts”
Click the Acct #1 (the only account present)
Then click Properties
Type Tester1 under Display Name
Type 1000 under User Name
Type 1234 under Password
Type 1000 under Authorization User Name
Type your IP.Address under Domain
Then click OK
You should see your softphone connecting to the domain at the top
Once registered you should see “Ready. You user name is 1000”

Do the same for the second softphone except enter the details for the 1001 extension.

Once the second softphone has connected to the domain you can call one from the other.

On user name 1000, dial 1001
The softphone registered to user name 1001 should receive the call.
Talk for a little to ensure sound works properly

On user name 1001, dial 1000
Do the same as above to ensure both work correctly

On user name 1000, dial 1001. Don’t answer 1001
Leave a voice message and hang up.

On user name 1001, dial 1000. Don’t answer 1000
Leave a voice message and hang up.

If all has worked correctly, when the voice message was received you should have gotten an email to the email address entered in the extension.

Also if you go to Reports there should be 4 calls listed.
You can also go to Recordings and log on as 1000 or 1001 and see one voice mail.

Troubleshooting
If there is an error message regarding api-bin you will need to type the following
chown asterisk:asterisk /usr/share/asterisk/api-bin/

If the Call Recording Database isn’t working you may need to restart amportal
amportal restart
asterisk

To make the freepbx-2.5.1 panel option work in the webgui you need to change a file
vi /var/www/asterisk/admin/views/panel.php
Change
src="…/…/panel/index_amp.php?context=’.$deptname.’">
To
src="…/panel/index_amp.php?context=’.$deptname.’">

Just a small note, to get the headers for the kernal that are in use at the moment, use:
aptitude install linux-headers-uname -r

Some more pkg to be able to compile and serve:
aptitude install make bison flex g++ gcc apache2 php5

And to get the lastest zaptel / libpri, use:
wget http://downloads.digium.com/pub/zaptel/zaptel-1.4-current.tar.gz
wget http://downloads.digium.com/pub/libpri/libpri-1.4-current.tar.gz

To start asterisk when the server is starting, add in /etc/rc.local:

modprobe ztdummy
amportal start

To make safe_asterisk work on ubuntu edit the top line and change sh into bash (sh is symlinked to dash on ubuntu)

This is a good howto on building freepbx and its related packages from the latest codebases.

For a simpler method that takes advantage of ubuntu’s package management system, try the instructions in the wiki.

http://www.freepbx.org/trac/wiki/UbuntuServerIntrepid

Not having had much luck with following recipes (likely due to slight differences in pre-installed packages or updates) or the packages which are available, I’ve posted a script for building asterisk and freepbx on a base 8.04 install.

It is on the Ubuntu wiki at: https://wiki.ubuntu.com/AsteriskScriptOnHardy

I don’t believe the zaptel drivers will work for the 1.6.x version of asterisk mentioned above here.