.
*/
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);
?>