Install script A2Billing 1.3.2 (Yellowjacket)

Posted on March 5, 2011 by admin

#!/bin/bash

echo
echo
echo ” =================================================== ”
echo “| WARNING THIS SCRIPT IS FOR FRESH INSTALLS ONLY |”
echo “| Install script for A2B 1.3 ver on Trixbox 2.2 |”
echo “| |”
echo “| Script for Trixbox Written/Collected/Modified by |”
echo “| pentimedia.com.au — VoIP Team |”
echo “| |”
echo “| WE CANNOT BE HELD RESPONSIBLE FOR DAMAGE CAUSED |”
echo “| BY THIS SCRIPT!!!! |”
echo ” =================================================== ”
echo
echo
echo Script will resume in 10 seconds…
sleep 10

echo
echo “———– Updating Trixbox: ———-”
echo

yum -y install tbm-GUIcore
yum -y update

echo
echo “———– Backing Up Old Config: ———-”
echo

mv /var/www/html/a2billing/ /var/www/html/a2billing_old/
mv /var/www/html/a2customer/ /var/www/html/a2customer_old/
mv /var/lib/asterisk/agi-bin/a2billing.php /var/lib/asterisk/agi-bin/a2billing.php.bak
mv /var/lib/asterisk/agi-bin/libs_a2billing/ /var/lib/asterisk/agi-bin/libs_a2billing_old/
mv /etc/asterisk/additional_a2billing_iax.conf /etc/asterisk/additional_a2billing_iax.conf.bak
mv /etc/asterisk/additional_a2billing_sip.conf /etc/asterisk/additional_a2billing_sip.conf.bak
mv /etc/asterisk/a2billing.conf /etc/asterisk/a2billing.conf.bak

mysqldump -Q -uroot -ppassw0rd mya2billing > ~/mya2billing_1.2.3.sql
yes | mysqladmin drop mya2billing -u root -ppassw0rd

echo
echo “———– Installing PHP-PCNTL: ———-”
echo

cd /usr/local/src

wget http://dfn.dl.sourceforge.net/sourceforge/phprpms/php-pcntl-4.3.11-2.5.1.i386.rpm
rpm -iv php-pcntl-4.3.11-2.5.1.i386.rpm
rm -f php-pcntl-4.3.11-2.5.1.i386.rpm

echo
echo “———– Fetching and Extracting A2B v1.3: ———-”
echo

cd /usr/local/src

wget http://www.ozee.com.au/a2b/A2Billing_1.3.2.tar.gz
tar zxfv A2Billing_1.3.2.tar.gz
rm -f A2Billing_1.3.2.tar.gz

echo
echo “———– Installing the new Database ———-”
echo

cd 1.3.0-Beta/DataBase/mysql/Mysql-3.x_4.x/

echo “GRANT ALL PRIVILEGES ON *.* TO ‘a2billinguser’@’localhost’ IDENTIFIED BY ‘a2billing’ WITH GRANT OPTION;” | mysql -ppassw0rd
mysqladmin create mya2billing -u a2billinguser -pa2billing
mysql mya2billing -u a2billinguser -pa2billing < a2billing-mysql-schema-MYSQL.3.X-4.X_v1.3.0.sql

echo
echo “———– Installing the new Web Interface ———-”
echo

cd ../../..

cp -fr ./A2Billing_UI /var/www/html/A2Billing_UI
cp -fr ./A2BCustomer_UI/ /var/www/html/A2BCustomer_UI

echo
echo “———– Installing the default configuration file ———-”
echo

cp -fr a2billing.conf /etc/asterisk/a2billing.conf
sed -i ‘/postgres/s/dbtype/;dbtype/g’ /etc/asterisk/a2billing.conf
sed -i ‘/mysql/s/;dbtype/dbtype/g’ /etc/asterisk/a2billing.conf
sed -i ‘/manager_user/s/myasterisk/a2billinguser/g’ /etc/asterisk/a2billing.conf
sed -i ‘/manager_secret/s/mycode/a2billing/g’ /etc/asterisk/a2billing.conf

echo
echo “———– Installing the AGI ———-”
echo

cd A2Billing_AGI

cp -fr a2billing.php /var/lib/asterisk/agi-bin/a2billing.php
cp -fr libs_a2billing /var/lib/asterisk/agi-bin

echo
echo “———– Installing Extra Sounds ———-”
echo

cd ..
cd addons/sounds/

cp -fr * /var/lib/asterisk/sounds/

echo
echo “———– Installing IAX and SIP conf Files ———-”
echo

cd /etc/asterisk/
touch additional_a2billing_iax.conf
touch additional_a2billing_sip.conf
touch extensions_a2billing.conf

chmod 666 /etc/asterisk/additional_a2billing_iax.conf
chmod 666 /etc/asterisk/additional_a2billing_sip.conf
chmod 666 /etc/asterisk/extensions_a2billing.conf

chown -R asterisk:asterisk /etc/asterisk/
chown -R asterisk:asterisk /var/www/html/
chown -R asterisk:asterisk /var/lib/asterisk/

echo
echo “———– Registering IAX and SIP conf Files ———-”
echo

echo “#include additional_a2billing_sip.conf” >> /etc/asterisk/sip.conf
echo “#include additional_a2billing_iax.conf” >> /etc/asterisk/iax.conf
echo “#include extensions_a2billing.conf” >> /etc/asterisk/extensions_custom.conf

echo ”
[a2billing]

exten => _X.,1,Answer
exten => _X.,n,Wait(1)
exten => _X.,n,DeadAGI(a2billing.php|1)
exten => _X.,n,Hangup
” >> /etc/asterisk/extensions_a2billing.conf

echo
echo “———– Restarting some services: ———-”
echo

service httpd restart
service mysqld restart

Note :
Edit: sip.conf

[general]
bindport = 5060 ; Port to bind to (SIP is 5060)
bindaddr = 0.0.0.0 ; Address to bind to (all addresses on machine)
disallow=all
allow=g729
allow=g723
allow=alaw
allow=ulaw
; If you need to answer unauthenticated calls, you should change this
; next line to ‘from-trunk’, rather than ‘from-sip-external’.
; You’ll know this is happening if when you call in you get a message
; saying “The number you have dialed is not in service. Please check the
; number and try again.”
context = from-sip-external ; Send unknown SIP callers to this context
callerid = Unknown
tos=0x68

#include sip_nat.conf
#include sip_registrations.conf
#include sip_additional.conf
#include additional_a2billing_sip.conf
#include sip_notify.conf