Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
(http://www.asterisk2billing.org/)
CentOS (http://centos.org/) v7
Asterisk (http://www.asterisk.org/) v11 (v13 parece funcionar. La función
de devolución de llamada puede requerir un parche)
FreePBX (http://freepbx.org) v13
A2billing (http://asterisk2billing.org) v2.2
Suposiciones
https://www.powerpbx.org/content/a2billing-install-guide-v2-2 1/16
13/7/2019 A2Billing v2.2 Guía de instalación | Asterisco FreeSwitch guías
Otro
https://www.powerpbx.org/content/a2billing-install-guide-v2-2 2/16
13/7/2019 A2Billing v2.2 Guía de instalación | Asterisco FreeSwitch guías
cd / usr / src
git clone -b 'v2.2.0' --single-branch
https://github.com/Star2Billing/a2billing.git
cd /usr/src/a2billing/DataBase/mysql-5.x
./install-db.sh
Now check that the database and 90+ tables have been created
https://www.powerpbx.org/content/a2billing-install-guide-v2-2 3/16
13/7/2019 A2Billing v2.2 Guía de instalación | Asterisco FreeSwitch guías
Should produce
+-------------------------+
| Tables_in_mya2billing
| +-----------------------+
| cc_agent |
| cc_agent_commission |
| cc_agent_signup |
. . . |
| cc_ui_authen |
| cc_version |
| cc_voucher |
+-------------------------+
97 rows in set (0.00 sec)
> \q
cp /usr/src/a2billing/a2billing.conf /etc/
nano /etc/a2billing.conf
[database]
hostname = localhost
port = 3306
user = a2billinguser
password = a2billing
dbname = mya2billing
dbtype = mysql
Only required if not using Asterisk realtime. We are including this
section for legacy purposes.
Some of these files assume you have FreePBX installed and not just
Asterisk. If you just have Asterisk installed then use the files
specified in the INSTALL.rst instructions included with A2billing source
files.
touch /etc/asterisk/additional_a2billing_iax.conf
touch /etc/asterisk/additional_a2billing_sip.conf
echo \#include additional_a2billing_sip.conf >>
/etc/asterisk/sip_custom.conf
echo \#include additional_a2billing_iax.conf >>
/etc/asterisk/iax_custom.conf
chown -Rf asterisk. /etc/asterisk/additional_a2billing_iax.conf
chown -Rf asterisk. /etc/asterisk/additional_a2billing_sip.conf
chmod -R 640 /etc/asterisk
cd /usr/src/a2billing/addons/sounds
./install_a2b_sounds.sh
chown -R asterisk:asterisk /var/lib/asterisk/sounds/
You can also do it via the Freepbx Asterisk API module. If you don't
have Freepbx installed then you should follow the INSTALL.rst
instructions included with the a2billing source files.
[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
nano /etc/asterisk/freepbx_chown.conf
[blacklist]
directory=/var/www/html/a2billing/
mkdir /var/www/html/a2billing
https://www.powerpbx.org/content/a2billing-install-guide-v2-2 5/16
13/7/2019 A2Billing v2.2 Guía de instalación | Asterisco FreeSwitch guías
user: root
password: changepassword
Once logged in click change password link at bottom left and change it.
Set up AGI
mkdir /var/lib/asterisk/agi-bin
cd /usr/src/a2billing/AGI
cp a2billing.php /var/lib/asterisk/agi-bin
cp a2billing_monitoring.php /var/lib/asterisk/agi-bin
chown -R asterisk. /var/lib/asterisk/agi-bin
chmod 755 /var/lib/asterisk/agi-bin/a2billing.php
chmod 755 /var/lib/asterisk/agi-bin/a2billing_monitoring.php
ln -s /var/www/html/a2billing/common/lib /var/lib/asterisk/agi-
bin/lib
ln -s /var/www/html/a2billing/vendor /var/lib/asterisk/vendor
nano /etc/asterisk/extensions_custom.conf
[a2billing-did]
exten => _X.,1,AGI(a2billing.php,1,did)
exten => _X.,n,Hangup()
[a2billing-out]
exten => _X.,1,AGI(a2billing.php,1)
exten => _X.,n,Hangup()
https://www.powerpbx.org/content/a2billing-install-guide-v2-2 6/16
13/7/2019 A2Billing v2.2 Guía de instalación | Asterisco FreeSwitch guías
Target: a2billing-did,${EXTEN},1
Description: A2Billing - Inbound
Target: a2billing-out,${EXTEN},1
Description: A2Billing - Outbound
DID number: _.
fwconsole restart
Cron
mkdir -p /usr/local/a2billing
cp -R /usr/src/a2billing/Cronjobs /usr/local/a2billing/
ln -sf /var/www/html/a2billing/common/lib
/usr/local/a2billing/Cronjobs/lib
chown -R asterisk. /usr/local/a2billing
crontab -e -u asterisk
https://www.powerpbx.org/content/a2billing-install-guide-v2-2 7/16
13/7/2019 A2Billing v2.2 Guía de instalación | Asterisco FreeSwitch guías
# Check the account of each user and send an email if the balance is
below mimimum.
0 * * * * php
/usr/local/a2billing/Cronjobs/a2billing_notify_account.php
# Browse all the DID's that are reserved and check if the customer
need to pay.
# Bill them or warn them via email that they need to pay in order to
keep their DIDs.
0 2 * * * php /usr/local/a2billing/Cronjobs/a2billing_bill_diduse.php
# Manage alarms
0 * * * * php /usr/local/a2billing/Cronjobs/a2billing_alarm.php
# Manage archive
0 12 * * * php
/usr/local/a2billing/Cronjobs/a2billing_archive_data_cront.php
#Autorefill
0 10 21 * * php
/usr/local/a2billing/Cronjobs/a2billing_autorefill.php
15 * * * * php
/usr/local/a2billing/Cronjobs/a2billing_batch_cache.php
mkdir -p /var/log/a2billing
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_archive_data.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
https://www.powerpbx.org/content/a2billing-install-guide-v2-2 8/16
13/7/2019 A2Billing v2.2 Guía de instalación | Asterisco FreeSwitch guías
touch /var/log/a2billing/a2billing_api_ecommerce_request.log
touch /var/log/a2billing/a2billing_api_callback_request.log
touch /var/log/a2billing/a2billing_api_card.log
touch /var/log/a2billing/a2billing_agi.log
touch /var/www/html/a2billing/index.html
http://{my-ip-address}/a2billing/admin
user: root
pass: mynewpassword
Or use default password changepassword if you have not changed it yet
and then click the change password link at the bottom left.
Go into System settings>Global list. Go to the bottom left and set to
display all. From your web browser search for "asterisk_version". It
will find that setting twice. One for Global group and one for agi-conf1
group. Change both accordingly. If using Asterisk v11 or v13 then use
"1_11"
Asterisk Realtime
If using Asterisk Realtime you do not need to reload every time you
add/remove/change a customer. It also allows you to share the
A2billing database between multiple Asterisk/Freepbx servers. If you
need to create many customers it makes more sense to use a database
rather than a flat text file.
cd /usr/lib64/asterisk/modules
dir
https://www.powerpbx.org/content/a2billing-install-guide-v2-2 9/16
13/7/2019 A2Billing v2.2 Guía de instalación | Asterisco FreeSwitch guías
There should be a file there called res_config_mysql.so . If not you need
to re-compile Asterisk and set it to compile the res_config_mysql.so
realtime module in menuselect.
nano /etc/asterisk/extconfig.conf
[settings]
iaxusers => mysql,general,cc_iax_buddies
iaxpeers => mysql,general,cc_iax_buddies
sipusers => mysql,general,cc_sip_buddies
sippeers => mysql,general,cc_sip_buddies
nano /etc/asterisk/res_config_mysql.conf
[general]
dbhost = 127.0.0.1
dbname = mya2billing
dbuser = a2billinguser
dbpass = a2billing
dbport = 3306
;dbsock = /var/lib/mysql/mysql.sock
fwconsole restart
# asterisk -vvvr
Should produce:
debe producir:
25 Comments PowerPBX
1 Login
LOG IN WITH
OR SIGN UP WITH DISQUS ?
Name
https://www.powerpbx.org/content/a2billing-install-guide-v2-2 11/16
13/7/2019 A2Billing v2.2 Guía de instalación | Asterisco FreeSwitch guías
Rest of the steps pretty much same. Was able to pass calls and Realtime
worked fine too.
Just a note: you can add the other a2billing contexts, including [a2billing] as
these are needed for default settings.
△ ▽ • Reply • Share ›
@@Nguyễn Tuấn Cường : I got the error below also, but once i rebooted the
server, I was able to login to FREEPBX just fine.
△ ▽ • Reply • Share ›
https://www.powerpbx.org/content/a2billing-install-guide-v2-2 12/16
13/7/2019 A2Billing v2.2 Guía de instalación | Asterisco FreeSwitch guías
△ ▽ • Reply • Share ›
△ ▽ • Reply • Share ›
see more
△ ▽ • Reply • Share ›
Finally got everything installed. Unfortunately the moment when I log into
a2billing I get the following error:
Thank you for using A2Billing. However, we have detected that you
have edited the Author’s names, Copyright or licensing information in
the A2Billing Management Interface.
The AGPL 3
license under which you are allowed to use A2Billing requires that the
original copyright and license must be displayed and kept intact.
Without this information being displayed, you do not have a right to use
the software.
△ ▽ • Reply • Share ›
If you are using freepbx this is most likely because of a change they
recently made to freepbx_chown.conf syntax. That results in the
a2billing symlinks being deleted if using the old syntax. We have
updated the procedure with the new syntax for freepbx_chown.conf.
You need to update that and recreate the symlinks or redo the
procedure.
△ ▽ • Reply • Share ›
Very nice guide, but I am hitting a snagg. When I create incoming route with _.
am keeps on getting the following:
PDOException
(23000)
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mohclass'
cannot be null
Thanks
△ ▽ • Reply • Share ›
http://wiki.freepbx.org/dis...
⛺
△ ▽ • Reply • Share ›
BaronTEL
△ ▽ • Reply • Share ›
https://www.powerpbx.org/content/a2billing-install-guide-v2-2 16/16