Example #1
0
function refreshCallHistory()
{
    $respuesta = array('action' => 'show_call_history', 'message' => '(no message)');
    $sAgent = $_SESSION['callcenter']['extension'];
    global $arrConf;
    $oCallHistory = new getInfoMainConsole();
    $oCallHistory->callcenter_db_connect($arrConf['cadena_dsn']);
    $bSuccess = $oCallHistory->getCallHistoryArray(40, $sAgent);
    $agent = $oCallHistory->getCallHistoryAgentArray(40, $sAgent);
    $oCallHistory->callcenter_db_disconnect();
    if (!$bSuccess) {
        $respuesta['action'] = 'error';
        $respuesta['message'] = 'Error when getting history call: ' . $oCallHistory->errMsg;
    } else {
        $respuesta['message'] = $bSuccess;
        $respuesta['agent'] = $agent;
    }
    $json = new Services_JSON();
    Header('Content-Type: application/json');
    return $json->encode($respuesta);
}