說明
A2Billing 預設安裝時是不支援 Voicemail 功能的,本篇將提供在 A2B 新增 Voicemail 功能的教學。
功能目的:當 A2B 使用了 DID 電話轉接服務時,如果電話不通或無人接聽時,Caller 可以自動進入語音信箱作錄音留言。
系統設置
系統環境:
方法一:使用 voicemail.conf
特點:
- 容易設定且不容易影響原有的系統環境。
- 缺點是 voicemail.conf 必須手動更新,只要新增或刪除 customer 時就會需要作更新。
- 透過 Customer 的設定啟動/關閉 voicemail。
需要修改以下檔案:
- /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
TIPs:
your@email.com 當有留言時,系統會自動寄出通知。
檢查 voicemail 設定,可以使用指令 asterisk -rx "voicemail show users"。
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:
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:
- 如果是 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。
FAQ
Q: 出現下列錯誤訊息 No entry in voicemail config file for '7008374947'
[2012-05-15 15:37:41] VERBOSE[22332] res_agi.c: a2billing.php,2,did: file:Class.A2Billing.php - line:1424 - uniqueid:1337067450.40 - [STATUS] CHANNEL (CONGESTION) - GOTO VOICEMAIL (7008374947)
[2012-05-15 15:37:41] VERBOSE[22332] res_agi.c: -- AGI Script Executing Application: (VoiceMail) Options: (7008374947@a2b,s)
[2012-05-15 15:37:41] WARNING[22332] app_voicemail.c: No entry in voicemail config file for '7008374947'
Ans:檢查 voicemail.conf,是否有 searchcontexts=yes。註:目錄 /var/spool/asterisk/voicemail/a2b/XXXXXX 不需要手動建立,Asterisk 會自動產生。
Q: 出現錯誤訊息 No entry in voicemail config file for '7008374947,s'
Ans:檢查 Class.A2Billing.php,啟動 voicemail 的格式是否有包含 context
exec(Voicemail, XXXXXX@a2b,s)