<?php

session_start();
$currentBaseDir = dirname($_SERVER['PHP_SELF']);
include($_SESSION['basedir'] . "core.php");

$svaTool = new svaTool();


$errorCode = 0;

//print_r($_REQUEST);

$id = $_REQUEST['id'];
$channelType = $_REQUEST['chId'];

switch ($id) {


    case 0 : // Route to Queue
        $res = $dba->getAvailableVoiceQueue($channelType);
        break;
    case 1 : // Route to IVR
        $res = $dba->getAvailableIvrList();
        break;
    case 2 : // Route to extension
        $res = $dba->getAvailableVoiceExtension($channelType);
        break;
}


if (count($res) <= 0) {

    echo '<option value="-1" > -- Aucun --</option>';
} else {
    $total = count($res);
    for ($i = 0; $i < $total; $i++) {

        echo '<option value="' . $res[$i]['chId'] . '"  >' . $svaTool->escapeJsonString($res[$i]['chName']) . '</option>';
    }
}
?>

