Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Fri Apr 19, 2024 8:28 pm
VoIP Billing solution


All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: A2billing script 1.5.1 for trixbox working
PostPosted: Sat Feb 13, 2010 12:55 am 
Offline

Joined: Tue Jul 04, 2006 10:09 pm
Posts: 38
After searching for weeks a easy way to install a2billing 1.5 on trixbox I find one , modify and test.
All credit goes to Joe Roper
I will upload the script but I need desperate help for finalizing a2billig after installation to be able to put in production.
I use a2billing more for postpaid but i did not find a way to make it how suppose to be. For example For postpaid it is necessary to have Invoices with call detailed. I did search on a2billing forum but not luck
Other problem , I am not able to make auto invoicing. Suppose to be a cron tab to do that but not glue how can I check it if does exist and the auto invoice it is not working for me
So any help will be very appreciated


Top
 Profile  
 
 Post subject: Re: A2billing script 1.5.1 for trixbox working
PostPosted: Sat Feb 13, 2010 7:12 am 
Offline

Joined: Fri Jun 23, 2006 3:56 pm
Posts: 4065
Hi

Thanks for the credit, however, I would be reluctant to use Trixbox as a base for A2Billing.

Trixbox is built and designed to be an office PBX, and to be put behind a firewall with very restricted access from the internet, it has not been hardened to be connected directly to the internet.

This is not a criticism of Trixbox, simply that you are trying to use it for a purpose for which it is not intended.

This is evidenced by the fact that there is no protection or password access to the FOP - which you would not be running anyway, as it is worth about 100 concurrent calls, being a flash application, thus anyone who happens across your Trixbox can see what extensions you have, and the names there, and if you have not changed the default FOP password (passw0rd) any can make any phone ring.

When installing a system for A2Billing, you should consider IP Tables, and some sort of active response, e.g. fail2ban or OSSEC, and only expose to the outside world what needs to be exposed.

Whether this video is still applicable is not known. - http://www.youtube.com/watch?v=5gRWD2g245U

In respect of the invoicing, many of our customers have many thousands, or in some case, millions of calls per month, which could work out to a very long piece of paper. I would recommend that if the customer wants to know what calls they have made, they log in and have a look at their CDR.

You may also want to review this thread - viewtopic.php?f=23&t=6945 as I am still looking for acceptance on this, and there is always the option to sponsor development for this feature.


Joe


Top
 Profile  
 
 Post subject: Re: A2billing script 1.5.1 for trixbox working upgrade 1.7
PostPosted: Fri Apr 23, 2010 1:32 pm 
Offline

Joined: Tue Jul 04, 2006 10:09 pm
Posts: 38
As I promis, here it is the script for upgrade / install a2billing 1.7 . I did use it on Trixbox and it is working fine. Just be sure that you save your database before to run the schipt , because will be droped.
As well change the SQL password ( on script it is passw0rd )
Enjoy and if somebody can help me with the detaile invoice and export to pdf invoice I really apreciate :mrgreen:


#!/bin/sh

DATETAG=`date +%Y%m%d%H%k%M%S`

echo "This is the A2Billing 1.7.0 setup/update script"
echo ""

# Step1: Removing A2billing Old files
rm -f -R /var/www/html/a2billing/
rm -f -R /var/www/html/a2customer/
rm -f -R /var/lib/asterisk/agi-bin/a2billing.php
rm -f -R /var/lib/asterisk/agi-bin/libs_a2billing/
rm -f -R /var/lib/asterisk/agi-bin/lib/
rm -f -R /etc/asterisk/additional_a2billing_iax.conf
rm -f -R /etc/asterisk/additional_a2billing_sip.conf
rm -f /etc/asterisk/a2billing.conf
rm -f /etc/a2billing.conf
rm -f -R /var/www/html/agent/
rm -f -R /var/www/html/common/
rm -f -R /usr/src/a2billing/

# Drop the old database (if it exists)

mysqladmin drop mya2billing -u root -ppassw0rd

echo "*************************************************************"
echo " Installing A2Billing 1.7.0 - Downloading files from the internet"
echo ""
echo " Please be patient"
echo ""
echo "CAUTION, run this script only once - otherwise you will have"
echo "double entries in cron and extensions-a2billing.conf"
echo "*************************************************************"
# Step2: A2billing installation
echo " Creating work spaces.."

cd /usr/src
mkdir a2billing
cd a2billing
wget http://www.k2systems.ca/downloads/A2Bil ... 7.0.tar.gz
tar -xzf A2Billing_1.7.0.tar.gz
chown -R root:root /usr/src/a2billing

echo " Building the new database and loading new schemas into it.."

mysql -u root -ppassw0rd < /usr/src/a2billing/DataBase/mysql-5.x/a2billing-createdb-user.sql
mysql mya2billing -u root -ppassw0rd < /usr/src/a2billing/DataBase/mysql-5.x/a2billing-schema-v1.4.0.sql

mysql mya2billing -u root -ppassw0rd </usr/src/a2billing/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.0-to-v1.4.1.sql
mysql mya2billing -u root -ppassw0rd </usr/src/a2billing/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.1-to-v1.4.2.sql
mysql mya2billing -u root -ppassw0rd </usr/src/a2billing/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.2-to-v1.4.3.sql
mysql mya2billing -u root -ppassw0rd </usr/src/a2billing/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.3-to-v1.4.4.sql
mysql mya2billing -u root -ppassw0rd </usr/src/a2billing/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.4-to-v1.4.4.1.sql
mysql mya2billing -u root -ppassw0rd </usr/src/a2billing/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.4.1-to-v1.4.5.sql
mysql mya2billing -u root -ppassw0rd </usr/src/a2billing/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.5-to-v1.5.0.sql
mysql mya2billing -u root -ppassw0rd </usr/src/a2billing/DataBase/mysql-5.x/UPDATE-a2billing-v1.5.0-to-v1.5.1.sql
mysql mya2billing -u root -ppassw0rd </usr/src/a2billing/DataBase/mysql-5.x/UPDATE-a2billing-v1.5.1-to-v1.6.0.sql
mysql mya2billing -u root -ppassw0rd </usr/src/a2billing/DataBase/mysql-5.x/UPDATE-a2billing-v1.6.0-to-v1.6.1.sql
mysql mya2billing -u root -ppassw0rd </usr/src/a2billing/DataBase/mysql-5.x/UPDATE-a2billing-v1.6.1-to-v1.6.2.sql
mysql mya2billing -u root -ppassw0rd </usr/src/a2billing/DataBase/mysql-5.x/UPDATE-a2billing-v1.6.2-to-v1.7.0.sql

echo " Configuring the GUIs and some config files.."

# Step3: A2billing web interfaces installation
cp -rf /usr/src/a2billing/customer /var/www/html/a2customer
chmod 777 /var/www/html/a2customer/templates_c
cp -rf /usr/src/a2billing/agent /var/www/html
chmod 777 /var/www/html/agent/templates_c
cp -rf /usr/src/a2billing/admin /var/www/html/a2billing
chmod 777 /var/www/html/a2billing/templates_c
cp -Rf /usr/src/a2billing/common /var/www/html

cp /usr/src/a2billing/AGI/a2billing.php /var/lib/asterisk/agi-bin/
cp -rf /usr/src/a2billing/common/lib /var/lib/asterisk/agi-bin/
chmod +x /var/lib/asterisk/agi-bin/a2billing.php
chown -R asterisk:asterisk /var/lib/asterisk/agi-bin

# Step4: A2billing configuration files
cp /usr/src/a2billing/a2billing.conf /etc/asterisk
chown asterisk:asterisk /etc/asterisk/a2billing.conf
ln -sf /etc/asterisk/a2billing.conf /etc/a2billing.conf

echo "Building the new a2billing.conf.."

sed -i "s/\(port *= *\)\(.*\)/\5432/" /etc/asterisk/a2billing.conf
sed -i "s/\(user *= *\)\(.*\)/\1a2billinguser/" /etc/asterisk/a2billing.conf
sed -i "s/\(password *= *\)\(.*\)/\1a2billing/" /etc/asterisk/a2billing.conf
sed -i "s/\(dbname *= *\)\(.*\)/\1mya2billing/" /etc/asterisk/a2billing.conf

echo "Building some Music On Hold mp3 directories and setting privileges.."
mkdir -p /var/lib/asterisk/mohmp3/acc_1
mkdir -p /var/lib/asterisk/mohmp3/acc_2
mkdir -p /var/lib/asterisk/mohmp3/acc_3
mkdir -p /var/lib/asterisk/mohmp3/acc_4
mkdir -p /var/lib/asterisk/mohmp3/acc_5
mkdir -p /var/lib/asterisk/mohmp3/acc_6
mkdir -p /var/lib/asterisk/mohmp3/acc_7
mkdir -p /var/lib/asterisk/mohmp3/acc_8
mkdir -p /var/lib/asterisk/mohmp3/acc_9
mkdir -p /var/lib/asterisk/mohmp3/acc_10
chmod 777 /var/lib/asterisk/mohmp3/acc_*
chown -R asterisk:asterisk /var/lib/asterisk/mohmp3/

echo "Installing extra sounds..."
# A2billing Extra sounds
cd /usr/src/a2billing/addons/sounds
./install_a2b_sounds.sh

echo "Creating additionals_a2billing files.."
# Step6: Asterisk files
cd /etc/asterisk/
touch additional_a2billing_iax.conf
touch additional_a2billing_sip.conf
touch extensions_a2billing.conf

echo "#include additional_a2billing_sip.conf" >> /etc/asterisk/sip_custom.conf
echo "#include additional_a2billing_iax.conf" >> /etc/asterisk/iax_custom.conf
echo -e >> /etc/asterisk/extensions_custom.conf
echo "#include extensions_a2billing.conf" >> /etc/asterisk/extensions_custom.conf

echo "Settings the rights ..."
# Step7: A2billing file permissions
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/common
chown -R asterisk:asterisk /var/www/html/a2billing
chown -R asterisk:asterisk /var/www/html/a2customer
chown -R asterisk:asterisk /var/www/html/agent
chown -R asterisk:asterisk /var/lib/asterisk/

echo"Some changes in extensions_custom.conf..please check it out later.."
echo '
[macro-dialout-trunk-predial-hook]
exten => s,1,GotoIf($["${OUT_${DIAL_TRUNK}:4:4}" = "A2B/"]?custom-freepbx-a2billing,${OUTNUM},1:2)
exten => s,2,MacroExit

[custom-freepbx-a2billing]
exten => _X.,1,DeadAGI(a2billing.php|${OUT_${DIAL_TRUNK}:8})
exten => _X.,n,Hangup()
' >> /etc/asterisk/extensions_custom.conf


echo " The A2Billing needed new contexts .."
#Add the A2Billing context

echo "
[a2billing]
exten => _X.,1,Answer
exten => _X.,n,Wait(1)
exten => _X.,n,deadAGI(a2billing.php|1)
exten => _X.,n,Hangup

[a2billing-callback]
exten => _X.,1,deadAGI(a2billing.php|1|callback)
exten => _X.,n,Hangup

[a2billing-cid-callback]
exten => _X.,1,deadAGI(a2billing.php|1|cid-callback|34) ;last #parameter is the callback area code
exten => _X.,n,Hangup

[a2billing-all-callback]
exten => _X.,1,deadAGI(a2billing.php|1|all-callback|34) ;last #parameter is the callback area code
exten => _X.,n,Hangup

[a2billing-did]
exten => _X.,1,deadAGI(a2billing.php|1|did)
exten => _X.,2,Hangup

[a2billing-voucher]
exten => _X.,1,deadAGI(a2billing.php|1|voucher)
exten => _X.,n,Hangup

[custom-a2billing-did]
exten => _X.,1,deadAGI(a2billing.php|1|did)
exten => _X.,2,Hangup

[custom-a2billing]
exten => _X.,1,deadAGI(a2billing.php|1)
exten => _X.,n,Hangup

" >> /etc/asterisk/extensions_a2billing.conf


echo " Add some custom destinations to FreePBX. Check it out later too.."
#Agrega algunos custom destinations a FreePBX
RESULT=`/usr/bin/mysql -uroot -ppassw0rd <<SQL

use asterisk
INSERT INTO custom_destinations
(custom_dest, description, notes)
VALUES ('custom-a2billing,${EXTEN},1', 'A2Billing', '');
INSERT INTO custom_destinations
(custom_dest, description, notes)
VALUES ('custom-a2billing-did,${EXTEN},1', 'A2Billing-DID', '');
quit
SQL`


echo" Creating the Cronjobs in /var/spool/cron/asterisk"
# Cronjobs

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


echo"Creating the log files in /var/log/a2billing.."
# Create Log Files
# Log files and Permissions

mkdir -p /var/log/a2billing

touch /var/log/asterisk/a2billing-daemon-callback.log
touch /var/log/a2billing/a2billing-daemon-callback.log
touch /var/log/a2billing/cront_a2b_alarm.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_subscription_fee.log
touch /var/log/a2billing/cront_a2b_currency_update.log
touch /var/log/a2billing/cront_a2b_invoice.log
touch /var/log/a2billing/cront_a2b_check_account.log
touch /var/log/a2billing/a2billing_paypal.log
touch /var/log/a2billing/a2billing_epayment.log
touch /var/log/a2billing/api_ecommerce_request.log
touch /var/log/a2billing/api_callback_request.log
touch /var/log/a2billing/a2billing_agi.log

chown asterisk:asterisk /var/log/asterisk/a2billing-daemon-callback.log
chown -R asterisk:asterisk /var/log/a2billing


# Set up Callback
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "Now installing callback"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

echo "Press any key to continue (presione cualquier tecla para continuar)"
read any



LOAD_LOC=/usr/src/a2billing

echo " Installing python tools and sqlalchemy"
yum -y install python-setuptools.noarch
yum -y install MySQL-python
easy_install sqlalchemy


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


echo "Building the callback_daemon from sources.."
cp dist/callback_daemon-1.0.prod-r1528.tar.gz /tmp
cd /tmp
tar xvfz callback_daemon-1.0.prod-r1528.tar.gz
cd callback_daemon-1.0.prod-r1528

python setup.py build
python setup.py bdist_egg
easy_install dist/callback_daemon-1.0.prod_r1528-py2.4.egg

echo "Making a bootable callback-daemon "
chkconfig --add a2b-callback-daemon
service a2b-callback-daemon start
chkconfig a2b-callback-daemon on

echo ""
echo ""
echo ""
echo ""
echo ""
echo "*******************************************************************"
echo "A2Billing is installed successfully in your PBX"
echo "-------------------------------------------------"
echo ""
echo "Please Reboot as soon as you are able to."
echo ""
echo "*******************************************************************"
echo ""
echo "The default username is root"
echo "The default password is changepassword"
echo "Enjoy it! Happy a2billing hacking! ;-) I will do!"
echo "*******************************************************************"


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 
VoIP Billing solution


All times are UTC


Who is online

Users browsing this forum: No registered users and 28 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group