Master-Zone Blog Technical Notes

25Nov/090

FreePBX with Asterisk

FreePBX is the configuration tool (web GUI) for Asterisk, it does all the configuration works so no need for editing the config files. I will be continuing on my latest asterisk installation. From the previous post, I have installed the required packages needed by FreePBX (apache, php and mysql).

1. Set FreePBX related pre-configs:

1a. Edit the /etc/php5/apache/php.ini

upload_max_filesize = 20M
magic_quotes_gpc = off
memory_limit = 100M

1b. Add an asterisk user
# adduser asterisk --disabled-password --gecos "Asterisk PBX" --home /var/lib/asterisk

1c. Set MySQL database
# mysql -u root -p

CREATE database asteriskcdrdb;
CREATE database asterisk;
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asterisk@localhost IDENTIFIED BY 'p4ssw0rd';
GRANT ALL PRIVILEGES ON asterisk.* TO asterisk@localhost IDENTIFIED BY 'p4ssw0rd';

1d. Edit /etc/asterisk/asterisk.conf

astrundir => /var/run/asterisk

1e. Grant the www-data user access to the asterisk and freepbx directories and files:
# adduser www-data asterisk

Now make sure that asterisk is stopped, and remove it from the startup:
# /etc/init.d/asterisk stop && update-rc.d -f asterisk remove

2. Download and extract FreePBX:
# cd /usr/src/ && wget http://mirror.freepbx.org/freepbx-2.5.2.tar.gz && tar xzvf freepbx-2.5.2.tar.gz && cd freepbx-2.5.2

3. Import tables and DB structure
# mysql -u root -p asteriskcdrdb < /usr/src/freepbx-2.5.2/SQL/cdr_mysql_table.sql
# mysql -u root -p asterisk < /usr/src/freepbx-2.5.2/SQL/newinstall.sql

4. Install FreePBX
# ./start_asterisk
# ./install_amp

You will be asked some questions which are pretty easy so I am not going to walk you through them here. In most cases, the defaults will be fine. After the installation finish, have a look at /etc/amportal.conf for some config tweaks.

5. Configure amportal to start on boot, edit /etc/rc.local, and insert

/usr/local/sbin/amportal start

just above

exit 0

6. Start amportal
# amportal start

VN:F [1.7.5_995]
Rating: 0.0/10 (0 votes cast)
25Nov/090

Asterisk on Ubuntu

AsteriskNOW and Trixbox are very mature to be implemented in a real world environment, and I always used AsteriskNOW for my VoIP implementations. But I wanted to compile and install asterisk on a regular distribution to get more familiar with asterisk installation.

My choice was ubuntu server 9.10 because the libraries are regularly updated, and I wanted for my test a reliable updated system.

I proceeded with the installation and I only installed OpenSSH during the installation process. Once the installation finished, I configured the server with a static IP, unplugged the keyboard and the monitor, and ssh-ed into ubuntu.

The installation processes could be divided into two steps; installing the required packages required by asterisk, then installing asterisk.

1. Installing the required packages...
# apt-get install make gcc libtool flex bison build-essential libncurses5 libncurses5-dev libnewt-dev zlib1g-dev autotools-dev binutils libpri-dev libpri1.4 dahdi dahdi-dkms dahdi-linux dahdi-source libtonezone-dev libtonezone1 libtonezone2.0 zlibc zlib1g-dev libspeex-dev libspeexdsp-dev libvorbis-dev libteem1-dev libncurses5-dev libltdl-dev liblua50-dev liblua5.1-0-dev portaudio19-dev libopenh323-dev libasound2-dev liblua5.1-curl-dev libcurl4-openssl-dev snmp snmpd libsnmp-dev libnet-snmp-perl libssl-dev openssl libavcodec-dev bluez-hcidump bluez bluetooth libbluetooth-dev libusb-dev libgsm1-dev libavdevice-dev libavdevice52 libavformat-dev libavformat52 libdc1394-22 libportaudio2 libraw1394-11 libsamplerate0 resample apache2 php5 mysql-server libmysqlclient-dev php5-mcrypt php5-cli php5-common php5-curl php5-gd php5-mhash php5-mysql php-db sox

Notice: you will find me installing a lot of packages which aren't necessary for asterisk, but I wanted to have my system usable without further doing apt-get's

2. Installing asterisk...

2a. Download asterisk and asterisk-addons, I chose to use asterisk-1.6.1.9 and asterisk-addons-1.6.1.1:
# cd /usr/src && wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.6.1.9.tar.gz && tar xzvf asterisk-1.6.1.9.tar.gz && wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-addons-1.6.1.1.tar.gz && tar xzvf asterisk-addons-1.6.1.1.tar.gz

2b. Compile and install asterisk:
# cd asterisk-1.6.1.9; ./configure --with-asound --with-curl --with-crypto --with-dahdi --with-gsm --with-ltdl --with-lua --with-ncurses --with-netsnmp --with-newt --with-ogg --with-oss --with-pri --with-h323 --with-speex --with-speexdsp --with-termcap --with-tonezone --with-usb --with-vorbis --with-z

After this step finishes successfully, you will see the cute logo of asterisk in ascii-art, the next step is used to select some options to be installed along with asterisk
# make menuselect

When done, save and exit. Now it is time to install asterisk
# make && make install && make samples && make config

make samples: This will install the standard sample configuration files in the directory /etc/asterisk
make config: This will install startup script, /etc/init.d/asterisk, so Asterisk will automatically start up at boot

After each make, you will get the cute logo of asterisk which means the make was successful. Now it is time for asterisk-addons which contains additional modules for Asterisk which are, for one reason or another, not included in the normal base distribution.

2c. Compile and install asterisk-addons:
# cd .. && cd asterisk-addons-1.6.1.1 && ./configure --with-bluetooth --with-ncurses --with-mysqlclient --with-asterisk

Notice: that I have --with-bluetooth set for channel_mobile

Again, menuselect is used for extra configuration
# make menuselect

When done save, exit and install asterisk-addons
# make && make install

At this point, asterisk is fully installed and ready to be used, but it needs a lot of configuration to be usable. Now it is time to launch asterisk:
# /etc/init.d/asterisk start

Connect to asterisk:
# asterisk -rvvvvvvvvvvvvvvvvvvvv

VN:F [1.7.5_995]
Rating: 0.0/10 (0 votes cast)
20Oct/090

Installing Asterisk on FreeBSD

Couple of days ago, I wanted to move from using AsteriskNOW to installing asterisk on FreeBSD. So I installed FreeBSD on a vmware, and started installing Asterisk 1.6.

Update ports tree to install the latest asterisk port available for FreeBSD 7.2
# portsnap fetch
# portsnap extract

Install asterisk16 from ports
# cd /usr/ports/net/asterisk16/ && make install clean

Installation may be interrupted if libtool is less than 2.2. To fix this install libtool22
# cd /usr/ports/devel/libtool22/ && make install clean

Then carry on with asterisk installation

Install asterisk16-addons
# cd /usr/ports/net/asterisk16-addons/ && make install clean

Install asterisk-gui
# cd /usr/ports/www/asterisk-gui/ && make install clean

Edit rc.conf to start asterisk on boot
# vi /etc/rc.conf

And append...

# asterisk
asterisk_enable="YES"

Then configure asterisk
# vi /usr/local/etc/asterisk/manager.conf

[general]
enabled = yes
webenabled = yes
port = 5038
displaysystemname = yes
httptimeout = 60
bindaddr = 0.0.0.0
allowmultiplelogin = no
displayconnects = yes
timestampevents = yes

[ahmed]
secret = mySECRETpassword
write = system,call,agent,user,config,command,reporting,originate

# vi /usr/local/etc/asterisk/httpd.conf

[general]
enabled = yes
enablestatic = yes
bindaddr = 0.0.0.0
bindport = 8088
prefix = asterisk

Start asterisk
# /usr/local/etc/rc.d/asterisk start

Browse to http://your.asterisk.box:8088/asterisk/static/config/index.html

VN:F [1.7.5_995]
Rating: 0.0/10 (0 votes cast)