Esempio n. 1
0
function handleJSON_getSIPParameters($smarty, $module_name)
{
    global $arrConf;
    Header('Content-Type: application/json');
    $jsonObject = new PaloSantoJSON();
    $error = '';
    $pDB = new paloDB($arrConf['elastix_dsn']["elastix"]);
    $paramSIP = getChatClientConfig($pDB, $error);
    if (!is_array($paramSIP)) {
        $jsonObject->set_error(_tr("An error has ocurred to retrieved server configuration params:  ") . ': ' . $error);
        return $jsonObject->createJSON();
    }
    $pACL = new paloACL($pDB);
    $arrCredentials = getUserCredentials($_SESSION['elastix_user']);
    $accountInfo = $pACL->getUserAccountInfo($arrCredentials['idUser'], $arrCredentials['id_organization']);
    /* Agregar los siguientes parámetros requeridos: 
     * elxuser_username display_name password  */
    $paramSIP += array('elxuser_username' => str_replace('IM_', 'IM@', $accountInfo['elxweb_device']), 'display_name' => $accountInfo['name'], 'password' => $_SESSION['elastix_pass2']);
    $jsonObject->set_message($paramSIP);
    return $jsonObject->createJSON();
}