Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N
<?php
$url1=$_SERVER['REQUEST_URI'];
header("Refresh: 40; URL=$url1");
echo "<h1>Inbound Agent Calls</h1>";
echo "<h5>*Refreshes every 40s</h5>";
$servername="localhost";
$username="cron";
$password="1234";
$dbname="asterisk";
$conn=new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$query="select caller_id_number,extension, call_date from vicidial_did_agent_log where call_date > timestampadd(day, -1, now()) and did_route='AGENT';";
$result=$conn->query($query);
if ($result->num_rows > 0) {
// output data of each row
echo '<table border=1px>';
echo '<th>Caller ID Number</th><th>Extension</th><th>Call Time</th>';
while($row = $result->fetch_assoc()) {
echo '<tr>';
echo "<td>" . $row["caller_id_number"]. "</td><td>" . $row["extension"]. "</td><td>" . $row["call_date"] . "</td></tr>";
}
} else {
echo "0 results";
}
$conn->close();
?>
<?php
$url1=$_SERVER['REQUEST_URI'];
header("Refresh: 40; URL=$url1");
echo "<h1>Calls Past 7 Days</h1>";
echo "<h5>*Refreshes every 40s</h5>";
$servername="localhost";
$username="cron";
$password="1234";
$dbname="asterisk";
$conn=new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$query="select phone_number, call_date, status, term_reason, length_in_sec, user from vicidial_log where call_date > timestampadd(day, -7, now()) ;";
$result=$conn->query($query);
if ($result->num_rows > 0) {
// output data of each row
echo '<table border=1px>';
echo '<th>Caller ID Number</th><th>Call Time</th><th>Status</th><th>Term Reason</th><th>Agent</th><th>Call Length</th>';
while($row = $result->fetch_assoc()) {
echo '<tr>';
echo "<td>" . $row["phone_number"]. "</td><td>" . $row["call_date"] . "</td><td>" . $row["status"] . "</td><td>" . $row["term_reason"] . "</td><td>" . $row["user"] . "</td><td>" . $row["length_in_sec"] . "</td></tr>";
}
} else {
echo "0 results";
}
$conn->close();
?>
Users browsing this forum: Google [Bot] and 51 guests