Installing Asterisk PBX with an OpenVox ISDN card

This is a step-by-step guide to install Asterisk & FreePBX using an OpenVox ISDN cards

Install required packages

Add rpmforge repository
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6...

Update the system
yum update

Install required packages
yum install bison bison-devel ncurses ncurses-devel zlib zlib-devel openssl openssl-devel gnutls-devel gcc gcc-c++ libxml2-devel libtiff-devel mysql-server php-gd php-mysql ncurses-devel audiofile-devel subversion libogg-devel mysql-devel e2fsprogs-devel keyutils-libs-devel krb5-devel libselinux-devel libsepol-devel libxml2-devel libtiff-devel gmp php-pear php-pear-DB php-pdo perl-DateManip sendmail-cf lame doxygen

Install kernel sources depending on your installation

yum install kernel-devel
or yum install kernel-smp-devel

Finally disable selinux by editing /etc/selinux/config to :

# This file controls the state of SELinux on the system.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
SELINUXTYPE=targeted

Download the sources:
cd /usr/src
wget http://downloads.digium.com/pub/asterisk/asterisk-1.4-current.tar.gz
wget http://downloads.digium.com/pub/asterisk/asterisk-addons-1.4-current.tar.gz
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
wget http://downloads.digium.com/pub/telephony/sounds/asterisk-core-sounds-en...
wget http://mirror.freepbx.org/freepbx-2.4.1.tar.gz

create a symbolic link for the kernel sources
ln -s kernels/2.6.18-92.1.10.el5.centos.plus-i686/  linux

Unpack the source files :
tar zxvf asterisk-1.4-current.tar.gz
tar zxvf asterisk-addons-1.4-current.tar.gz
tar zxvf zaptel-1.4-current.tar.gz
tar zxvf libpri-1.4-current.tar.gz
tar zxvf freepbx-2.3.1.tar.gz

Configure and compile each package seperately
cd /usr/src/zaptel-1.4-21.1
./configure
make
make install
make config
Edit /etc/sysconfig/zaptel and comment out every line except

MODULES="$MODULES ztdummy" # UHCI USB Zaptel Timing Only Interface

Start zaptel service
/etc/init.d/zaptel start
/sbin/ztcfg

cd /usr/src/libpri-1.4.7/
make
make install

Since we are not using native Zaptel hardware we will use the mISDN module for
the OpenVox ISDN card
cd /usr/src/
wget http://www.misdn.org/downloads/mISDN.tar.gz
wget http://www.misdn.org/downloads/mISDNuser.tar.gz
tar xzf mISDN.tar.gz
tar xzf mISDNuser.tar.gz
cd mISDN-1_1_7_2/
make install
cd ../mISDNuser-1_1_7_2/
make install

We need to configure mISDN so type :
mISDN scan
mISDN config
Edit /etc/mISDN.conf and adjust your port modes either to ptp or ptmp
and start the mISDN service
mISDN start

Before we install asterisk we will need to create the corresponding users as well as
a number of directories
useradd -c "Asterisk PBX" -d /var/lib/asterisk asterisk
mkdir /var/run/asterisk
mkdir /var/log/asterisk
chown -R asterisk:asterisk /var/run/asterisk
chown -R asterisk:asterisk /var/log/asterisk

cd /usr/src/asterisk-1.4.21.2/
./configure
make menuselect
and make sure chan_misdn is selected as well as anything else
you feel you might need
make install
make samples
make progdoc

We will need to edit some configuration files
vi /etc/asterisk/misdn.conf

[general]
misdn_init=/etc/mISDN.conf
debug=4
ntdebugflag=0
ntdebugfile=/var/log/misdn-nt.log
ntkeepcalls=no
tracefile=/var/log/asterisk/misdn.log
bridging=no
stop_tone_after_first_digit=yes
append_digits2exten=yes
dynamic_crypt=no
crypt_prefix=**
crypt_keys=test,muh
[default]
context=misdn
language=en
musicclass=default
senddtmf=yes
far_alerting=yes
allowed_bearers=all
nationalprefix=
internationalprefix=
rxgain=0
txgain=0
te_choose_channel=no
pmp_l1_check=no
reject_cause=16
need_more_infos=no
nttimeout=no
method=standard
overlapdial=yes
dialplan=0
localdialplan=0
cpndialplan=0
early_bconnect=yes
incoming_early_audio=no
nodialtone=no
immediate=yes
hold_allowed=yes
callgroup=1
pickupgroup=1
presentation=-1
screen=-1
echocancel=32
max_incoming=2
max_outgoing=2

[isdn]
ports=1,2
context=from-pstn
msns=*
msn=*

vi /etc/asterisk/modules.conf

[modules]
autoload=yes
noload => pbx_gtkconsole.so
noload => pbx_kdeconsole.so
noload => app_intercom.so
noload => chan_modem.so
noload => chan_modem_aopen.so
noload => chan_modem_bestdata.so
noload => chan_modem_i4l.so
noload => app_trunkisavail.so
load => format_wav.so
load => format_pcm.so
load => format_au.so
load => format_mp3.so
load => res_musiconhold.so
noload => chan_alsa.so
noload => chan_oss.so
load => res_features.so
load => chan_misdn.so
[global]
res_features=yes
chan_misdn=yes


Now it is let's add some extras

cd /usr/src/asterisk-addons-1.4.7/
./configure
make
make install

To install FreePBX we will need to confiugre MySQL and Apache

/etc/init.d/mysqld start
mysqladmin create asterisk
mysqladmin create asteriskcdrdb
mysql asterisk <
/usr/src/freepbx-2.4.1/SQL/newinstall.sql
mysql asteriskcdrdb <
/usr/src/freepbx-2.4.1/
SQL/cdr_mysql_table.sql

Connect to MySQL using :
mysql
and execure
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'password';
flush privileges;
quit

For FreePBX to function correctly it will need to run as the asterisk user
vi /etc/httpd/conf/httpd.conf
and edit the following lines :

User asterisk
Group asterisk
.
.
.
AllowOverride All

chown -R asterisk:asterisk /var/lib/php/session/


Now let's install FreePBX
cd /usr/src/freepbx-2.4.1
./start_asterisk start
./install_amp

You will be prompted with several questions during installation:
* Enter your USERNAME to connect to the ?asterisk? database
- asteriskuser
* Enter your PASSWORD to connect to the ?asterisk? database
- password
* Enter the hostname of the ?asterisk? database
- locahost
* Enter a USERNAME to connect to the Asterisk Manager interface
- admin
* Enter a PASSWORD to connect to the Asterisk Manager interface
- amp111
* Enter the path to use for your AMP web root
- /var/www.
* Enter the IP ADDRESS or hostname used to access the AMP web-admin
- <ip-address>
* Enter a PASSWORD to perform call transfers with the Flash Operator Panel
- passw0rd
* Use simple Extensions [extensions] admin or separate Devices and Users [deviceanduser]
- extensions
* Enter directory in which to store AMP executable scripts
- /var/lib/asterisk/bin
* Enter directory in which to store super-user scripts
- /usr/sbin

chown asterisk:asterisk amportal.conf
and rerun
./install_amp

vi /var/www/html/recordings/includes/main.conf.php

$ari_admin_password = "password";

Now let's make sure everything starts when it should :

chkconfig --level 235 httpd on
chkconfig --level 235 httpd on
chkconfig --level 235 httpd on

Edit /etc/rc.local and add at the end

/usr/sbin/mISDN start
/usr/local/sbin/amportal start

Reboot the machine and upon restart
connect to asterisk
asterisk -r
Check that your isdn card is properly configured
misdn show stacks
that should return :
BEGIN STACK_LIST:
* Port 1 Type TE Prot. PMP L2Link DOWN L1Link:UP Blocked:0  Debug:4
* Port 2 Type TE Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:4

Now connect to FreePBX
http://<ip-adress>/admin and configure your SIP Extensions.

To make out bound calls you need to create a Custom Trunk and add to the dial string mISDN/1/$OUTNUM$