Exemplo n.º 1
0
function call2phone($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk)
{
    $padress_book = new paloAdressBook($pDB);
    //echo '<pre>'.print_r($_SESSION,1).'</pre>';die;
    $extension = $_SESSION['callcenter']['agente'];
    $name = $_SESSION['callcenter']['agente_nombre'];
    if ($extension != "") {
        $id = isset($_GET['id']) ? $_GET['id'] : (isset($_POST['id']) ? $_POST['id'] : "");
        $prefix = prefixNumber($id);
        $phone2call = $prefix . $id;
        $result = $padress_book->Call2Phone($dsn_agi_manager, $extension, $phone2call, $extension, $name);
        if (!$result) {
            $smarty->assign("mb_title", "Lỗi: ");
            $smarty->assign("mb_message", "Không nhận diện được số điện thoại!");
        } else {
            $smarty->assign("mb_title", "Gọi thành công: ");
            $smarty->assign("mb_message", "Số điện thoại " . $id);
        }
    } else {
        $smarty->assign("mb_title", "Lỗi: ");
        $smarty->assign("mb_message", "Phải đăng nhập màn hình chính để lấy thông tin máy nhánh!");
    }
    $content = report_adress_book($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
    return $content;
}
Exemplo n.º 2
0
function call2phone()
{
    include_once "libs/paloSantoConfig.class.php";
    require_once '/var/www/html/modules/address_book/libs/paloSantoAdressBook.class.php';
    global $arrConf;
    $pConfig = new paloConfig("/etc", "amportal.conf", "=", "[[:space:]]*=[[:space:]]*");
    $arrConfig = $pConfig->leer_configuracion(false);
    $dsn_agi_manager['password'] = $arrConfig['AMPMGRPASS']['valor'];
    $dsn_agi_manager['host'] = $arrConfig['AMPDBHOST']['valor'];
    $dsn_agi_manager['user'] = '******';
    $pDB = new paloDB($arrConf['dsn_conn_database']);
    // address_book
    $padress_book = new paloAdressBook();
    $sNumber = getParameter('call_number');
    if (strpos($sNumber, '|') !== false) {
        $arrExt = explode(" | ", $sNumber);
        $sNumber = trim($arrExt[1]);
    }
    $response = array('action' => 'call2phone', 'message' => $sNumber);
    $extension = $_SESSION['callcenter']['agente'];
    $name = $_SESSION['callcenter']['agente_nombre'];
    //var_dump($arrConf);
    if (is_null($sNumber) || !ctype_digit($sNumber)) {
        $response['action'] = 'error';
        $response['message'] = 'Invalid or missing number to call';
    } else {
        $prefix = prefixNumber($sNumber);
        $phone2call = $prefix . $sNumber;
        $result = $padress_book->Call2Phone($dsn_agi_manager, $extension, $phone2call, $extension, $name);
        if (!$result) {
            $response['action'] = 'error';
            $response['message'] = 'Cuộc gọi không thực hiện được. Kiểm tra máy nhánh ' + $extension;
        }
    }
    $json = new Services_JSON();
    Header('Content-Type: application/json');
    return $json->encode($response);
}
Exemplo n.º 3
0
function call2phone($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk)
{
    $padress_book = new paloAdressBook($pDB);
    $pACL = new paloACL($pDB_2);
    $id_user = $pACL->getIdUser($_SESSION["elastix_user"]);
    if ($id_user != FALSE) {
        $user = $pACL->getUsers($id_user);
        if ($user != FALSE) {
            $extension = $user[0][3];
            if ($extension != "") {
                $id = isset($_GET['id']) ? $_GET['id'] : (isset($_POST['id']) ? $_POST['id'] : "");
                $phone2call = '';
                if (isset($_GET['type']) && $_GET['type'] == 'external') {
                    $contactData = $padress_book->contactData($id, $id_user);
                    $phone2call = $contactData['telefono'];
                } else {
                    $phone2call = $id;
                }
                $result = $padress_book->Obtain_Protocol_from_Ext($dsnAsterisk, $extension);
                if ($result != FALSE) {
                    $result = $padress_book->Call2Phone($dsn_agi_manager, $extension, $phone2call, $result['dial'], $result['description']);
                    if (!$result) {
                        $smarty->assign("mb_title", $arrLang['ERROR'] . ":");
                        $smarty->assign("mb_message", $arrLang["The call couldn't be realized"]);
                    }
                } else {
                    $smarty->assign("mb_title", $arrLang["Validation Error"]);
                    $smarty->assign("mb_message", $padress_book->errMsg);
                }
            }
        } else {
            $smarty->assign("mb_title", $arrLang["Validation Error"]);
            $smarty->assign("mb_message", $padress_book->errMsg);
        }
    } else {
        $smarty->assign("mb_title", $arrLang["Validation Error"]);
        $smarty->assign("mb_message", $padress_book->errMsg);
    }
    $content = report_adress_book($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
    return $content;
}
Exemplo n.º 4
0
function call2phone($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk)
{
    $padress_book = new paloAdressBook($pDB);
    //echo '<pre>'.print_r($_SESSION,1).'</pre>';die;
    $extension = $_SESSION['callcenter']['agente'];
    $name = $_SESSION['callcenter']['agente_nombre'];
    if ($extension != "") {
        $id = isset($_GET['id']) ? $_GET['id'] : (isset($_POST['id']) ? $_POST['id'] : "");
        $phone2call = $id;
        $result = $padress_book->Call2Phone($dsn_agi_manager, $extension, $phone2call, $extension, $name);
        if (!$result) {
            $smarty->assign("mb_title", $arrLang['ERROR'] . ":");
            $smarty->assign("mb_message", $arrLang["The call couldn't be realized"]);
        } else {
            $smarty->assign("mb_title", $arrLang["Validation Error"]);
            $smarty->assign("mb_message", $padress_book->errMsg);
        }
    } else {
        $smarty->assign("mb_title", $arrLang["Validation Error"]);
        $smarty->assign("mb_message", $padress_book->errMsg);
    }
    $content = report_adress_book($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
    return $content;
}