Voicemail 設置

    版本為 07:31, 13 Jan 2025

    到這個版本。

    返回到 版本存檔.

    查閱目前版本

    說明

    A2Billing 預設安裝時是不支援 Voicemail 功能的,本篇將提供在 A2B 新增 Voicemail 功能的教學。

    功能目的:當 A2B 使用了 DID 電話轉接服務時,如果電話不通或無人接聽時,Caller 可以自動進入語音信箱作錄音留言。

    系統設置

    系統環境:

    • Linux
    • PIAF
    • A2Billing
    方法一:使用 voicemail.conf

    需要修改以下檔案:

    1. /etc/asterisk/voicemail.conf
    2. /var/www/html/common/lib/common.defines.php
    3. /var/www/html/A2Billing_UI/Public/form_data/FG_var_card.inc
    4. /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)

    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 VOIP CALL
            if ($inst_listdestination[5]==1) {
            ...
            ...
             // ELSEIF NOT VOIP CALL
             } else {
             ...
                        // PERFORM THE CALL
                                                    $result_callperf = $RateEngine->rate_engine_performcall ($agi, $this -> destination, $this);
                                                    // alang: add this line
                                                    $dialstatus = $RateEngine->dialstatus;
                                                    if (!$result_callperf) {
                                                            $prompt="prepaid-callfollowme";
                                                            $agi-> stream_file($prompt, '#');
                                                            continue;
                                                    }
    
                                                    // alang: comment out this line
                                                    //$dialstatus = $RateEngine->dialstatus;
                                                    if (($RateEngine->dialstatus == "NOANSWER") || ($RateEngine->dialstatus == "BUSY") ||
                                                            ($RateEngine->dialstatus == "CHANUNAVAIL") || ($RateEngine->dialstatus == "CONGESTION")) continue;
                                                            ...
                                                            ...
    
    ...
    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)");
    
                                    // alang: modify this line, a2b is the context of voicemail.conf
                                    $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。

    Powered by MindTouch Core