Está en la página 1de 5

http://www.inkalinux.com/foros/showthread.php?

182-Configurar-a2billing-en10-minu
tos-Manual-a2billing-Tarificacion-Asterisk-A2Billing
[root@ldap html]# getenforce
Enforcing
[root@ldap html]# setenforce 0
http://www.youtube.com/watch?v=osAjZVS6JsY
anos a la obra:
Descargue el codigo fuente:
antes creamos una carpeta a2billing dentro de /usr/local/src
Cdigo PHP:
secretaria@notariavidalhermoza.com
mkdir /usr/local/src/a2billing
Ingresamos a la carpeta
Cdigo PHP:
cd /usr/local/src/a2billing
Luego descargamos
Cdigo PHP:
wget http://www.mikrotik.com.pe/a2billing-master.zip
Descomprimimos:
Cdigo PHP:
unzip a2billing-master.zip
Ahora preparamos la tierra en este caso preparamos la base de datos:
Ingresamos a :
Cdigo PHP:
cd /usr/local/src/a2billing
Cdigo PHP:
mysql -u root -p < DataBase/mysql-5.x/a2billing-createdb-user.sql
El script nos pedida y nosotros le daremos el nombre de la base de datos como el
usuario que admnistrara
Database name is: mya2billing
Database user is: a2billinguser
User password is: a2billing
Despues de crear la extructura creamos las tablas:
Cdigo PHP:
cd DataBase/mysql-5.x/
Cdigo PHP:
./install-db.sh
Podemos verificar que la creacion de las tablas este correcta:
Cdigo PHP:
mysql -u root -p mya2billing
Cdigo PHP:
mysql>show tables
Cdigo PHP:
mysql>exit
Ahora configuramos a2billing.conf
Creamos un acceso directo del a2billing.conf
Cdigo PHP:
ln -s /usr/local/src/a2billing/a2billing.conf /etc/a2billing.conf
luego editamos el archivo con vi /etc/a2billing.conf:
Cdigo PHP:
[database]
hostname = localhost
port = 3306
user = a2billinguser
password = a2billing
dbname = mya2billing
dbtype = mysql
Le damos permisos a las carpetas correspondientes:
Cdigo PHP:
chmod 777 /etc/asterisk
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
Archivos de sonido:
Cdigo PHP:
/usr/local/src/a2billing/addons/install_a2b_sounds_deb.sh
chown -R asterisk:asterisk /usr/share/asterisk/sounds/
Configurar el Asterisk Manager
Cdigo PHP:
vi /etc/asterisk/manager.conf
Cdigo PHP:
[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
Instalando el AGI
Copiar o crear un enlace simblico de todo el contenido del directorio de AGI en a
sterisk directorio agi-bin.
Cdigo PHP:
mkdir /usr/share/asterisk/agi-bin
chown asterisk:asterisk /usr/share/asterisk/agi-bin
Cdigo PHP:
ln -s /usr/local/src/a2billing/AGI/a2billing.php /usr/share/asterisk/agi-bin/a2b
illing.php
ln -s /usr/local/src/a2billing/AGI/lib /usr/share/asterisk/agi-bin/lib
Cdigo PHP:
chmod +x /usr/share/asterisk/agi-bin/a2billing.php
chmod +x /usr/share/asterisk/agi-bin/a2billing_monitoring.php
Ahora configuramos la interface grafica:
Cdigo PHP:
mkdir /var/www/a2billing
chown www-data:www-data /var/www/a2billing
mkdir -p /var/lib/a2billing/script
mkdir -p /var/run/a2billing
Cdigo PHP:
ln -s /usr/local/src/a2billing/admin /var/www/a2billing/admin
ln -s /usr/local/src/a2billing/agent /var/www/a2billing/agent
ln -s /usr/local/src/a2billing/customer /var/www/a2billing/customer
ln -s /usr/local/src/a2billing/common /var/www/a2billing/common
Cdigo:
chmod 755 /usr/local/src/a2billing/admin/templates_c
chmod 755 /usr/local/src/a2billing/customer/templates_c
chmod 755 /usr/local/src/a2billing/agent/templates_c
chown -Rf www-data:www-data /usr/local/src/a2billing/admin/templates_c
chown -Rf www-data:www-data /usr/local/src/a2billing/customer/templates_c
chown -Rf www-data:www-data /usr/local/src/a2billing/agent/templates_c
Una vez configurado podemos ya ingresar a ver desde la web
Cdigo PHP:
http://192.168.1.x/a2billing/admin
user: root
pass: changepassword
Creando el dial plan de asterisk - a2billing
editamos vi /etc/asterisk/extensions.conf
Cdigo:
[a2billing]
include => a2billing_callingcard
include => a2billing_monitoring
include => a2billing_voucher
[a2billing_callingcard]
; CallingCard application
exten => _X.,1,NoOp(A2Billing Start)
exten => _X.,n,AGI(a2billing.php,1)
exten => _X.,n,Hangup
[a2billing_voucher]
exten => _X.,1,Answer(1)
exten => _X.,n,AGI(a2billing.php,1,voucher)
;exten => _X.,n,AGI(a2billing.php,1,voucher,44) ; agregar 44 en frente de la iden
tificador de llamadas para la autenticacin de CID
exten => _X.,n,Hangup
[a2billing_did]
exten => _X.,1,AGI(a2billing.php,1,did)
exten => _X.,2,Hangup
Configurar servicios recurrentes
agregar las siguientes lineas en el crontab /etc/crontab
Cdigo:
#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 th
e 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.p
hp
#manage alarms
0 * * * * php /usr/local/src/a2billing/Cronjobs/a2billing_alarm.php
Call back daemon (only for Call backs)
The call back daemon is responsible of reading from the database the pool of cal
ls stored for call back and trigger those calls periodically.
The daemon is written in Python. Install the python-setuptools and use easy_inst
all to install the callback_daemon
Cdigo:
apt-get install python-setuptools python-mysqldb python-psycopg2 python-sqlalche
m
cd /usr/local/src/a2billing/CallBack
easy_install callback-daemon-py/dist/callback_daemon-1.0.prod_r1527-py2.5.egg
Install the init.d startup script
Cdigo:
cd /usr/local/src/a2billing/CallBack/callback-daemon-py/callback_daemon/
For Debian :
Cdigo:
cp a2b-callback-daemon.debian /etc/init.d/a2b-callback-daemon
For RedHat :
Cdigo:
cp a2b-callback-daemon.rc /etc/init.d/a2b-callback-daemon
chmod +x /etc/init.d/a2b-callback-daemon
Make sure the daemon starts
For Debian :
Cdigo:
update-rc.d a2b-callback-daemon defaults 40 60
If you need to remove the daemon in the future run
Cdigo:
update-rc.d -f a2b-callback-daemon remove
For RedHat :
Cdigo:
chkconfig --add a2b-callback-daemon
service a2b-callback-daemon start
chkconfig a2b-callback-daemon on
Enable Monitoring
General system monitoring via IVR is available from version 1.7, the new AGI
a2billing_monitoring.php provides access to an IVR where monitoring tasks can be
configured via the new Monitoring Menu under Maintenance.
SQL queries can be performed and shell scripts can be invoked.
Place your scripts under /var/lib/a2billing/script/
Security features via IVR (Monitor account and locking calling card)
Two new IVR menus are now available via the main a2billing.php AGI. The menus
needs to be enabled setting the variables in the agi-conf menu (GUI system setti
ngs)
Locking Options IVR menu
Cdigo:
ivr_enable_locking_option = true (default: false)
Monitoring your Calling Card IVR menu
Cdigo:
ivr_enable_account_information = true (default: false)
Implementacion de servidores para cedi
Capacitacion en openvpn para conexion con cedis
herramientas de monitoreo de cedis smokeping
herramienta de monitoreo de ancho de banda Cacti
servidor ldap para los contactos de telefono