Vous êtes sur la page 1sur 5

This is Step by Step upgrade process for my

Elastix A2billing
November 23, 2009 at 3:49 am Leave a comment

Step 1: Drop Database


[root@elastix agi-bin]# mysql -u root -peLaStIx.2oo7
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2866
Server version: 5.0.45 Source distribution
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.mysql>
mysql> DROP DATABASE mya2billing;
Query OK, 51 rows affected (1.11 sec)
mysql> quit
Bye
Step 2: Uninstall a2billing
[root@elastix agi-bin]# rpm -e elastix-a2billing
[root@elastix agi-bin]#
#mkdir /usr/local/src/a2billing

Step 3: Download a2billing tar package and create under folder /usr/local/src
[root@elastix agi-bin]# cd /usr/local/src/a2billing/
[root@elastix a2billing]#
[root@elastix a2billing]# wget http://www.asterisk2billing.org/downloads/A2Billing_1.4.1.tar.gz
–14:57:54– http://www.asterisk2billing.org/downloads/A2Billing_1.4.1.tar.gz
Resolving Error! Hyperlink reference not valid.; 94.23.22.127
Connecting to http://www.asterisk2billing.org|94.23.22.127|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 9658300 (9.2M) [application/x-gzip]
Saving to: `A2Billing_1.4.1.tar.gz’
100%
[==============================================================================
=============>] 9,658,300 91.2K/s in 58s
14:58:54 (163 KB/s) – `A2Billing_1.4.1.tar.gz’ saved [9658300/9658300]
[root@elastix a2billing]#
Step 4: Untar tha package
[root@elastix a2billing]# tar zxvf A2Billing_1.4.1.tar.gz
Step 5: create a MySQL database (mya2billing) for the billing software.

The file a2billing-createdb-user.sql includes a script that creates the database with the correct access
control users and permissions.
#cd /usr/local/src/a2billing

#mysql -u root -p < DataBase/mysql-5.x/a2billing-createdb-user.sql

(the elastix mysql root´s password is: eLaStIx.2oo7)


The script with create a database, username and password with the following default values
Database name is: mya2billing

Database user is: a2billinguser

User password is: a2billing

After creating the database structure, we will create a set of tables and insert some initial basic
configuration data
[root@elastix a2billing]# cd /usr/local/src/a2billing
[root@elastix a2billing]# mysql -u root -p
Enter password: eLaStIx.2oo7
[root@elastix a2billing]# mysql -u root -p mya2billing
Enter password: eLaStIx.2oo7
[root@elastix a2billing]# mysql -u root -p mya2billing
Enter password: eLaStIx.2oo7
Step 6: Copy the a2billing configuration file to /etc folder
[root@elastix a2billing]# cp /usr/local/src/a2billing/a2billing.conf /etc/

Step 7: 6) Edit the file. 

#vi /etc/a2billing.conf

Change the “database” paramenter as follow, the other paramaters must remain unchanged:
[database]

hostname = localhost

port = 3306

user = a2billinguser

password = a2billing

dbname = mya2billing

dbtype = mysql
Step 8: Create the additional files and setup the correct owner:
Create the additional files and setup the correct owner
#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 asterisk:asterisk /etc/asterisk/additional_a2billing_iax.conf

#chown -Rf asterisk:asterisk /etc/asterisk/additional_a2billing_sip.conf


Step 9: Install the sound files

[root@elastix a2billing]# /usr/local/src/a2billing/addons/sounds/install_a2b_sounds.sh


Install A2Billing Audio files : en
—————————————————
creating relevant folders : /var/lib/asterisk/sounds/en
creating relevant folders : /var/lib/asterisk/sounds/en/digits
mkdir: cannot create directory `/var/lib/asterisk/sounds/en': File exists
Copy en files in the right folder …
cp: cannot stat `./en/*': No such file or directory
cp: cannot stat `./global/*': No such file or directory
Install A2Billing Audio files : es
—————————————————
creating relevant folders : /var/lib/asterisk/sounds/es
creating relevant folders : /var/lib/asterisk/sounds/es/digits
mkdir: cannot create directory `/var/lib/asterisk/sounds/es': File exists
mkdir: cannot create directory `/var/lib/asterisk/sounds/es/digits': File exists
Copy es files in the right folder …
cp: cannot stat `./es/*': No such file or directory
cp: cannot stat `./global/*': No such file or directory
Install A2Billing Audio files : fr
—————————————————
creating relevant folders : /var/lib/asterisk/sounds/fr
creating relevant folders : /var/lib/asterisk/sounds/fr/digits
mkdir: cannot create directory `/var/lib/asterisk/sounds/fr': File exists
mkdir: cannot create directory `/var/lib/asterisk/sounds/fr/digits': File exists
Copy fr files in the right folder …
cp: cannot stat `./fr/*': No such file or directory
cp: cannot stat `./global/*': No such file or directory
Install A2Billing Audio files : br
—————————————————
creating relevant folders : /var/lib/asterisk/sounds/br
creating relevant folders : /var/lib/asterisk/sounds/br/digits
Copy br files in the right folder …
cp: cannot stat `./br/*': No such file or directory
cp: cannot stat `./global/*': No such file or directory
Install A2Billing Audio files : ru
—————————————————
creating relevant folders : /var/lib/asterisk/sounds/ru
creating relevant folders : /var/lib/asterisk/sounds/ru/digits
Copy ru files in the right folder …
cp: cannot stat `./ru/*': No such file or directory
Copy ru digits files in the right folder …
cp: cannot stat `./ru/digits/*': No such file or directory
[root@elastix a2billing]#
Step 10 : Edit /etc/asterisk/manager.conf and add the necesary user as follow:
[myasterisk]

secret=mycode

read=system,call,log,verbose,command,agent,user

write=system,call,log,verbose,command,agent,user
Step 11: Copy the entire content of the AGI directory into asterisk agi-bin directory.

#cd /usr/local/src/a2billing/AGI

#cp a2billing.php /var/lib/asterisk/agi-bin/

#cp -Rf /usr/local/src/a2billing/common/lib /var/lib/asterisk/agi-bin/


#chown asterisk:asterisk /var/lib/asterisk/agi-bin/a2billing.php

#chown -Rf asterisk:asterisk /var/lib/asterisk/agi-bin/lib

#chmod +x /var/lib/asterisk/agi-bin/a2billing.php
Step 12: Installing the GUI interface
#mv /var/www/html/a2billing /var/www/html/a2billing-old

#mkdir /var/www/html/a2billing

#chown asterisk:asterisk /var/www/html/a2billing


# cp -rf /usr/local/src/a2billing/admin /var/www/html/a2billing/

# cp -rf /usr/local/src/a2billing/agent /var/www/html/a2billing/

# cp -rf /usr/local/src/a2billing/customer /var/www/html/a2billing/

# cp -rf /usr/local/src/a2billing/common /var/www/html/a2billing/


#chmod 755 /var/www/html/a2billing/admin/templates_c

#chmod 755 /var/www/html/a2billing/customer/templates_c


#chmod 755 /var/www/html/a2billing/agent/templates_c

#chown -Rf asterisk:asterisk /var/www/html/a2billing/admin/templates_c

#chown -Rf asterisk:asterisk /var/www/html/a2billing/customer/templates_c

#chown -Rf asterisk:asterisk /var/www/html/a2billing/agent/templates_c


Step 12: Add the file /etc/httpd/conf.d/a2billing.conf with the follow lines:

Alias /a2billing /var/www/html/a2billing


[root@elastix AGI]# more /etc/httpd/conf.d/a2billing.conf
Alias /a2billing /var/www/html/a2billing

Restart the apache service:

#service httpd restart


[root@elastix html]#
[root@elastix html]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@elastix html]#
Now, to enter to new a2billing you must access it throught the follow URL:
Elastix-IP-Address/a2billing
the default user and password are:
user: root

pass: changepassword
Step 13 : Add the file /etc/asterisk/extensions_a2billing.conf with the follow lines:
[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)


Add the follow line to /etc/asterisk/extensions.conf at the top of the file:
#include extensions_a2billing.conf
Step 14: Create a file with the jobs in /var/spool/cron/a2billing with the follow lines:
# 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
# To check all the accounts and send an notification email if the

balance is less than the first argument.

0 */6 * * php /usr/local/src/a2billing/Cronjobs/a2billing_check_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
# To generate invoices and for each user.

0 6 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_invoice_cront.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

Vous aimerez peut-être aussi