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 = 選擇客戶的卡號
註:以上是由管理員來操作,客戶也可以在網頁上自己新增。
Tips:
如果系統查無用戶的 CID 號碼,當用戶撥到 A2B 的 Access Number ,系統不會作回撥。
由於 Callback 在預設環境僅適用 Asterisk 1.4.x,如果是 Asterisk 1.6.x 以後版本,必須修改:
A2B Admin > SYSTEM SETTINGS > Global List > Select Group: global
asterisk_version = 1_6 (注意:不是 agi-confX 的參數)
Tips:
在修改後,在 callback 參數的間隔,會從原來的 |(pipe) 變成 ,(comma)。
不需要任何的 dialplan。
編輯 /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,請配合系統路由自行變更。
編輯 /etc/asterisk/extensions_a2billing_1_6.conf
[mya2b-cid-prompt-callback] exten => s,1,DeadAgi(a2billing.php,1,cid-prompt-callback,99) ;last parameter is the callback area code exten => h,1,Hangup
編輯 /etc/asterisk/extensions_a2billing_1_6.conf
[mya2b-all-callback] ; the next 4 lines are to strip the leading 0 ;exten => s,1,GotoIf($["${CALLERID(num):0:1}" != "0"]?nozeroatstart) ;exten => s,n,NoOp(Changing Caller ID number from ${CALLERID(num)} to ${CALLERID(num):1}) ;exten => s,n,Set(CALLERID(num)=${CALLERID(num):1}) ;exten => s,n(nozeroatstart),NoOp(Start A2Billing) exten => s,1,DeadAgi(a2billing.php,1,all-callback,99) ;last parameter is the callback area code exten => h,1,Hangup
以 CID-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 有幾項注意事項:
Ans: 重啟 Asterisk 服務後,別忘了要再重啟 a2b-callback-daemon。
Ans: A2B Admin > SYSTEM SETTINGS > Global List > Select Group: agi-confX
say_timetocall = No
Ans: A2B Admin > SYSTEM SETTINGS > Global List > Select Group: agi-confX
logging_level = 3 (預設是 0)
"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 相符。