1. Yêu cầu hệ thống
• Elastix 2.3.0 (Asterisk 1.6)
• A2billing 1.7.1 source.
• Database: MySQL.
• Linux: CentOS 5.
• PHP 5.
• Web server (apache).
2. Hướng dẫn cài đặt
• Cài các gói phụ thuộc:
# yum -y install perl-DBD-Pg subversion php• Tải A2Billing
# mkdir /usr/local/src/a2billing• Chép và giải nén a2billing vào thư mục /usr/local/src/a2billing
# cd /usr/local/src/a2billing
# tar xvzf A2Billing_1.7.1.tar.gz• Bắt đầu cài đặt
# mysql -u root -p < DataBase/mysql-5.x/a2billing-createdb-user.sql # cd /usr/local/src/a2billing/DataBase/mysql-5.x # bash install-db.sh Install A2Billing DataBase Enter Database Name :mya2billing Enter Hostname :localhost Enter UserName :root Enter Password :passw0rd mysql --user=root --password=passw0rd --host=localhost mya2billing # ln -s /usr/local/src/a2billing/a2billing.conf /etc/ # vi /etc/a2billing.conf [database] hostname = localhost ; port for postgres is 5432 by default port = 3306 user = a2billinguser password = a2billing dbname = mya2billing ; dbtype setting can either be mysql or postgres dbtype = mysql # 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.confBây giờ ta có thể truy cập a2billing thông qua trình duyệt web () và login với quyền admin. User và Password mặc định là
# echo #include additional_a2billing_iax.conf >> /etc/asterisk/iax.conf
# chown -Rf asterisk /etc/asterisk/additional_a2billing_iax.conf
# chown -Rf asterisk /etc/asterisk/additional_a2billing_sip.conf
# cd /usr/local/src/a2billing/addons/sounds/
# bash /usr/local/src/a2billing/addons/sounds/install_a2b_sounds.sh
# vi /etc/asterisk/manager.conf
; Asterisk Call Management support
[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
[admin]
secret = amp111
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
#include manager_additional.conf
#include manager_custom.conf
# mkdir -p /usr/share/asterisk/agi-bin
# ln -s /usr/local/src/a2billing/AGI/a2billing.php /usr/share/asterisk/agibin/a2billing.php
# ln -s /usr/local/src/a2billing/AGI/lib /usr/share/asterisk/agi-bin/lib
# ln -s /usr/local/src/a2billing/AGI/a2billing.php /var/lib/asterisNew update
#ln-s/usr/local/src/a2billing/AGI/a2billing_monitoring.php
/var/lib/asterisk/agi-bin/
# ln -s /usr/local/src/a2billing/AGI /var/lib/asterisk/agi-bin/
# chown -R asterisk.asterisk /var/lib/asterisk/agi-bin/
# chown -R asterisk.asterisk /usr/local/src/a2billing
# chmod +x /usr/share/asterisk/agi-bin/a2billing.php
# mkdir /var/www/html/a2billing
# chown asterisk.asterisk /var/www/html/a2billing
# ln -s /usr/local/src/a2billing/admin /var/www/html/a2billing/admin
# ln -s /usr/local/src/a2billing/agent /var/www/html/a2billing/agent
# ln -s /usr/local/src/a2billing/customer /var/www/html/a2billing/customer
# ln -s /usr/local/src/a2billing/common /var/www/html/a2billing/common
# 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 asterisk.asterisk /usr/local/src/a2billing/admin/templates_c
# chown -Rf asterisk.asterisk /usr/local/src/a2billing/customer/templates_c
# chown -Rf asterisk.asterisk /usr/local/src/a2billing/agent/templates_c
User: root
Pass: changepassword
• Tiếp tục cài
# vi /etc/asterisk/extensions_custom.conf• Tạo các thư mục và file log cần thiết
and add the following contexts at the end
#include extensions_a2billing.conf
create a file extensions_a2billing.conf and put following in it
[a2billing]
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]
exten => _X.,1,DeadAGI(a2billing.php|1|did)
# vi /etc/crontab
and add following
06* * * php /usr/local/src/a2billing/Cronjobs/currencies_update_yahoo.php
061** php /usr/local/src/a2billing/Cronjobs/a2billing_subscription_fee.php
0** * * php /usr/local/src/a2billing/Cronjobs/a2billing_notify_account.php
0 2 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_bill_diduse.php
012* * * php /usr/local/src/a2billing/Cronjobs/a2billing_batch_process.php
0 6 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_batch_billing.php
*/5****php/usr/local/src/a2billing/Cronjobs/a2billing_batch_autodialer
0 * * * * php /usr/local/src/a2billing/Cronjobs/a2billing_alarm.php
# mkdir -p /var/lib/a2billing/script• Tạo Dialplan
# mkdir -p /var/run/a2billing
# 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/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
Thêm dialplan sau vào extensions_custom.conf (hoặc extensions.conf nếu không dùng FreePBX.
[a2billing]exten => _X.,1,Answerexten => _X.,n,Wait(1)exten => _X.,n,DeadAGI(a2billing.php)exten => _X.,n,Wait(1)exten => _X.,n,Hangup[did]exten => _X.,1,Answerexten => _X.,n,Wait(1)exten => _X.,n,DeadAGI(a2billing.php|1|did)exten => _X.,n,Wait(1)Bạn có thể truy cập A2billing qua tài khoản Admin với tài khoản mặc định sau :
User: root
Pass:changepassword
Hình 1: Đăng nhập vào A2B Admin |
Sau đó, bắt đầu cấu hình tổng quát hệ thống A2Billing theo mô hình sau :
Hình 6.3: Giao diện Admin của A2Billing Chuyên mục: Network, VoIP
0 nhận xét:
Đăng một bình luận