Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Install Ubuntu 8.04 Server w/ LAMP server & SSHd

Get the system all up to date
#aptitude upgrade

After that is finish with no errors reboot your system

I would not recommend installing zaptel or asterisk from apt. It will just cause problems.

Install Required Packages

# sudo aptitude install cvs build-essential automake autoconf bison flex libtool libncurses5-dev libssl-dev php5 php5-cli php5-curl php5-gd php5-mysql mysql-server php-pear php-db curl sox apache2 subversion libssl-dev libmysqlclient15-dev libcurl4-gnutls-dev

Compile & Installing Zaptel Modules

Next we want to prepare to build the zaptel modules to do we will need the following packages:

# uname -a

# sudo aptitude install linux-headers-$(uname -r)
# sudo ln -s /usr/src/linux-headers-$(uname -r) /usr/src/linux-2.6

margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;"># cd /usr/src/

tom: 10px; margin-left: 0px; padding: 0px;"># sudo wget
# sudo tar -zxvf zaptel-1.4-current.tar.gz
# cd zaptel-
# ./configure
# make clean
# make
# sudo make install
# sudo make config

I am not going to go in depth into Zaptel module configuration since there is a ton of great sites out there.
Edit the following config files to your needs: configure /etc/zaptel.conf and /etc/asterisk/zapata.conf
voip-info zaptel config

# sudo /etc/init.d/zaptel start
# sudo update-rc.d zaptel defaults 20 80

Ways to test your Zaptel
# lspci

should have something like this: 02:0a.0 Ethernet controller: Digium, Inc. Unknown device 8005 (rev 11)

# cat /proc/zaptel/*
output similar to:

Span 1: WCTDM/0 “Wildcard TDM410P Board 1″ (MASTER)
IRQ misses: 1

1 WCTDM/0/0 FXSKS (In use)
2 WCTDM/0/1 FXSKS (In use)
3 WCTDM/0/2 FXSKS (In use)
4 WCTDM/0/3 FXSKS (In use)

Testing once Asterisk IS INSTALLED

Access Asterisk CLI
# sudo asterisk -r

In asterisk command line enter : zap show channels
xxx*CLI> zap show channels

output similar to:

Chan Extension  Context         Language   MOH Interpret
pseudo            from-pstn                  default
1            from-pstn                  default
2            from-pstn                  default
3            from-pstn                  default
4            from-pstn                  default

In asterisk command line enter : zap show status
xxx*CLI> zap show status

output similar to:

Description                              Alarms     IRQ        bpviol     CRC4
Wildcard TDM410P Board 1                 OK         1          0          0

If you have stuff like this showing up your card should be working

Setting Up & Compile Asterisk with Curl Support

# sudo groupadd asterisk
# sudo useradd -c "asterisk PBX" -d /var/lib/asterisk -g asterisk asterisk
# sudo mkdir /var/run/asterisk
# sudo chown asterisk:asterisk /var/run/asterisk/
# cd /usr/src/
# sudo wget
# sudo tar -zxvf asterisk-
# cd asterisk-
# make clean
# ./configure –with-curl
# make
# sudo make install
# sudo make samples

Download Astrisk Add-ons
# cd ..
# sudo wget
# sudo tar -zxvf asterisk-addons-1.4.11.tar.gz
# cd asterisk-addons-1.4.11
# ./configure
# make clean
# make
# sudo make install

Download Astrisk Sounds
# cd ..
# sudo mkdir asterisk-sounds
# cd asterisk-sounds
# sudo wget
# sudo wget
# sudo wget

( if not found try these ones below )

# sudo wget

# sudo tar -zxvf asterisk-core-sounds-en-wav-current.tar.gz
# sudo tar -zxvf asterisk-extra-sounds-en-wav-current.tar.gz
# sudo tar -zxvf asterisk-moh-freeplay-wav.tar.gz

# sudo tar -zxvf asterisk-moh-opsound-alaw-current.tar.gz

copy all sounds to the asterisk directory
# sudo cp -rf * /var/lib/asterisk/sounds/

create sim link for MOH (Music on Hold) directory for FreePBX
# sudo ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3

Fix asterisk dir permissions
# chown asterisk:asterisk /etc/asterisk -R
# chown asterisk:asterisk /var/lib/asterisk -R
# chown asterisk:asterisk /var/log/asterisk -R
# chown asterisk:asterisk /var/spool/asterisk/ -R

# nano /etc/asterisk/asterisk.conf
Change astrundir to: /var/run/asterisk

Setting up FreePBX

# cd /usr/src/
# sudo wget
# sudo tar -zxvf freepbx-2.7.0.tar.gz
# cd freepbx-2.7.0
# sudo mysql_install_db


# mysqladmin u root password
# mysqladmin create asteriskcu rootdrdb -p
# mysqladmin create asterisk -p

mysql -uroot -pYourPassword

mysql>  create database asterisk;

mysql> create database asteriskcdrdb;

mysql> exit;

# mysql –user=root –password=<chosen MySQL Password> asterisk < ./SQL/newinstall.sql
# mysql –user=root –password=<chosen MySQL Password>asteriskcdrdb < ./SQL/cdr_mysql_table.sql
Enter Mysql command prompt
# mysql –user root -p
# GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
# GRANT ALL PRIVILEGES ON  asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
# quit

to test if you can access the db as asterisk do this:


mysql -uasteriskuser -pamp109

if you get the mysql> prompt your stuff will connect to the DB.. if you cant.. your lame.


Configure Apache for FreePBX

# sudo nano /etc/apache2/envvars
change : export APACHE_RUN_USER=www-data & export APACHE_RUN_GROUP=www-data
to: export APACHE_RUN_USER=asterisk & export APACHE_RUN_GROUP=asterisk

# sudo nano /etc/apache2/sites-enabled/000-default
change: AllowOveride None to AllowOverid All under both instances of /var/www

Configure PHP for FreePBX
# sudo nano /etc/php5/apache2/php.ini
change: upload_max_filesize to upload_max_filesize = 20M

# sudo nano /etc/php5/cli/php.ini
change: upload_max_filesize to upload_max_filesize = 20M

Set the php lib directory to be owned by asterisk so that it can make changes to the php.ini
# sudo chown asterisk:asterisk /var/lib/php5 -R

Set ownership of the /var/www directory to asterisk so it can write to files
# sudo chown asterisk:asterisk /var/www -R

Restart Apache
# sudo /etc/init.d/apache2 restart

In a web browser test http://<server-ip-addresss>/ if all is well you should get a page and your apache is installed and working properly

FreePBX install

# cd /usr/src/freepbx-2.7.0
bash fix for asterisk start script
# sudo ln -sf /bin/bash /bin/sh
# sudo
./start_asterisk start
# sudo ./install_amp
accept defaults on all questions except on:
Enter the path to use for your AMP web root: /var/www
IP address: <server-ip-addresss>

No point a web browser at http://<server-ip-addresss>/admin/ and click on the orange reload config banner at the top of the page

Astrisk Init Script

# sudo nano /etc/init.d/asterisk

paste the following

set -e
test -x $DAEMON || exit 0
d_start() {
        amportal start
d_stop() {
        amportal stop
d_reload() {
        amportal restart
case "$1" in
        echo -n "Starting $DESC: $NAME"
        echo "."
        echo -n "Stopping $DESC: $NAME"
        echo "."
        echo -n "Restarting $DESC: $NAME"
        sleep 10
        echo "."
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3
exit 0

<save file>
# sudo chmod 755 /etc/init.d/asterisk
# sudo update-rc.d asterisk defaults 90 10

Activate FOP (Flash Operator Panel)
# sudo nano /etc/amportal.conf
change: FOPRUN=false to FOPRUN=true
*must restart asterisk to take effect in FreePBX

remove old astrisk configs
# sudo rm /etc/asterisk/*.0

Reboot your system and you should have a working Asterisk/FreePBX system up and running

Installing Other Goodies

TFTP server for phone updates and auto configurations

# sudo aptitude install tftpd-hpa tftp-hpa
# sudo nano /etc/default/tftpd-hpa
change: RUN_DAEMON to RUN_DAEMON=”yes”

I make a link to /tftpboot just to make it a little more accessible
# sudo ln -s /var/lib/tftpboot /tftpboot
# sudo /etc/init.d/tftpd-hpa start
# sudo update-rc.d tftpd-hpa defaults

Now put all your firmware updates, phone configs in the /tfptboot directory. Also if your phones use DHCP don’t forget to set the TFTP server address to this server ip so the phones get it automatically assigned.

Changing Mysql Asterisk Username or Password

If you change any of the mysql login cridentials you must update these two files with the new asterisk username and/or password






If you get a can't connect to manager issue try this:

iptables -A INPUT -p tcp -m tcp --dport 5038 -j ACCEPT


Also try this

Telnet server-ip 5038
Trying server-ip...
Connected to rdns-of-server-ip
Escape character is '^]'.
Asterisk Call Manager/1.0