`
sbfwfn
  • 浏览: 16519 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Experience the Love of Ubuntu 8.04 & FreePBX 2.5

阅读更多
With my recent endeavor into the world of open-source PBX I decided to write up a step-by-step how to on how to setup Ubuntu 8.04 with FreePBX 2.5. All the how-to’s were out dated and when i setup something I like to have all the new stuff. I will cover Zaptel compiling (not configuration), Astrisk Compiling, Install of FreePBX and configuration. It is recommend that you have prior knowledge of how to use Linux and some Asterisk knowledge. To access a root shell on an Ubuntu system run sudo su. Install Base Ubuntu 8.04 Server.

Install Ubuntu 8.04 Server w/ LAMP server & SSHd

*THIS HOW-TO IS CURRENTLY A WORK IN PROGRESS*

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

# cd /usr/src/
# sudo wget http://downloads.digium.com/pub/zaptel/zaptel-1.4-current.tar.gz
# sudo tar -zxvf zaptel-1.4-current.tar.gz
# cd zaptel-1.4.12.1
# ./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 http://downloads.digium.com/pub/asterisk/releases/asterisk-1.4.22.tar.gz
# sudo tar -zxvf asterisk-1.4.22.tar.gz
# cd asterisk-1.4.22
# make clean
# ./configure –with-curl
# make
# sudo make install
# sudo make samples

Download Astrisk Add-ons
# cd ..
# sudo wget http://downloads.digium.com/pub/asterisk/asterisk-addons-1.4.7.tar.gz
# sudo tar -zxvf asterisk-addons-1.4.7.tar.gz
# cd asterisk-addons-1.4.7
# sudo perl -p -i.bak -e ’s/CFLAGS.*D_GNU_SOURCE/CFLAGS+=-D_GNU_SOURCE\nCFLAGS+=-DMYSQL_LOGUNIQUEID/’ Makefile
# ./configure
# make clean
# make
# sudo make install

Download Astrisk Sounds
# cd ..
# sudo mkdir asterisk-sounds
# cd asterisk-sounds
# sudo wget http://downloads.digium.com/pub/telephony/sounds/asterisk-core-sounds-en-wav-current.tar.gz
# sudo wget http://downloads.digium.com/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current.tar.gz
# sudo wget http://downloads.digium.com/pub/telephony/sounds/asterisk-moh-freeplay-wav.tar.gz

# 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

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 http://mirror.freepbx.org/freepbx-2.5.0.tar.gz
# sudo tar -zxvf freepbx-2.5.0.tar.gz
# cd freepbx-2.5.0
# sudo mysql_install_db
# mysqladmin u root password ‘<chosen MySQL Password>’
# mysqladmin create asteriskcdrdb -p
# mysqladmin create asterisk -p
# 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′;
<enter>
# GRANT ALL PRIVILEGES ON  asterisk.* TO asteriskuser@localhost IDENTIFIED BY ‘amp109′;
<enter>
# quit
<enter>

Configure Apache for FreePBX

# sudo nano /etc/apache/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.5.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
?View Code BASH

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

DESC="Asterisk"
NAME=amportal
DAEMON=/usr/local/sbin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

test -x $DAEMON || exit 0

d_start() {

        amportal start

}

d_stop() {

        amportal stop

}

d_reload() {

        amportal restart

}

case "$1" in

start)

        echo -n "Starting $DESC: $NAME"
        d_start
        echo "."
        ;;

stop)

        echo -n "Stopping $DESC: $NAME"
        d_stop
        echo "."
        ;;

restart|force-reload)

        echo -n "Restarting $DESC: $NAME"
        d_stop
        sleep 10
        d_start
        echo "."
        ;;

*)

        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3
        ;;

esac

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

/etc/asterisk/cdr_mysql.conf
/etc/amportal.conf

Like this article? Please Digg it!
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics