A2Billing 的回撥功能依據使用方法不同,大致區分為:
回撥電話的流程說明:
對於要使用 Callback 的 A2B, 必須完成以下設置:
Python 套件
yum install python-setuptools MySQL-python
Python 模組 - sqlalchemy
easy_install sqlalchemy
開始設定
cd /usr/src/a2billing cd CallBack/callback-daemon-py cp build/lib/callback_daemon/a2b-callback-daemon.rc /etc/init.d/a2b-callback-daemon chmod +x /etc/init.d/a2b-callback-daemon 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 chkconfig --add a2b-callback-daemon service a2b-callback-daemon start chkconfig a2b-callback-daemon on
如何檢查服務
A2B Admin > CALLBACK > Server Group
Name = default
Description = default group of server
A2B Admin > CALLBACK > Server
Group = default
Server Hostname = localhost
Manager Host = localhost
Manager Username = myasterisk
Manager Password = mycode
以上資訊必須與 manager.conf 相符。
當用戶要啟用回撥功能時,必須將自己的電話號碼(CID)事先設定在系統,而且必須使用這號碼撥到 A2B 的 Access Number。
A2B Admin > CUSTOMERS > Caller-ID > Add CallerID
CallerID = 輸入用戶的來電號碼
Activated = Yes
ID Card = 選擇客戶的卡號
以上是由管理員來操作,客戶也可以在網頁上自己新增。
編輯 /etc/asterisk/extensions_a2billing_1_6.conf
[mya2b-cid-callback] exten => s,1,DeadAgi(a2billing.php,1,cid-callback,99) ;last parameter is the callback area code exten => h,1,Hangup
Notes:
99 是系統在回撥時,自動加上的 prefix code,請配合系統路由自行變更。
預設的 web callback 會有個問題:即使網頁輸入了目的地號碼,系統並不會進行撥號,而是提醒要輸入目的地號碼,為了解決這個,必須新增一個 dialplan 並且修改 A2B 的系統參數。
編輯 /etc/asterisk/extensions_a2billing_1_6.conf
[a2billing-callback-2] exten => _X.,1,DeadAgi(a2billing.php,2) exten => h,1,Hangup
註:這裡用了 agi-conf2。
修改 A2B 參數
A2B Admin > SYSTEM SETTINGS > Global List > Select Group: agi-conf2 (如果沒有 agi-conf2,請自行增加)
use_dnid = Yes (如果有目的地號碼,則關閉輸入目的地號碼的語音)
..... (其他選項可自行決定)
A2B Admin > SYSTEM SETTINGS > Global List > Select Group: callback
context_callback = a2billing-callback-2
Tips:
雖然修改 context_callback,同時也被 DID Callback 的操作所套用,不過並不會造成衝突,
freePBX > Tools > Custom Destinations
Custom Destination = mya2b-cid-callback,s,1
Description = mya2b_cid_callback
freePBX > Setup > Inbound Routes > Add Incoming Route
DID Number = <A2B 的 Access Number>
Set Destination = Custom Destination: mya2b_cid_callback
關於 callback 的 outbound 有幾項注意事項:
"2011-06-24 13:56:42,538 - root - MainThread - INFO - [<callback_daemon.database.CallBack_Spool obje
ct at 0xb5aadd4c>]"
"2011-06-24 13:56:42,551 - root - MainThread - INFO - try_originate : SIP/sip2sip-0/800677522 : 1000
: a2billing-callback"
"2011-06-24 13:56:42,552 - root - MainThread - INFO - CallBack Status : Error"
"2011-06-24 13:56:42,557 - root - MainThread - INFO - [2011/06/24 13:56:42] Placed 17 calls"
"2011-06-24 13:56:47,703 - root - MainThread - INFO - waiting..."
Ans: 有兩項需要檢查
[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,agent,user,config,dtmf,reporting,cdr,dialplan write = system,call,agent,user,config,command,reporting,originate
[2011-06-24 14:13:50] VERBOSE[6569] manager.c: == Manager 'myasterisk' logged off from 127.0.0.1
[2011-06-24 14:13:50] NOTICE[6701] manager.c: 127.0.0.1 failed to authenticate as 'myasterisk'
[2011-06-24 14:13:51] VERBOSE[6701] manager.c: == Connect attempt from '127.0.0.1' unable to authenticate
Ans: 檢查 A2B > CALLBACK > Server > 這裡的資訊必須與 /etc/asterisk/manager.conf 相符。