HOWTO :: VoIP: Whosesale :: Calling Card :: OpenSer :: Radius :: Asterisk :: FreeSwitch :: A2Billing :: IVR :: Colo :: Colocations :: GADGETS

April 23, 2010

Installing Asterisk2Billing A2b 1.7.0 in CentOS 5.4

Filed under: A2Billing — Tags: , , , , , — admin @ 10:02 pm

Below is a step by step procedure how to install Asterisk2Billing or A2b 1.7.0 in CentOS 5.

Installation Prerequisites

It is assumed that you have already installed Asterisk on a suitable machine. This tutorial does not cover that part of the installation. If you are unfamiliar with the
install of Asterisk, it may be better to start with a pre-built distribution, e.g.

PBX in a Flash – www.pbxinaflash.com, or FonicaPABX – www.fonicaprojects.com may provide a secure base on which to build A2Billing.

Asterisk Now, Elastix and Trixbox are other possibilities to provide a base as part of the family of Asterisk / FreePBX / CentOS distributions. However, the author has
no knowledge of the security measures in place with these distributions, and indeed, Trixbox do recommend that their system is secured behind a firewall, so may not be
suitable for connection directly to the Internet without some remedial work.

Alternatively, Support and Managed Installation and Training services are available through http://www.star2billing.com

The distributions mentioned are based on Centos, so these instructions are Centos biased.

These distributions can be installed on a VMWare image for testing if no hardware is available.

If you have hand-rolled your own distribution, and are familiar with 1.3.4, then the we assume that you have the necessary dependencies already installed.

Install Dependencies

yum -y install perl-DBD-Pg subversion

get A2Billing

mkdir /usr/local/src/a2billing
cd /usr/local/src/a2billing
svn co –username guest –password guest http://svn.a2billing.net/svn/asterisk2billing/trunk/ /usr/local/src/a2billing

copy a2billing.conf in /usr/local/src/a2billing/a2billing.conf to /etc/a2billing.conf

Edit a2billing.conf to suit your installation. e.g. change dbtype to mysql.

Install Database

Note that for Piaf and FonicaPABX, the database password is passw0rd and the location is localhost
cd /usr/local/src/a2billing/DataBase/mysql-5.x
./install-db.sh

Answer the questions appropriately with reference to /etc/a2billing.conf

You should now have a database called mya2billing with over 70 tables in it.

Install the AGI and Sound Files

So that we can easily update the system when changes are made during this period of change, we are going to use links back to the location where we installed the SVN
download, so that an update from the SVN will immediately reflect in your A2Billing install.

Note that Database changes will not be included using this methodology, so these will have to be done by hand.

This is not the usual way of doing it, but for testing, it works well. You can also simply move or copy the files into the appropriate location.
ln -s /usr/local/src/a2billing/AGI/a2billing.php /var/lib/asterisk/agi-bin/a2billing.php

set ownership and permissions on AGI

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

Set up sounds

cd /usr/local/src/a2billing/addons/sounds
./install_a2b_sounds.sh

set ownership on sounds

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

Asterisk Manager

Now edit /etc/asterisk/manager_custom.conf (or manager.conf for those not using a pre-rolled distribution including FreePBX). Add the following lines
[myasterisk]
secret = mycode
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user

Install Web Pages

Assumption is that apache2 root folder is /var/www/html

Common

ln -s /usr/local/src/a2billing/common /var/www/html/a2billing/common

Admin pages

ln -s /usr/local/src/a2billing/admin /var/www/html/a2billing/admin

Agent

ln -s /usr/local/src/a2billing/agent /var/www/html/a2billing/agent

Customer

ln -s /usr/local/src/a2billing/customer /var/www/html/a2billing/customer

Now we need to set permissions for Apache.

If you are using a pre-rolled Distro, then web group and ownership are asterisk and asterisk, if you are not using a distro, then you probably know what to set anyway.
chown -R asterisk:asterisk /var/www/html/a2billing/
chown -R asterisk:asterisk /usr/local/src/a2billing/common
chown -R asterisk:asterisk /usr/local/src/a2billing/admin
chown -R asterisk:asterisk /usr/local/src/a2billing/customer
chown -R asterisk:asterisk /usr/local/src/a2billing/agent

Cronjobs

echo ”
# Automatically added for A2Billing
0 * * * * php /usr/local/src/a2billing/Cronjobs/a2billing_alarm.php
0 12 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_archive_data_cront.php
0 10 21 * * php /usr/local/src/a2billing/Cronjobs/a2billing_autorefill.php
#Batch process at 00:20 each day
20 0 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_batch_process.php
#Bill DID usage at 00:00 each day
0 0 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_bill_diduse.php
#Generate Invoices at 6am everyday
0 6 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_batch_billing.php
#Check if balance below preset value, and email user if so.
1 * * * * php /usr/local/src/a2billing/Cronjobs/a2billing_notify_account.php
#Charge subscriptions at 06:05 on the 1st of each month
0 6 1 * * php /usr/local/src/a2billing/Cronjobs/a2billing_subscription_fee.php
#Update currencies at 01:00 each day
0 1 * * * php /usr/local/src/a2billing/Cronjobs/currencies_update_yahoo.php
” >> /var/spool/cron/asterisk

Add directory for monitoring Script

mkdir -p /var/lib/a2billing/script
mkdir -p /var/run/a2billing

Create Log Files

Log files and Permissions

touch /var/log/asterisk/a2billing-daemon-callback.log
touch /var/log/a2billing-daemon-callback.log
touch /var/log/cront_a2b_alarm.log
touch /var/log/cront_a2b_autorefill.log
touch /var/log/cront_a2b_batch_process.log
touch /var/log/cront_a2b_bill_diduse.log
touch /var/log/cront_a2b_subscription_fee.log
touch /var/log/cront_a2b_currency_update.log
touch /var/log/cront_a2b_invoice.log
touch /var/log/a2billing_paypal.log
touch /var/log/a2billing_epayment.log
touch /var/log/api_ecommerce_request.log
touch /var/log/api_callback_request.log
touch /var/log/a2billing_agi.log

Callback

Here is a little script to install the call-back Daemon. Change the LOAD_LOC variable to reflect where you have downloaded A2Billing.

Callback Daemon installation Script

LOAD_LOC=/usr/local/src/a2billing

yum -y install python-setuptools.noarch
yum -y install MySQL-python
easy_install sqlalchemy

cd $LOAD_LOC/Callback/callback-daemon-py
cp $LOAD_LOC/CallBack/callback-daemon-py/build/lib/callback_daemon/a2b-callback-daemon.rc /etc/init.d/a2b-callback-daemon
chmod +x /etc/init.d/a2b-callback-daemon

cd $LOAD_LOC/CallBack/callback-daemon-py/
python setup.py build
python setup.py bdist_egg
easy_install dist/callback_daemon-1.0.prod_r1528-py2.4.egg
chkconfig –add a2b-callback-daemon
service a2b-callback-daemon start
chkconfig a2b-callback-daemon on

Dialplan

The dialplan you put into Asterisk is the same as it was for A2Billing 1.3.4. I’ve not got round to writing the dialplan as yet.

Reboot

Login

http://Your-Switch/a2billing

Log into the admin pages with root and changepassword

General Setup

The general setup is similar to 1.3.4, and the order of events is approximately similar

* Set up trunk * Set up callplan * Setup rate plan * add rate table to callplan * add rates * add customer * test.

Guidelines

Keep an eye on the development of A2Billing here.

http://www.asterisk2billing.org/cgi-bin/trac.cgi/browser/trunk

Make sure that you are running the latest version before reporting a bug by periodically running.

Bugs can be dicussed in the bugs section here – http://forum.asterisk2billing.org/viewforum.php?f=22 before reporting them on the bug tracker.

Bugs tracking and reporting can be done here:- http://www.asterisk2billing.org/cgi-bin/trac.cgi/report

March 29, 2010

Installing Asterisk2Billing A2B 1.6 in Debian Lenny 5.0.4

Filed under: A2Billing, Asterisk PBX — Tags: , , , — admin @ 7:19 pm

I assumed that Debian Lenny is already installed on the system. This is a step-by-step procedure how to install Asterisk2Billing or A2B in Debian Lenny. This HowTo is just a copy/paste procedure. Let me know if you run into trouble installing this.

apt-get update
apt-get upgrade
aptitude install ssh ntp screen
aptitude install build-essential libcurl3-dev libvorbis-dev libspeex-dev unixodbc unixodbc-dev libiksemel-dev flex xsltproc linux-headers-`uname -r` g++ libncurses5-dev libnewt-dev libusb-dev subversion git-core flex bison
cd /usr/src/
wget http://downloads.digium.com/pub/asterisk/asterisk-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/asterisk/asterisk-addons-1.4-current.tar.gz
tar xvfz asterisk-1.4-current.tar.gz
tar xvzf asterisk-1.4-current.tar.gz && tar xvzf zaptel-1.4-current.tar.gz && tar xvzf libpri-1.4-current.tar.gz && tar xvzf asterisk-addons-1.4-current.tar.gz tar
tar xvfz zaptel-1.4.12.1/
cd zaptel-1.4.12.1/
./install_prereq test
./install_prereq install
./configure
make
make install
make config
modprobe ztdummy
cd ../libpri-1.4.10.2/
make && make install
cd ../asterisk-1.4.30/
./configure
make
make install
make samples
make config
asterisk -vvvvvvvvvvvvgc
echo “ztdummy”
echo “ztdummy” >> /etc/modules
cd ../asterisk-addons-1.4-current.tar.gz
cd ..
tar xvfz asterisk-addons-1.4-current.tar.gz
cd asterisk-addons-1.4.10/
./configure && make && make install
make samples
apt-get install apache2 php5 mysql-server
cd /var/www/
wget http://www.asterisk2billing.org/downloads/A2Billing_1.6.0.tar.gz
tar xvfz A2Billing_1.6.0.tar.gz
mv A2Billing_1.6.0.tar.gz /tmp/
apt-get install libapache2-mod-php5 php5 php5-common
apt-get install php5-cli php5-mysql mysql-server apache2 php5-gd
apt-get install openssh-server subversion
apt-get install php5-mcrypt
mysql -u root -p < DataBase/mysql-5.x/a2billing-createdb-user.sql
mysql -u a2billinguser -p mya2billing
mysql -u root -p mya2billing < DataBase/mysql-5.x/a2billing-schema-v1.4.0.sql
mysql -u root -p mya2billing < DataBase/mysql-5.x/UPDATE-a2billing-v1.4.0-to-v1.4.1.sql
mysql -u root -p mya2billing < DataBase/mysql-5.x/UPDATE-a2billing-v1.4.1-to-v1.4.2.sql
mysql -u root -p mya2billing < DataBase/mysql-5.x/UPDATE-a2billing-v1.4.2-to-v1.4.3.sql
mysql -u root -p mya2billing < DataBase/mysql-5.x/UPDATE-a2billing-v1.4.3-to-v1.4.4.sql
mysql -u root -p mya2billing < DataBase/mysql-5.x/UPDATE-a2billing-v1.4.4-to-v1.4.4.1.sql
mysql -u root -p mya2billing < DataBase/mysql-5.x/UPDATE-a2billing-v1.4.4.1-to-v1.4.5.sql
mysql -u root -p mya2billing < DataBase/mysql-5.x/UPDATE-a2billing-v1.4.5-to-v1.5.0.sql
mysql -u root -p mya2billing < DataBase/mysql-5.x/UPDATE-a2billing-v1.5.0-to-v1.5.1.sql
mysql -u root -p mya2billing < DataBase/mysql-5.x/UPDATE-a2billing-v1.5.1-to-v1.6.0.sql
mysql -u a2billinguser -p mya2billing
cp a2billing.conf /etc/

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 www-data /etc/asterisk/additional_a2billing_iax.conf
chown -Rf www-data /etc/asterisk/additional_a2billing_sip.conf
cd addons/sounds/
./install_a2b_sounds.sh
chown -R asterisk:asterisk /var/lib/asterisk/sounds/
vi /etc/asterisk/manager.conf

Notice that we are using the default values (myasterisk, mycode) in this section. The configuration should look like this
[general]
enabled = yes
port = 5038
bindaddr = 0.0.0.0

[myasterisk]
secret=mycode
read=system,call,log,verbose,command,agent,user
write=system,call,log,verbose,command,agent,user

cd AGI/
cp a2billing.php /var/lib/asterisk/agi-bin/
cp -rf ../common/lib /var/lib/asterisk/agi-bin/
chmod +x /var/lib/asterisk/agi-bin/a2billing.php
mkdir /var/www/a2billing
chown www-data:www-data /var/www/a2billing
mkdir -p /var/lib/a2billing/script
mkdir -p /var/run/a2billing
mv admin a2billing/
mv agent a2billing/
mv customer a2billing/
mv common a2billing/
chmod 755 a2billing/admin/templates_c
chmod 755 a2billing/customer/templates_c
chmod 755 a2billing/agent/templates_c
chown -Rf www-data:www-data /var/www/a2billing/admin/templates_c
chown -Rf www-data:www-data /var/www/a2billing/customer/templates_c/
chown -Rf www-data:www-data /var/www/a2billing/customer/templates_c
chown -Rf www-data:www-data /var/www/a2billing/agent/templates_c
/etc/init.d/apache2 status
/etc/init.d/apache2 restart
apt-get install python-setuptools python-mysqldb python-psycopg2 python-sqlalchemy
easy_install callback-daemon-py/dist/callback_daemon-1.0.prod_r1527-py2.5.egg

Direct a browser to the administrative web interface (http:///a2billing/admin) and login as administrator. Default passwords are:
user: root
pass: changepassword

vi /etc/asterisk/extensions.conf

[default]

include => a2billing

[a2billing]
; CallingCard application
exten => _X.,1,Answer
exten => _X.,2,Wait,2
exten => _X.,3,DeadAGI,a2billing.php
exten => _X.,4,Wait,2
exten => _X.,5,Hangup

[did]
; CallingCard application
exten => _X.,1,DeadAGI(a2billing.php|1|did)

crontab -e

# update the currency table
0 6 * * * php /usr/local/src/a2billing/Cronjobs/currencies_update_yahoo.php

# manage the monthly services subscription
0 6 1 * * php /usr/local/src/a2billing/Cronjobs/a2billing_subscription_fee.php

# To check account of each Users and send an email if the balance is less than the user have choice.
0 * * * * php /usr/local/src/a2billing/Cronjobs/a2billing_notify_account.php

# this script will browse all the DID that are reserve and check if the customer need to pay for it
# bill them or warn them per email to know if they want to pay in order to keep their DIDs
0 2 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_bill_diduse.php

# This script will take care of the recurring service.
0 12 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_batch_process.php

#Generate Invoices at 6am everyday
0 6 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_batch_billing.php

# to proceed the autodialer
*/5 * * * * php /usr/local/src/a2billing/Cronjobs/a2billing_batch_autodialer.php

# manage alarms
0 * * * * php /usr/local/src/a2billing/Cronjobs/a2billing_alarm.php

This is the initial installation for Asterisk2Billing 1.6 in Debian Lenny 5.0.4

Powered by WordPress

HOWTO :: VoIP: Whosesale :: Calling Card :: OpenSer :: Radius :: Asterisk :: FreeSwitch :: A2Billing :: IVR :: Colo :: Colocations :: GADGETS is Digg proof thanks to caching by WP Super Cache!