예제 #1
0
파일: index.php 프로젝트: hardikk/HNH
function enumerarFaxesPendientes()
{
    $faxstatus = paloFax::getFaxStatus();
    $jobs = array();
    foreach ($faxstatus['jobs'] as $k => $t) {
        if (!in_array($t['state'], array('F', 'D'))) {
            $jobs[$k] = $t;
        }
    }
    return $jobs;
}
예제 #2
0
function checkFaxStatus()
{
    session_commit();
    $jobid = getParameter('jobid');
    $modem = getParameter('modem');
    $oldhash = getParameter('outputhash');
    $startTime = time();
    do {
        $faxinfo = paloFax::getFaxStatus();
        $faxstatus = array('state' => 'F', 'modemstatus' => '(invalid modem)', 'status' => '(invalid jobid)');
        if (isset($faxinfo['modems'][$modem])) {
            $faxstatus['modemstatus'] = $modem . ': ' . $faxinfo['modems'][$modem];
        }
        if (isset($faxinfo['jobs'][$jobid])) {
            $faxstatus = array_merge($faxstatus, $faxinfo['jobs'][$jobid]);
        }
        $newhash = md5(serialize($faxstatus));
        if ($oldhash == $newhash) {
            usleep(2 * 1000000);
        }
    } while ($oldhash == $newhash && time() - $startTime < 30);
    $jsonObject = new PalosantoJSON();
    $jsonObject->set_status($oldhash != $newhash ? 'CHANGED' : 'NOCHANGED');
    $jsonObject->set_message(array('faxstatus' => $faxstatus, 'outputhash' => $newhash));
    Header('Content-Type: application/json');
    return $jsonObject->createJSON();
}
예제 #3
0
파일: index.php 프로젝트: hardikk/HNH
function faxListStatus($smarty, $module_name, $local_templates_dir, $arrConf, $arrLang)
{
    $oFax = new paloFax();
    $arrFax = $oFax->getFaxList();
    $status = TRUE;
    $end = count($arrFax);
    $arrFaxStatus = $oFax->getFaxStatus();
    $arrData = array();
    foreach ($arrFax as $fax) {
        $arrData[$fax['extension']] = $arrFaxStatus['modems']['ttyIAX' . $fax['dev_id']] . ' on ttyIAX' . $fax['dev_id'];
    }
    $statusArr = thereChanges($arrData);
    if (empty($statusArr)) {
        $status = FALSE;
    }
    $jsonObject = new PaloSantoJSON();
    if ($status) {
        //este status es true solo cuando el tecnico acepto al customer (al hacer click)
        //sleep(2); //por si acaso se desincroniza en la tabla customer el campo attended y llenarse los datos de id_chat y id_chat_time
        $msgResponse["faxes"] = $statusArr;
        $jsonObject->set_status("CHANGED");
        $jsonObject->set_message($msgResponse);
    } else {
        $jsonObject->set_status("NOCHANGED");
    }
    return array("there_was_change" => $status, "data" => $jsonObject->createJSON());
}