示例#1
0
    unlink($aed . '/vm_email.inc');
}
if (file_exists($aed . '/vm_general.inc')) {
    $contents = FreePBX::LoadConfig()->getConfig('vm_general.inc');
    $final = array();
    if (!empty($contents['HEADER']) && is_array($contents['HEADER'])) {
        foreach ($contents['HEADER'] as $key => $val) {
            $final["gen__" . $key] = $val;
            $gen_settings[$key] = "";
        }
    }
    if (!empty($final)) {
        if (!function_exists('voicemail_update_settings')) {
            include __DIR__ . '/functions.inc.php';
        }
        voicemail_update_settings("settings", "", "", $final);
    }
    unlink($aed . '/vm_general.inc');
}
$vmconf = \FreePBX::Voicemail()->getVoicemail(false);
if (!empty($vmconf)) {
    $dsettings = $settings = \FreePBX::Voicemail()->constructSettings("general");
    foreach ($dsettings as $data) {
        foreach ($data['settings'] as $key => $items) {
            if ($items['default'] !== '' && !isset($vmconf['general'][$key])) {
                $vmconf['general'][$key] = $items['default'];
            }
        }
    }
    \FreePBX::Voicemail()->saveVoicemail($vmconf);
}
 function __construct($myexten)
 {
     $this->exten = $myexten;
     $this->vmx = FreePBX::Voicemail()->Vmx;
 }
     $vmx_loops_opts[1] = sprintf(_("%s Retry"), 1);
     for ($i = 2; $i < 5; $i++) {
         $vmx_loops_opts[$i] = sprintf(_("%s Retries"), $i);
     }
     show_view(dirname(__FILE__) . '/views/dialplan.php', array('settings' => $settings, 'direct_dial_opts' => $direct_dial_opts, 'voicemail_gain_opts' => $voicemail_gain_opts, 'vmx_timeout_opts' => $vmx_timeout_opts, 'vmx_repeat_opts' => $vmx_repeat_opts, 'vmx_loops_opts' => $vmx_loops_opts));
     break;
 case "settings":
     if (!empty($extension)) {
         $level = "account";
         $id_prefix = "acct";
     } else {
         $level = "general";
         $id_prefix = "gen";
     }
     $level = !empty($extension) ? "account" : "general";
     $d = \FreePBX::Voicemail()->constructSettings($level);
     /* get settings */
     $settings = voicemail_get_settings($uservm, $action, $extension);
     /* Get Asterisk version. */
     $ast_info = engine_getinfo();
     $version = $ast_info["version"];
     show_view(dirname(__FILE__) . '/views/ssettings.php', array('d' => $d, 'action' => $action, 'extension' => $extension, 'version' => $version, 'settings' => $settings, 'tooltips' => $tooltips, 'display_settings' => $acct_settings, 'display_tips' => $tooltips["account"], 'id_prefix' => $id_prefix));
     break;
 case "bsettings":
     $output = '';
     /* get settings */
     $settings = voicemail_get_settings($uservm, $action, $extension);
     /* Get Asterisk version. */
     $ast_info = engine_getinfo();
     $version = $ast_info["version"];
     $text_size = 40;