get($_SESSION['domain']['language']['code'], 'core/user_settings'); //create assigned extensions array if (is_array($_SESSION['user']['extension'])) { foreach ($_SESSION['user']['extension'] as $assigned_extension) { $assigned_extensions[$assigned_extension['extension_uuid']] = $assigned_extension['user']; } } unset($assigned_extension); //if also viewing system status, show more recent calls (more room avaialble) $missed_limit = !empty($selected_blocks) && (is_array($selected_blocks) && in_array('counts', $selected_blocks)) ? 10 : 5; //get the missed calls from call detail records $sql = "select \n"; $sql .= " direction, \n"; $sql .= " start_stamp, \n"; $sql .= " start_epoch, \n"; $sql .= " caller_id_name, \n"; $sql .= " caller_id_number, \n"; $sql .= " answer_stamp \n"; $sql .= "from \n"; $sql .= " v_xml_cdr \n"; $sql .= "where \n"; $sql .= " domain_uuid = :domain_uuid \n"; $sql .= " and ( \n"; $sql .= " direction = 'inbound' \n"; $sql .= " or direction = 'local' \n"; $sql .= " ) \n"; $sql .= " and (missed_call = true or bridge_uuid is null) "; $sql .= " and hangup_cause <> 'LOSE_RACE' "; if (!empty($assigned_extensions)) { $x = 0; foreach ($assigned_extensions as $assigned_extension_uuid => $assigned_extension) { $sql_where_array[] = "extension_uuid = :assigned_extension_uuid_".$x; $sql_where_array[] = "destination_number = :destination_number_".$x; $parameters['assigned_extension_uuid_'.$x] = $assigned_extension_uuid; $parameters['destination_number_'.$x] = $assigned_extension; $x++; } if (!empty($sql_where_array)) { $sql .= "and (".implode(' or ', $sql_where_array).") \n"; } unset($sql_where_array); } $sql .= "and start_epoch > ".(time() - 86400)." \n"; $sql .= "order by \n"; $sql .= "start_epoch desc \n"; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; if (!isset($database)) { $database = new database; } $result = $database->select($sql, $parameters, 'all'); $num_rows = !empty($result) ? sizeof($result) : 0; //define row styles $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; //missed calls echo "
| \n"; } echo " | ".$text['label-cid_number']." | \n"; echo "".$text['label-missed']." | \n"; echo "
|---|---|---|
| \n";
if ($theme_cdr_images_exist) {
$call_result = ($row['answer_stamp'] != '') ? 'voicemail' : 'cancelled';
if (isset($row['direction'])) {
echo " | \n";
echo "".((is_numeric($row['caller_id_number'])) ? format_phone($row['caller_id_number']) : $row['caller_id_number'])." | \n"; echo "".$tmp_start_epoch." | \n"; echo "