As some of you may be aware, A2Billing 1.4 is shortly to be released under beta, and it would be good to get as many eyes on it as possible.
The more contribution we have, then the better the end product.
There are lots of new features, a clean up of the invoicing, commission agent/reseller functionality and database efficiency savings.
I should mention that this is in no way suitable for commercial deployment, or testing on a production PBX. There is lots of work to be done to bring it up to scratch.
Additionally, there is work progressing on documentation, and we expect the documentation to be the best it's ever been for a new release of A2Billing.
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 distributiion, e.g.
PBX in a Flash -
www.pbxinaflash.com, or the newest entry,
http://www.fonicaprojects.com written by me.
Both are based on Centos, so these instructions are Centos biased.
Both these distributions can be installed on a VMWare image for testing if no hardware is available.
If you have handrolled your own distribution, and are familiar with 1.3.4, then the we assume that you have the necessary dependencies already installed.
Install Dependencies
Code:
yum -y install perl-DBD-Pg subversion
#get A2Billing
Code:
mkdir /var/a2billing_install
cd /var/a2billing_install
svn co --username guest --password guest http://svn.a2billing.net/svn/asterisk2billing/trunk
copy a2billing.conf in /var/a2billing_install/trunk to /etc/a2billing.conf
Edit a2billing.conf to suit your installation. e.g. change dbtype to mysql.
Install DatabaseNote that for Piaf and FonicaPABX, the database password is passw0rd and the location is localhost
Code:
echo "GRANT ALL PRIVILEGES ON *.* TO 'a2billinguser'@'localhost' IDENTIFIED BY 'a2billing' WITH GRANT OPTION;" | mysql -ppassw0rd
mysqladmin create mya2billing -u a2billinguser -pa2billing
Code:
cd /var/a2billing_install/trunk/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 FilesSo 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.
Code:
ln /var/a2billing_install/trunk/AGI/a2billing.php /var/lib/asterisk/agi-bin/a2billing.php
Code:
#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 /var/a2billing_install/trunk/addons/sounds
./install_a2b_sounds.sh
#set ownership on sounds
chown -R asterisk:asterisk /var/lib/asterisk/
Now edit /etc/asterisk/manager_custom.conf (or manager.conf for those not using a pre-rolled distribution). Add the following lines
Code:
[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 PagesCode:
mkdir /var/www/html/a2billing
CommonCode:
ln -s /var/a2billing_install/trunk/common /var/www/html/a2billing/common
Admin pagesCode:
ln -s /var/a2billing_install/trunk/admin /var/www/html/a2billing/admin
AgentCode:
ln -s /var/a2billing_install/trunk/agent /var/www/html/a2billing/agent
CustomerCode:
ln -s /var/a2billing_install/trunk/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.
Code:
chown -R asterisk:asterisk /var/www/html/a2billing/
chown -R asterisk:asterisk /var/a2billing_install/trunk/common
chown -R asterisk:asterisk /var/a2billing_install/trunk/admin
chown -R asterisk:asterisk /var/a2billing_install/trunk/customer
chown -R asterisk:asterisk /var/a2billing_install/trunk/agent
Cronjobs Code:
echo "
# Automatically added for A2Billing
0 * * * * php /var/a2billing_install/trunk/Cronjobs/a2billing_alarm.php
0 12 * * * php /var/a2billing_install/trunk/Cronjobs/a2billing_archive_data_cront.php
0 10 21 * * php /var/a2billing_install/trunk/Cronjobs/a2billing_autorefill.php
#Batch process at 00:20 each day
20 0 * * * php /var/a2billing_install/trunk/Cronjobs/a2billing_batch_process.php
#Bill DID usage at 00:00 each day
0 0 * * * php /var/a2billing_install/trunk/Cronjobs/a2billing_bill_diduse.php
#Remind users of low balance every day at 06:00
0 6 * * * php /var/a2billing_install/trunk/Cronjobs/a2billing_check_account.php
#Generate Invoices at 7am everyday
0 7 * * * php /var/a2billing_install/trunk/Cronjobs/a2billing_invoice2_cront.php
0 7 * * * php /var/a2billing_install/trunk/Cronjobs/a2billing_invoice_cront.php
#Check if balance below preset value, and email user if so.
1 * * * * php /var/a2billing_install/trunk/Cronjobs/a2billing_notify_account.php
#Charge subscriptions at 06:05 on the 1st of each month
0 6 1 * * php /var/a2billing_install/trunk/Cronjobs/a2billing_subscription_fee.php
#Update currencies at 01:00 each day
0 1 * * * php /var/a2billing_install/trunk/Cronjobs/currencies_update_yahoo.php
" >> /var/spool/cron/asterisk
Create Log Files# Ensure all log files exist so we can set their permissions correctly
Code:
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/cront_a2b_check_account.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
CallbackAt the moment, I have not cracked the installation of Callback on version 5.2 of Centos, so if anyone has any ideas on how to do this, or a brief howto, then please let me know.
The instructions are in /var/a2billing_install/trunk/addons/Doc
The files are in /var/a2billing_install/trunk/CallBack
DialplanThe 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.
RebootLoginhttp://Your-Switch/a2billingLog into the admin pages with root and changepassword
General SetupThe 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.
GuidelinesKeep an eye on the development of A2Billing 1.4 here.
http://www.asterisk2billing.org/cgi-bin ... wser/trunkMake sure that you are running the latest version before reporting a bug by periodically running.
Code:
cd /var/a2billing_install
svn co --username guest --password guest http://svn.a2billing.net/svn/asterisk2billing/trunk
chown -R asterisk:asterisk /var/a2billing_install/trunk/common
chown -R asterisk:asterisk /var/a2billing_install/trunk/admin
chown -R asterisk:asterisk /var/a2billing_install/trunk/customer
chown -R asterisk:asterisk /var/a2billing_install/trunk/agent
chown asterisk:asterisk /var/lib/asterisk/agi-bin/a2billing.php
chmod +x /var/lib/asterisk/agi-bin/a2billing.php
Bugs can be dicussed in the 1.4 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
The instructions were written from memory and my notes, so I am not guaranteeing accuracy, any corrections, let me know.
Finally, did I mention that A2Billing should not be put into a production environment, and its probably not a good idea to install it on a production PBX.
Yours
Joe Roper