A2Billing - Installation.

Posted: by Unknown in
0

Information:
This tutorial has been done with:
  • CentOS release 6.3
  • PHP Version 5.3.3
  • Asterisk Version 11.5.0
  • A2Billing Version 2.0.1 

-Notice:Before installing A2Billing "SELinux" must run in the "Permissive" mode.
-Configure "SELinux" to be "Permissive" using  " #sed -i "s/SELINUX=enforcing/SELINUX=permissive/" /etc/sysconfig/selinux " or " #echo 0 > /selinux/enforce "command.
-Reboot the system for changes to take effect and verify using the "getenforce" command.

Asterisk: 
-Adding the repository.
# rpm -Uvh http://packages.asterisk.org/centos/6/current/i386/RPMS/asterisknow-version-3.0.0-1_centos6.noarch.rpm
-Update the YUM repository.
# yum update

-Notice:The "Yum Update" command will update the YUM repository list to include the Asterisk repository so You do NOT need to download the updates listed and you can choose NO if you want.
-Installing Asterisk.
# yum install asterisk asterisk-configs --enablerepo=asterisk-11
-DAHDI. 
# yum install dahdi-linux dahdi-tools libpri 
 
A2Billing:
-Create a directory for "a2billing".
# mkdir -p /usr/local/src/a2billing
-Create a directory "/utils".
# mkdir -p /utils
# chmod 777 /utils
-Change directory.
# cd /utils
-Download and uncompress "a2billing".
# wget https://github.com/Star2Billing/a2billing/archive/master.tar.gz
# tar xvzf master
-Copy the A2Billing uncompressed files to the a2billing directory.
# cp -R /utils/a2billing-master/* /usr/local/src/a2billing/

Apache - Perl - PHP:
-Install PHP.
# yum install -y php php-process php-gd
-Install Perl-DBD.
# yum install -y perl-DBD-Pg
-Start the service.
# service httpd start
-Configure apache to start automatically.
# chkconfig httpd on
-Verification.
# echo "<?php phpinfo() ?>" > /var/www/html/index.php
# firefox "http://localhost" &  

Configure "Manager.conf":
Note: Asterisk Manager Interface (AMI) allows a client program(A2Billing) to connect to an Asterisk instance and issue commands or read events over a TCP/IP stream.
-Edit the file "/etc/asterisk/manager.conf".
[general]
enabled = yes
;webenabled = yes
port = 5038
bindaddr = 0.0.0.0

-Insert the following lines at the end of the file.
[myasterisk]
secret = mycode
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user 
-Reload the asterisk configuration.
# asterisk -rx "core reload"
-Create an empty "index.php" file.
# > /var/www/html/index.php
- Use VIM to insert THIS CODE into "/var/www/html/index.php".
 -Verification.
# firefox "http://localhost" &

MySQL: 
-Install MySQL.
# yum install -y mysql-server php-mysql
-Start MySQL.
# service mysqld start
-Configure MySQL to start automatically.
# chkconfig mysqld on
-Create the a2billing database.
# echo "create database mya2billing" > /utils/mysqldatabase
# mysql < /utils/mysqldatabase
-Populate the database with new tables from install-db.sh script.
# cd /usr/local/src/a2billing/DataBase/mysql-5.x/
# ./install-db.sh
-Answer the following questions.
Enter Database Name:
mya2billing
Enter Hostname:
localhost
Enter UserName:
root
Enter Password:
<leave empty>
-Verification.
# echo -e "use mya2billing;\nshow tables;" > /utils/testmysqldatabase
# mysql < /utils/testmysqldatabase

Configure " a2billing.conf ":
-Make a symbolic link from "/usr/local/src/a2billing/a2billing.conf" to "/etc/a2billing.conf".
# ln -s /usr/local/src/a2billing/a2billing.conf /etc/a2billing.conf
-Edit the file "/etc/a2billing.conf" and modify the following lines.
[database]
hostname = localhost
; port for postgres is 5432 by default
port =3306
user = root
password =
dbname = mya2billing
; dbtype setting can either be mysql or postgres
dbtype = mysql

Asterisk Gateway Interface (AGI):
-Make a symbolic link from "/usr/local/src/a2billing/AGI/a2billing.php" to "/var/lib/asterisk/agi-bin/a2billing.php".
# ln -s /usr/local/src/a2billing/AGI/a2billing.php /var/lib/asterisk/agi-bin/a2billing.php
-Change permissions of the file "/var/lib/asterisk/agi-bin/a2billing.php".
# chmod +x /var/lib/asterisk/agi-bin/a2billing.php
-Change the ownership of the file "/usr/local/src/a2billing/AGI/a2billing.php".
# chown asterisk:asterisk /usr/local/src/a2billing/AGI/a2billing.php
-Change the ownership of the directory "/var/lib/asterisk/".
# chown -R asterisk:asterisk /var/lib/asterisk/
-Change the ownership of the directory "/var/log/asterisk/".
# chown -R asterisk:asterisk /var/log/asterisk/
Change the ownership of the directory "/var/spool/asterisk/".
# chown -R asterisk:asterisk /var/spool/asterisk/

Sounds:
-Install sounds.
# cd /usr/local/src/a2billing/addons/sounds/
# ./install_a2b_sounds.sh
-Create a directory to upload sounds.
# mkdir -p /var/lib/asterisk/sounds/a2billing

Web Interface:
-Create a directory for the graphical interface.
# mkdir -p /var/www/html/a2billing/
-Install web pages.
# ln -s /usr/local/src/a2billing/common /var/www/html/a2billing/common
# ln -s /usr/local/src/a2billing/admin /var/www/html/a2billing/admin
# ln -s /usr/local/src/a2billing/agent /var/www/html/a2billing/agent
# ln -s /usr/local/src/a2billing/customer /var/www/html/a2billing/customer
-Set permissions for Apache.
# chown -R apache:apache /var/www/html/a2billing/
# chown -R apache:apache /usr/local/src/a2billing/common
# chown -R apache:apache /usr/local/src/a2billing/admin
# chown -R apache:apache /usr/local/src/a2billing/customer
# chown -R apache:apache /usr/local/src/a2billing/agent
-Restart Apache and MYSQL.
# service httpd restart
# service mysqld restart
-Go to " http://<A2Billing-IP-Address>/a2billing/admin " and login using the following credentials:   
-User: root  -Password: changepassword

Monitoring - Log Files:
-Create a directory for monitoring script.
# mkdir -p /var/lib/a2billing/script/
-Create a directory for log files.
# mkdir -p /var/log/a2billing/
-Create log files.
# touch /var/log/a2billing/a2b-callback-daemon.log
# touch /var/log/a2billing/a2billing_agi.log
# touch /var/log/a2billing/a2billing_api_callback_request.log
# touch /var/log/a2billing/a2billing_api_card.log
# touch /var/log/a2billing/a2billing_api_ecommerce_request.log
# touch /var/log/a2billing/a2billing_epayment.log
# touch /var/log/a2billing/a2billing_paypal.log
# touch /var/log/a2billing/cront_a2b_alarm.log
# touch /var/log/a2billing/cront_a2b_archive_data.log
# touch /var/log/a2billing/cront_a2b_autorefill.log
# touch /var/log/a2billing/cront_a2b_batch_process.log
# touch /var/log/a2billing/cront_a2b_bill_diduse.log
# touch /var/log/a2billing/cront_a2b_check_account.log
# touch /var/log/a2billing/cront_a2b_currency_update.log
# touch /var/log/a2billing/cront_a2b_invoice.log
# touch /var/log/a2billing/cront_a2b_subscription_fee.log
# ln -s /var/log/asterisk/a2b-callback-daemon.log /var/log/a2billing/daemon-callback.log
-Change permissions.
# chown -R apache:apache /var/log/a2billing/cront*
-Change the ownership of the directory "/var/log/a2billing/".
# chown asterisk:asterisk /var/log/a2billing/a2b-callback-daemon.log
# chown asterisk:asterisk /var/log/a2billing/a2billing_agi.log
# chown asterisk:asterisk /var/log/a2billing/a2billing_api_callback_request.log
# chown asterisk:asterisk /var/log/a2billing/a2billing_api_card.log
# chown asterisk:asterisk /var/log/a2billing/a2billing_api_ecommerce_request.log
# chown asterisk:asterisk /var/log/a2billing/a2billing_epayment.log
# chown asterisk:asterisk /var/log/a2billing/a2billing_paypal.log

A2billing - Official site.
visit Asterisk2Billing for more INFO.