. */ require_once "config.php"; include "sesvars.php"; //ini_set('display_errors',1); //error_reporting(E_WARNING); ?> Asterisk Call Center Stats 0)) { $callerid_search = $_REQUEST['callerid_search']; $sql = "select distinct(callid) from $DBTable where time >= '$start' AND time <= '$end' and data2 like '%$callerid_search%'"; $restemp = mysqli_query($connection, $sql); foreach ($restemp as $temp) { $callid_search .= ",'" . $temp['callid'] . "'"; } $callid_search = substr($callid_search, 1); $sql = "select time, callid, queuename, agent, event, data1, data2, data3 from $DBTable where time >= '$start' AND time <= '$end' and event in ('COMPLETECALLER','COMPLETEAGENT','ENTERQUEUE', 'REC') and callid in ($callid_search) order by callid"; $rescomplete = mysqli_query($connection, $sql); } elseif ((isset($_REQUEST['outagent'])) && (strlen($_REQUEST['outagent']) > 0)) { $outagent = $_REQUEST['outagent']; $sql = "select time, callid, queuename, agent, event, data1, data2, data3 from $DBTable where time >= '$start' AND time <= '$end' and event in ('COMPLETECALLER','COMPLETEAGENT','ENTERQUEUE', 'REC') and agent in ('$outagent','NONE') order by callid"; $rescomplete = mysqli_query($connection, $sql); } else { $sql = "select time, callid, queuename, agent, event, data1, data2, data3 from $DBTable where time >= '$start' AND time <= '$end' AND agent IN ($agent , 'NONE') and queuename in ($queue, 'rec', 'recordcheck') and event in ('COMPLETECALLER','COMPLETEAGENT','ENTERQUEUE', 'REC') order by callid, time limit $page_rows"; $rescomplete = mysqli_query($connection, $sql); } mysqli_close($connection); $start_parts = explode(" ,:", $start); $end_parts = explode(" ,:", $end); //$conn_fpbx = new mysqli("localhost", "freepbxuser", "4094e7b341f3b8353246db18840290c6", "asteriskcdrdb"); // $sql2 = $conn_fpbx->query("SELECT uniqueid, recordingfile from cdr where calldate >= '$start' AND calldate <= '$end'"); // $datacdr = mysqli_query($conn_fpbx, $sql2); // $cdrd = array(); //while ($row = $datacdr->fetch_array(MYSQLI_ASSOC)) { // $cdrd[] = $row; //} //mysqli_close($conn_fpbx); ?>
:
:
:
:

    


'; // ' . $row['callid'] . ''; //$rec['filename'] = 'q-' . $row['queuename'] . '-' . $callerid . '-' . date('Ymd', $time) . '-000000-' . $row['callid'] . '.wav'; $rec['filename'] = $recfile . '.wav'; $rec['path'] = '/var/spool/asterisk/monitor/' . date('Y/m/d/', $time) . $rec['filename']; if (file_exists($rec['path']) && preg_match('/(.*)\.wav$/i', $rec['filename'])) { $tmpRes = str_replace('[_file]', base64_encode($rec['path']), $tmpRec); } else { $tmpRes = $tmpError; } echo "\n"; $linea_pdf = array($time, $callerid, $row['queuename'], $row['agent'], $cause_hangup, $holdtime, $calltime); $data_pdf[] = $linea_pdf; } } } mysqli_free_result($rescomplete); print_exports($header_pdf, $data_pdf, $width_pdf, $title_pdf, $cover_pdf); ?>
" . date('Y-m-d H:i:s', $time) . " " . $callerid . " " . $row['queuename'] . " " . $row['agent'] . " " . $cause_hangup . " " . $holdtime . " " . $calltime . " " . $tmpRes . "