示例#1
0
文件: index.php 项目: hardikk/HNH
function getAllDataAction(&$pDB1, &$pDB2)
{
    $jsonObject = new PaloSantoJSON();
    $pControlPanel = new paloSantoControlPanel($pDB1, $pDB2);
    $message = $pControlPanel->getAllDevicesXML();
    $arrPrev = array();
    $data = array();
    $session = getSession();
    if (isset($session['operator_panel']['prev'])) {
        $arrPrev = $session['operator_panel']['prev'];
    } else {
        $session['operator_panel']['prev'] = $message;
        putSession($session);
    }
    $diff = $message;
    if (count($diff) > 0) {
        $i = 0;
        foreach ($diff as $key => $value) {
            foreach ($value as $key2 => $value2) {
                if ($key2 == "activity") {
                    if (!isset($session['operator_panel'][$message[$key]["numconf"]])) {
                        $data[$i]['Tipo'] = "conference";
                        $data[$i]['key'] = $message[$key]["numconf"];
                        $data[$i]['data'] = array($key2 => $value2);
                        $i++;
                        $session = getSession();
                        $session['operator_panel'][$message[$key]["numconf"]] = array();
                        putSession($session);
                    }
                } elseif ($key2 == "parties") {
                    $data[$i]['Tipo'] = "conference";
                    $data[$i]['key'] = $message[$key]["numconf"];
                    $data[$i]['data'] = array($key2 => $value2);
                    $i++;
                } elseif ($key2 == "speak_time" && $value2 != " ") {
                    if ($message[$key]["context"] == "macro-dialout-trunk" && $message[$key]["trunk"] != " ") {
                        $data[$i]['Tipo'] = "trunk";
                        $data[$i]['key'] = $message[$key]["user"] . "_" . $message[$key]["trunk"];
                        $data[$i]['data'] = array($key2 => $value2);
                        $i++;
                    } elseif ($message[$key]["context"] != "macro-dialout-trunk") {
                        $data[$i]['Tipo'] = "extension";
                        $data[$i]['key'] = $message[$key]["user"];
                        $data[$i]['data'] = array($key2 => $value2);
                        $i++;
                    }
                } elseif ($key2 == "waiting" || $key2 == "queueNumber") {
                    $data[$i]['Tipo'] = "queue";
                    $data[$i]['key'] = $message[$key]["queueNumber"];
                    $data[$i]['data'] = array($key2 => $value2);
                    $i++;
                } elseif ($key2 == "time") {
                    $data[$i]['Tipo'] = "parkinglot";
                    $data[$i]['key'] = $message[$key]["lotNumber"];
                    $data[$i]['data'] = array($key2 => $value2);
                    $i++;
                } elseif ($key2 == "extension" || $key2 == "lotNumber") {
                    $data[$i]['Tipo'] = "parkinglot";
                    $data[$i]['key'] = $message[$key]["lotNumber"];
                    $data[$i]['data'] = array($key2 => $value2);
                    $i++;
                } elseif ($key2 == "voicemail") {
                    $data[$i]['Tipo'] = "extension";
                    $data[$i]['key'] = $message[$key]["user"];
                    $data[$i]['data'] = array($key2 => $value2 . "_" . $message[$key]["voicemail_cnt"]);
                    $i++;
                } else {
                    $data[$i]['Tipo'] = "extension";
                    $data[$i]['key'] = $message[$key]["user"];
                    $data[$i]['data'] = array($key2 => $value2);
                    $i++;
                }
            }
        }
        if (count($data) > 0) {
            $jsonObject->set_status("CHANGED");
            $jsonObject->set_message($data);
        } else {
            $jsonObject->set_message(array());
        }
    } else {
        $jsonObject->set_message(array());
    }
    // writeLOG("access.log", print_r($data,true));
    return $jsonObject->createJSON();
}
示例#2
0
function getFaxStatus($module_name, $local_templates_dir, &$pDB, $arrConf)
{
    global $arrCredentials;
    $pMyFax = new paloMyFax($pDB, $arrCredentials['idUser']);
    $jsonObject = new PaloSantoJSON();
    $my_fax = $pMyFax->getMyFaxExtension();
    if ($my_fax == false) {
        $status = FALSE;
    } else {
        // 1 COMPARA EL VALOR DEVUELTO CON EL VALOR QUE ESTA EN SESION
        //SI HUBO UN CAMBIO
        // si hay cambio status true
        // poner el nuevo valor el seesion
        $session = getSession();
        if ($session['faxlistStatus'] != $my_fax['STATUS']) {
            $msgResponse = $my_fax['STATUS'];
            $status = true;
        } else {
            $status = false;
        }
        if ($status) {
            //hubo un cambio
            $jsonObject->set_status("CHANGED");
            $jsonObject->set_message($msgResponse);
            //el valor del status actual
        } else {
            $jsonObject->set_status("NOCHANGED");
        }
    }
    $session['faxlistStatus'] = $my_fax['STATUS'];
    putSession($session);
    return array("there_was_change" => $status, "data" => $jsonObject->createJSON());
}
function getChatContactsStatus($searchFilter)
{
    $jsonObject = new PaloSantoJSON();
    $dummy = NULL;
    $newListContacts = getNewListElastixAccounts($searchFilter, $dummy);
    if ($newListContacts === false) {
        $status = FALSE;
    } else {
        // 1 COMPARA EL VALOR DEVUELTO CON EL VALOR QUE ESTA EN SESION
        //SI HUBO UN CAMBIO
        // si hay cambio status true
        // poner el nuevo valor el seesion
        $session = getSession();
        //var_dump($session['chatlistStatus']);
        //print_r("---------------------------------------------------------------------------------------");
        //var_dump($newListContacts);
        //file_put_contents("/tmp/testchat",);
        if ($session['chatlistStatus'] != $newListContacts) {
            $msgResponse = $newListContacts;
            $status = true;
        } else {
            $status = false;
        }
        if ($status) {
            //hubo un cambio
            $jsonObject->set_status("CHANGED");
            $jsonObject->set_message($msgResponse);
            //el valor del status actual
        } else {
            $jsonObject->set_status("NOCHANGED");
        }
    }
    $session['chatlistStatus'] = $newListContacts;
    putSession($session);
    return array("there_was_change" => $status, "data" => $jsonObject->createJSON());
}
示例#4
0
文件: index.php 项目: hardikk/HNH
function saveVega($smarty, $module_name, $local_templates_dir, $dsnAsterisk, $dsnSqlite, $arrConf)
{
    $paloEndPoint = new paloSantoEndPoint($dsnAsterisk, $dsnSqlite);
    $paloFileEndPoint = new PaloSantoFileEndPoint($arrConf["tftpboot_path"], $_SESSION["endpoint_mask"]);
    $arrSession = getSession();
    for ($i = 0; $i < $arrSession["endpoint_configurator"]["analog_trunk_lines"]; $i++) {
        if (getParameter("line{$i}") == "" || getParameter("ID{$i}") == "" || getParameter("authentication_ID{$i}") == "") {
            $smarty->assign("mb_title", _tr("Validation Error"));
            $smarty->assign("mb_message", _tr("Fields Line, ID and authentication ID can not be empty"));
            return getLinesVegaForm($smarty, $module_name, $local_templates_dir, $dsnAsterisk, $dsnSqlite, $arrConf, true);
        } else {
            $arrSession["endpoint_configurator"]["line{$i}"] = getParameter("line{$i}");
            $arrSession["endpoint_configurator"]["ID{$i}"] = getParameter("ID{$i}");
            $arrSession["endpoint_configurator"]["authentication_ID{$i}"] = getParameter("authentication_ID{$i}");
            $arrSession["endpoint_configurator"]["num_list{$i}"] = getParameter("num_list{$i}");
            if (getParameter("enable_line{$i}")) {
                $arrSession["endpoint_configurator"]["enable_line{$i}"] = 1;
            } else {
                $arrSession["endpoint_configurator"]["enable_line{$i}"] = 0;
            }
        }
    }
    $mac = "";
    if (getParameter("mac")) {
        $mac = getParameter("mac");
    }
    $credential = $paloEndPoint->getPassword($mac);
    if (!$paloEndPoint->saveVegaData($arrSession["endpoint_configurator"])) {
        $smarty->assign("mb_title", _tr("ERROR"));
        if ($paloEndPoint->errMsg != "" && isset($paloEndPoint->errMsg)) {
            $smarty->assign("mb_message", $paloEndPoint->errMsg);
        } else {
            $smarty->assign("mb_message", _tr("In the query to database endpoint.db"));
        }
        return endpointConfiguratedShow($smarty, $module_name, $local_templates_dir, $dsnAsterisk, $dsnSqlite, $arrConf);
    }
    $tone_set = $paloEndPoint->getToneSet($arrSession["endpoint_configurator"]["country"]);
    if ($tone_set == false) {
        $smarty->assign("mb_title", _tr("ERROR"));
        $smarty->assign("mb_message", _tr("Could not get the tone set by country"));
        return endpointConfiguratedShow($smarty, $module_name, $local_templates_dir, $dsnAsterisk, $dsnSqlite, $arrConf);
    }
    //$last_password=$credential["password"];
    $result = $paloFileEndPoint->buildSangomaConfFile($arrSession["endpoint_configurator"], $tone_set, $dsnAsterisk, $dsnSqlite);
    if ($result === false || is_null($result)) {
        $smarty->assign("mb_title", _tr("ERROR"));
        if ($paloFileEndPoint->errMsg != "" && isset($paloFileEndPoint->errMsg)) {
            $smarty->assign("mb_message", $paloFileEndPoint->errMsg);
        } else {
            $smarty->assign("mb_message", _tr("Could not create the Vega configuration file"));
        }
        if (is_null($result)) {
            return getVegaData($smarty, $module_name, $local_templates_dir, $dsnAsterisk, $dsnSqlite, $arrConf);
        } else {
            return endpointConfiguratedShow($smarty, $module_name, $local_templates_dir, $dsnAsterisk, $dsnSqlite, $arrConf);
        }
    }
    $smarty->assign("mb_title", _tr("MESSAGE"));
    $smarty->assign("mb_message", _tr("The Sangoma Vega was successfully configurated. The changes will apply after the Vega is finished rebooting"));
    unset($arrSession["endpoint_configurator"]);
    unset($arrSession["elastix_endpoints"]);
    putSession($arrSession);
    return endpointConfiguratedShow($smarty, $module_name, $local_templates_dir, $dsnAsterisk, $dsnSqlite, $arrConf);
}
示例#5
0
文件: index.php 项目: hardikk/HNH
function thereChanges($data)
{
    $session = getSession();
    $arrData = array();
    if (isset($session['faxlist']['faxListStatus']) && is_array($session['faxlist']['faxListStatus'])) {
        $arrData = $session['faxlist']['faxListStatus'];
    }
    $arraResult = array();
    foreach ($arrData as $key => $value) {
        $fax = $value[1];
        $status = $value[6];
        if (isset($data[$fax]) & $data[$fax] != $status) {
            $arraResult[$fax] = $data[$fax];
            $arrData[$key][6] = $data[$fax];
        }
    }
    $session['faxlist']['faxListStatus'] = $arrData;
    putSession($session);
    return $arraResult;
}
示例#6
0
function thereChangesShowCallers($data)
{
    $session = getSession();
    $arrData = array();
    $flag = false;
    if (isset($session['conference']["current_conf"]) && is_array($session['conference']["current_conf"])) {
        $arrData = $session['conference']["current_conf"];
    }
    $arraResult = array();
    if (count($data) != count($arrData)) {
        $flag = true;
    } else {
        //data[userid]=callerid
        foreach ($data as $userid => $value) {
            if (isset($arrData[$userid])) {
                if ($arrData[$userid] != $value) {
                    $flag = true;
                    break;
                }
            } else {
                $flag = true;
                break;
            }
        }
    }
    $session['conference']["current_conf"] = $data;
    putSession($session);
    return $flag;
}