Exemple #1
0
 $provider = $trunk_details['provider'];
 $trunk_name = htmlentities($trunk_details['name']);
 $dialopts = $trunk_details['dialopts'] === false ? false : htmlentities($trunk_details['dialopts']);
 if ($tech != "enum") {
     $channelid = htmlentities($trunk_details['channelid']);
     if ($tech != "custom" && $tech != "dundi") {
         // custom trunks will not have user/peer details in database table
         // load from db
         if (empty($peerdetails)) {
             $peerdetails = core_trunks_getTrunkPeerDetails($trunknum);
         }
         if (empty($usercontext)) {
             $usercontext = htmlentities($trunk_details['usercontext']);
         }
         if (empty($userconfig)) {
             $userconfig = core_trunks_getTrunkUserConfig($trunknum);
         }
         if (empty($register)) {
             $register = core_trunks_getTrunkRegister($trunknum);
         }
     }
 }
 if (count($dialpattern_array) == 0) {
     $dialpattern_array = core_trunks_get_dialrules($trunknum);
 }
 $upper_tech = strtoupper($tech);
 if (trim($trunk_name) == '') {
     $trunk_name = $upper_tech == 'ZAP' | $upper_tech == 'DAHDI' ? sprintf(_('%s Channel %s'), $upper_tech, $channelid) : $channelid;
 }
 // find which routes use this trunk
 $routes = core_trunks_gettrunkroutes($trunknum);
Exemple #2
0
/**
* @pram string; can be a trunk id, all or *, or registered/reg for just trunks that are registered
* @pram boolean; true disables trunk, false is enables trunk
*/
function core_trunks_disable($trunk, $switch)
{
    switch ($trunk) {
        case 'all':
        case '*':
            $trunks = core_trunks_getDetails();
            break;
        case 'reg':
        case 'registered':
            foreach (core_trunks_getDetails() as $t) {
                if ($reg = core_trunks_getTrunkRegister($t['trunkid'])) {
                    $trunks[] = $t;
                }
            }
            break;
        case '':
            return false;
            //cannot call without a trunk
            break;
        default:
            $trunks[] = core_trunks_getDetails($trunk);
            break;
    }
    //return if no trunks!
    if (empty($trunks)) {
        return false;
    }
    foreach ($trunks as $t) {
        $trunk = core_trunks_getDetails($t['trunkid']);
        $regstring = core_trunks_getTrunkRegister($t['trunkid']);
        $userconfig = core_trunks_getTrunkUserConfig($t['trunkid']);
        $peerdetails = core_trunks_getTrunkPeerDetails($t['trunkid']);
        $disabled = $switch ? 'on' : 'off';
        core_trunks_edit($trunk['trunkid'], $trunk['channelid'], $trunk['dialoutprefix'], $trunk['maxchans'], $trunk['outcid'], $peerdetails, $trunk['usercontext'], $userconfig, $regstring, $trunk['keepcid'], $trunk['failscript'], $disabled, $trunk['name'], $trunk['provider'], $trunk['continue']);
    }
}