說明
A2Billing 預設安裝時是不支援 Voicemail 功能的,本篇將提供在 A2B 新增 Voicemail 功能的教學。
功能目的:當 A2B 使用了 DID 電話轉接服務時,如果電話不通或無人接聽時,Caller 可以自動進入語音信箱作錄音留言。
系統設置
系統環境:
方法一:使用 voicemail.conf
需要修改以下檔案:
- /etc/asterisk/voicemail.conf
- /var/www/html/common/lib/common.defines.php
- /var/www/html/A2Billing_UI/Public/form_data/FG_var_card.inc
- /var/lib/asterisk/agi-bin/lib/Class.A2Billing.php
voicemail.conf:
[general]
...
...
sendvoicemail=yes ; Allow the user to compose and send a voicemail while inside
; VoiceMailMain() [option 5 from mailbox's advanced menu].
; If set to 'no', option 5 will not be listed.
searchcontexts=yes ; Current default behavior is to search only the default context
; if one is not specified. The older behavior was to search all contexts.
...
[default]
...
...
[a2b]
7008374947 => 7008374947,A Lang,your@email.com
common.defines.php:
...
// VOICEMAIL
define ("ACT_VOICEMAIL", true);
...
FG_var_card.inc:
註:A2B-1.9.4 已經內建有這些程式碼
reference to undefined name 'syntax' Exception of type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was thrown. (click for details)Callstack:
at User:alang/Private_Zone/A2Billing_專區/Voicemail_設置
MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException: reference to undefined name 'syntax' Exception of type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was thrown.
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptVar expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Expr.DekiScriptVar.VisitWith[DekiScriptExpressionEvaluationState,Range] (IDekiScriptExpressionVisitor`2 visitor, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Evaluate (MindTouch.Deki.Script.Expr.DekiScriptAccess expr, DekiScriptExpressionEvaluationState state, Boolean evaluateProperties) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptAccess expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Expr.DekiScriptAccess.VisitWith[DekiScriptExpressionEvaluationState,Range] (IDekiScriptExpressionVisitor`2 visitor, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptCall expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Expr.DekiScriptCall.VisitWith[DekiScriptExpressionEvaluationState,Range] (IDekiScriptExpressionVisitor`2 visitor, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptSequence expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Expr.DekiScriptSequence.VisitWith[DekiScriptExpressionEvaluationState,Range] (IDekiScriptExpressionVisitor`2 visitor, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit (MindTouch.Deki.Script.Expr.DekiScriptReturnScope expr, DekiScriptExpressionEvaluationState state) [0x00000] in <filename unknown>:0
TIPs:
修改了 common.defines.php & FG_var_card.inc 以後,在管理介面 > Customer 會多二個項目,PERMITTED VOICEMAIL, ACTIVE VOICEMAIL SERVICE,必須設定為 YES。
Class.A2Billing.php:
...
...
// Enable voicemail for this card. For DID and SIP/IAX call
var $voicemail = 1;
TIP:
預設此行是被註解的。
...
function call_did ($agi, &$RateEngine, $listdestination)
{
$res=0;
if ($this -> CC_TESTING) $this->destination = "kphone";
$this->agiconfig['say_balance_after_auth'] = 0;
$this->agiconfig['say_timetocall'] = 0;
...
...
if ($this->voicemail) {
if (($dialstatus =="CHANUNAVAIL") || ($dialstatus == "CONGESTION") || ($dialstatus == "NOANSWER") || ($dialstatus =="BUSY")) {
// The following section will send the caller to VoiceMail with the unavailable priority.\
$dest_username = $this->username;
$this -> debug( INFO, $agi, __FILE__, __LINE__, "[STATUS] CHANNEL ($dialstatus) - GOTO VOICEMAIL ($dest_username)");
$vm_parameters = $this -> format_parameters ($dest_username.'@a2b,s');
$agi-> exec(VoiceMail, $vm_parameters);
}
}
...
...
TIPs:
- 如果是 DID 轉接後的語音留言,必須修改 function call_did;如果是 sip friend 則要修改 function call_sip_iax_buddy。
- 啟動 voicemail 的指令格式是 exec(Voicemail, XXXXXX@a2b,s)
XXXXXX 帳戶號碼,a2b 必須對應 voicemail.conf 的 context 名稱,功能參數 ,s 可換成 ,u,如果是 asterisk 1.4 必須改成 |s。