Ejemplo n.º 1
0
function queues_get($account, $queues_conf_only = false)
{
    global $db, $astman, $amp_conf;
    if ($account == "") {
        return array();
    }
    $account = q($account);
    //get all the variables for the queue
    $sql = "SELECT keyword,data FROM queues_details WHERE id = {$account}";
    $results = $db->getAssoc($sql);
    if (empty($results)) {
        return array();
    }
    //okay, but there can be multiple member variables ... do another select for them
    $results['member'] = queues_get_static_members($account);
    //if 'queue-youarenext=queue-youarenext', then assume we want to announce position
    if (!$queues_conf_only) {
        if (isset($results['queue-youarenext']) && $results['queue-youarenext'] == 'queue-youarenext') {
            $results['announce-position'] = 'yes';
        } else {
            $results['announce-position'] = 'no';
        }
    }
    //if 'eventmemberstatusoff=Yes', then assume we want to 'eventmemberstatus=no'
    if (isset($results['eventmemberstatusoff'])) {
        if (strtolower($results['eventmemberstatusoff']) == 'yes') {
            $results['eventmemberstatus'] = 'no';
        } else {
            $results['eventmemberstatus'] = 'yes';
        }
    } elseif (!isset($results['eventmemberstatus'])) {
        $results['eventmemberstatus'] = 'no';
    }
    if ($queues_conf_only) {
        $sql = "SELECT ivr_id, callback_id FROM queues_config WHERE extension = {$account}";
        $config = sql($sql, "getRow", DB_FETCHMODE_ASSOC);
    } else {
        $sql = "SELECT * FROM queues_config WHERE extension = {$account}";
        $config = sql($sql, "getRow", DB_FETCHMODE_ASSOC);
        $results['prefix'] = $config['grppre'];
        $results['alertinfo'] = $config['alertinfo'];
        $results['agentannounce_id'] = $config['agentannounce_id'];
        $results['maxwait'] = $config['maxwait'];
        $results['name'] = $config['descr'];
        $results['joinannounce_id'] = $config['joinannounce_id'];
        $results['password'] = $config['password'];
        $results['goto'] = $config['dest'];
        $results['announcemenu'] = $config['ivr_id'];
        $results['callback'] = $config['callback_id'];
        $results['rtone'] = $config['ringing'];
        $results['cwignore'] = $config['cwignore'];
        $results['qregex'] = $config['qregex'];
        $results['queuewait'] = $config['queuewait'];
        $results['use_queue_context'] = $config['use_queue_context'];
        $results['togglehint'] = $config['togglehint'];
        $results['qnoanswer'] = $config['qnoanswer'];
        $results['callconfirm'] = $config['callconfirm'];
        $results['callconfirm_id'] = $config['callconfirm_id'];
        $results['monitor_type'] = $config['monitor_type'];
        $results['monitor_heard'] = $config['monitor_heard'];
        $results['monitor_spoken'] = $config['monitor_spoken'];
        // TODO: why the str_replace?
        //
        if ($astman) {
            $account = str_replace("'", '', $account);
            //get dynamic members priority from astDB
            $get = $astman->database_show('QPENALTY/' . $account . '/agents');
            if ($get) {
                foreach ($get as $key => $value) {
                    $key1 = explode('/', $key);
                    $mem[$key1[4]] = $value;
                }
                foreach ($mem as $mem => $pnlty) {
                    $dynmem[] = $mem . ',' . $pnlty;
                }
                $results['dynmembers'] = implode("\n", $dynmem);
            } else {
                $results['dynmembers'] = '';
            }
            $results['dynmemberonly'] = $astman->database_get('QPENALTY/' . $account, 'dynmemberonly');
        } else {
            fatal("Cannot connect to Asterisk Manager with " . $amp_conf["AMPMGRUSER"] . "/" . $amp_conf["AMPMGRPASS"]);
        }
    }
    $results['context'] = '';
    $results['periodic-announce'] = '';
    if ($config['ivr_id'] != 'none' && $config['ivr_id'] != '') {
        if (function_exists('ivr_get_details')) {
            $results['context'] = "ivr-" . $config['ivr_id'];
            $arr = ivr_get_details($config['ivr_id']);
            if (isset($arr['announcement']) && $arr['announcement'] != '') {
                $periodic = recordings_get_file($arr['announcement']);
                // We need to strip off all but the first sound file of any compound sound files
                $periodic_arr = explode("&", $periodic);
                $results['periodic-announce'] = $periodic_arr[0];
            }
        }
    } else {
        if ($config['callback_id'] != 'none' && $config['callback_id'] != '') {
            if (function_exists('vqplus_callback_get')) {
                $results['context'] = "queuecallback-" . $config['callback_id'];
                $arr = vqplus_callback_get($config['callback_id']);
                if (isset($arr[0]) && is_array($arr[0])) {
                    /* Vqplus 13 moved to BMO, which made the return value format different. */
                    $arr = $arr[0];
                }
                if (isset($arr['announcement']) && $arr['announcement'] != '') {
                    $periodic = recordings_get_file($arr['announcement']);
                    // We need to strip off all but the first sound file of any compound sound files
                    $periodic_arr = explode("&", $periodic);
                    $results['periodic-announce'] = $periodic_arr[0];
                }
            }
        }
    }
    return $results;
}
Ejemplo n.º 2
0
		</div>
		<div class="row">
			<div class="col-md-12">
				<span id="announcemenu-help" class="help-block fpbx-help-block">' . _("You can optionally present an existing IVR as a 'break out' menu.<br><br>This IVR must only contain single-digit 'dialed options'. The Recording set for the IVR will be played at intervals specified in 'Repeat Frequency', below.") . '</span>
			</div>
		</div>
		' . $ivrbreakouterror . '
	</div>
	<!--END IVR Break Out Menu-->
	';
} else {
    $ivrbreakouthtml .= '<input type="hidden" name="announcemenu" value="none">';
}
//VQPLUS Callback
if (function_exists('vqplus_callback_get')) {
    $cbs = vqplus_callback_get();
    $cbs = is_array($cbs) ? $cbs : array();
    $vqcbopts = '';
    foreach ($cbs as $cb) {
        $vqcbopts .= '<option value="' . $cb['id'] . '" ' . ($callback == $cb['id'] ? 'SELECTED' : '') . '>' . $cb['name'] . "</option>";
    }
    $vqcbhtml = '
	<!--Queue Callback-->
	<div class="element-container">
		<div class="row">
			<div class="col-md-12">
				<div class="row">
					<div class="form-group">
						<div class="col-md-3">
							<label class="control-label" for="callback">' . _("Queue Callback") . '</label>
							<i class="fa fa-question-circle fpbx-help-icon" data-for="callback"></i>