get version of OS and 64bit/32Bit

#cat /etc/*release*

#uname -a

 

disable firewall first. re-enable it later.

#setup

 

Get everything up to date

#yum -y upgrade

#yum -y update

#reboot

#yum -y update

hopefully no more updates left


Get build scripts and stuff


[32 bit]

#yum -y install gcc gcc-c++ kernel-devel bison openssl-devel \

libtermcap-devel ncurses-devel doxygen curl-devel newt-devel \

mlocate lynx tar wget nmap bzip2 mod_ssl crontabs vixie-cron \

speex speex-devel unixODBC unixODBC-devel libtool-ltdl \

libtool-ltdl-devel mysql-connector-odbc mysql mysql-devel \

mysql-server php-mysql php-mbstring php-mcrypt flex screen \

libxml2 libxml2-devel libtiff libtiff-devel

 

[64 bit] (you might need to copy this into note pad or something to remove the returns/newlines)

 

#yum -y install gcc.x86_64 gcc-c++.x86_64 kernel-devel.x86_64 bison.x86_64 openssl-devel.x86_64 \

libtermcap-devel.x86_64 ncurses-devel.x86_64 doxygen.x86_64 curl-devel.x86_64 newt-devel.x86_64 \

mlocate.x86_64 lynx.x86_64 tar.x86_64 wget.x86_64 nmap.x86_64 bzip2.x86_64 mod_ssl.x86_64 \

crontabs.x86_64 vixie-cron.x86_64 speex.x86_64 speex-devel.x86_64 unixODBC.x86_64 \

unixODBC-devel.x86_64 libtool-ltdl.x86_64 libtool-ltdl-devel.x86_64 mysql-connector-odbc.x86_64 \

mysql.x86_64 mysql-devel.x86_64 mysql-server.x86_64 php-mysql.x86_64 php-mbstring.x86_64 \

php-mcrypt.x86_64 flex.x86_64 screen.x86_64 libxml2-devel

 

[64 bit]

#yum -y install libidn-devel krb5-devel krb5-libs zlib-devel libidn-devel

#ln -sf /lib64/libcom_err.so.2 /lib64/libcom_err.so

 

 

Install ZapTel for timing or if you have the cards.

ns-serif; line-height: 14px; font-size: 11px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;"># 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
#make install
#make config

 

 

 



#groupadd asterisk
#useradd -c "asterisk PBX" -d /var/lib/asterisk -g asterisk asterisk

#cd /usr/src/

#wget http://downloads.digium.com/pub/asterisk/asterisk-1.6.2.9.tar.gz

#tar -zxvf asterisk-1.6.2.9.tar.gz

#cd asterisk-1.6.2.9


#make clean

#./configure

#make menuselect

(setup what you need in the menu manager,include mysql)

#make

#make install

 

 

#make samples

#make progdocs

#make config

#chkconfig asterisk on

 

 

#asterisk -vvvvvvvvvvvvvvvvvvvc

#core stop now

#service asterisk start


edit the following files in /etc/asterisk:

 

 

#nano /etc/asterisk/indications.conf - Change default country

#nano /etc/asterisk/modules.conf - Uncomment the line 'preload => res_odbc.so'

#nano /etc/asterisk/modules.conf - Add 'noload => pbx_ael.so' to bottom of file

#nano /etc/asterisk/modules.conf - Add 'noload => codec_dahdi.so' to the bottom of the file

 

Cut and paste below to clean up everything and set some values copy from rm to EOF

Or you can manually change them.

 

 

rm /etc/asterisk/extensions.ael

cat > /etc/asterisk/extensions.conf << EOF

[general]

static=yes

writeprotect=yes

autofallthrough=yes

extenpatternmatchnew=no

clearglobalvars=yes

priorityjumping=no

userscontext=default

 

[globals]

 

[default]

 

exten => _.,1,Goto(i,1)

exten => i,1,NoOp(Invalid)

exten => i,n,Congestion()

exten => i,n,Hangup()

 

exten => h,1,NoOp(Hanging up)

EOF

rm /etc/asterisk/extensions.lua

cat > /etc/asterisk/sip.conf << EOF

[general]

context=default

allowguest=yes

match_auth_username=yes

allowoverlap=no

allowtransfer=no

realm=pbx12.vitell.co.uk

udpbindaddr=0.0.0.0

tcpenable=no

tlsenable=no

srvlookup=yes

pedantic=no

tos_sip=cs3

tos_audio=ef

tos_video=af41

tos_text=af41

cos_sip=3

cos_audio=5

cos_video=4

cos_text=3

maxexpiry=3600

minexpiry=60

defaultexpiry=120

mwiexpiry=3600

qualifyfreq=60

qualifygap=100

qualifypeers=1

vmexten=voicemail

disallow=all

allow=alaw

mohinterpret=default

mohsuggest=default

parkinglot=plaza

language=en

relaxdtmf=yes

useragent=AsteriskPBX

sdpsession=AsteriskPBX

promiscredir=no

dtmfmode=rfc2833

videosupport=no

callevents=no

alwaysauthreject=yes

shrinkcallerid=no

allowsubscribe=yes

subscribecontext=default

notifyringing=yes

notifyhold=yes

notifycid=yes

callcounter=yes

t38pt_udptl=yes,fec,maxdatagram=400

faxdetect=no

nat=no

directmedia=no

directrtpsetup=no

EOF

 

------------------------------------------------------------ Asterisk Complete ----------------------------------------

 

Now lets get a2Billing for both asterisk server and Master SQL( just gonna use the sql for sql)

cd .. or   cd /usr/src

mkdir a2billing

 

wget http://www.asterisk2billing.org/downloads/A2Billing_1.7.1.tar.gz

tar -zxvf A2Billing_1.7.1.tar.gz

 

On Master SQL Server do the following

cd /usr/src/a2billing/DataBase/mysql-5.x

 

 

mysql -u root -p < a2billing-createdb-user.sql;

mysql -u root -p mya2billing < a2billing-mysql-schema-v1.7.0.sql;

 

will need to make a new user on the master SQL server that has permissions remotely.

 

mysql> CREATE USER 'a2bMySQL'@'10.10.10.%' IDENTIFIED BY 'yourpassdb';
mysql> GRANT ALL ON *.* TO 'a2bMySQL'@'10.10.10.%';

 

 

 

Back to Asterisk Box

 

#cp /usr/src/a2billing/a2billing.conf /etc/

#nano /etc/a2billing.conf

 

Edit a2billing.conf to  the following

 

 

[database]

hostname = 10.10.10.1

port = 3306

user = a2bMySQL

password = yourpassdb

dbname = mya2billing

dbtype = mysql

 

 

 

Edit

/etc/asterisk/res_mysql.conf

[general]

dbhost = 10.10.10.1

dbname = mya2billing

dbuser = a2bMySQL

dbpass = yourpassdb

;dbport = 3306

dbsock = /var/lib/mysql/mysql.sock

 

 

 

Edit

/etc/asterisk/extconfig.conf

[settings]

sipusers => mysql,mya2billing,cc_sip_buddies

iaxusers => mysql,mya2billing,cc_iax_buddies

sippeers => mysql,mya2billing,cc_sip_buddies

iaxpeers => mysql,mya2billing,cc_iax_buddies

 

 

 

 

 

Fix folder Permissions.

#chmod 777 /etc/asterisk

#touch /etc/asterisk/additional_a2billing_iax.conf

#touch /etc/asterisk/additional_a2billing_sip.conf

#echo \#include additional_a2billing_sip.conf >> /etc/asterisk/sip.conf

#echo \#include additional_a2billing_iax.conf >> /etc/asterisk/iax.conf

 

#chown -Rf apache /etc/asterisk/additional_a2billing_iax.conf

#chown -Rf apache /etc/asterisk/additional_a2billing_sip.conf

 

Copy sound to asterisk folder

#/usr/src/a2billing/addons/sounds/install_a2b_sounds.sh

 

Edit the Manger.conf

#nano /etc/asterisk/manager.conf

 

(Add below)

 

 

[myasterisk]

secret=mycode

read=system,call,log,verbose,command,agent,user

write=system,call,log,verbose,command,agent,user

 

(save and exit)

 

 

Copy AGI files and make executable

 

 

#cd /usr/src/a2billing/AGI

#cp a2billing.php /var/lib/asterisk/agi-bin/

#cp -Rf lib /var/lib/asterisk/agi-bin/

#chmod +x /var/lib/asterisk/agi-bin/a2billing.php

 

 

 

 

#mkdir /var/www/a2billing

#chown apache:apache /var/www/a2billing

 

 

#cp -rf /usr/src/a2billing/admin /var/www/a2billing

#cp -rf /usr/src/a2billing/agent /var/www/a2billing

#cp -rf /usr/src/a2billing/customer /var/www/a2billing

#cp -rf /usr/src/a2billing/common /var/www/a2billing

 

(use the 3 chmod is you used a ln)

 

chmod 755 /var/www/a2billing/admin/templates_c

chmod 755 /var/www/a2billing/customer/templates_c

chmod 755 /var/www/a2billing/agent/templates_c

chown -Rf apache:apache /var/www/a2billing/admin/templates_c

chown -Rf apache:apache /var/www/a2billing/customer/templates_c

 

edit apache file or httpd.. ( lame)

 

#nano /etc/httpd/conf/httpd.conf

 

find DocumentRoot and chane to below:

DocumentRoot "/var/www/a2billing"

 

service httpd restart

 

got to page http://yourip/admin/

log in and change your password

 

user: root

pass: changepassword

 

 

Now lets edit asterisk so the AGI works

# nano /etc/asterisk/extensions.conf

 

Paste below to the bottom of the file.

 

[a2billing]
; CallingCard application
exten => _X.,1,DeadAGI,a2billing.php
exten => _X.,2,Wait,2
exten => _X.,3,Hangup
[did]
; CallingCard application
exten => _X.,1,DeadAGI(a2billing.php|1|did)
Now configure httpd to start on boot
#ntsysv
arrow down to httpd and hit the space bar .tab to ok click enter

Asterisk will already start on boot :)



 


 

 

 

 

 

 

 

 

References used:

http://www.voip-info.org/wiki/view/CentOS+5+and+Asterisk+1.4.x+installation

http://www.asterisk2billing.org/cgi-bin/trac.cgi/wiki/A2Billing-1-4-Installation-deb