cleanup of extras
git-svn-id: svn://192.168.202.10@17 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -0,0 +1,400 @@
|
||||
<?
|
||||
# AST_inboundEXTstats.php
|
||||
#
|
||||
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
# CHANGES
|
||||
# 60421-1450 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60620-1322 - Added variable filtering to eliminate SQL injection attack threat
|
||||
# - Added required user/pass to gain access to this page
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
|
||||
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
|
||||
$PHP_SELF=$_SERVER['PHP_SELF'];
|
||||
if (isset($_GET["group"])) {$group=$_GET["group"];}
|
||||
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
|
||||
if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];}
|
||||
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
|
||||
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
|
||||
if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];}
|
||||
elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];}
|
||||
|
||||
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
|
||||
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
|
||||
{
|
||||
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
|
||||
Header("HTTP/1.0 401 Unauthorized");
|
||||
echo "Ακυρο Ονομα Χρήστη/Κωδικός Πρόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$STARTtime = date("U");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
if (!isset($server_ip)) {$server_ip = '10.10.11.20';}
|
||||
|
||||
$stmt="select extension,full_number,inbound_name from inbound_numbers where server_ip='" . mysql_real_escape_string($server_ip) . "';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$inbound_to_print = mysql_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $inbound_to_print)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$inbound[$i] =$row[0];
|
||||
$fullnum[$i] =$row[1];
|
||||
$inbname[$i] =$row[2];
|
||||
$i++;
|
||||
}
|
||||
?>
|
||||
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<STYLE type="text/css">
|
||||
<!--
|
||||
.green {color: white; background-color: green}
|
||||
.red {color: white; background-color: red}
|
||||
.blue {color: white; background-color: blue}
|
||||
.purple {color: white; background-color: purple}
|
||||
-->
|
||||
</STYLE>
|
||||
|
||||
<?
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n";
|
||||
#echo"<META HTTP-EQUIV=Refresh CONTENT=\"7; URL=$PHP_SELF?server_ip=$server_ip&DB=$DB\">\n";
|
||||
echo "<TITLE>ASTERISK: Στατιστικά Εισερχομένων Κλησεων</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
|
||||
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=server_ip VALUE=\"$server_ip\">\n";
|
||||
echo "<INPUT TYPE=TEXT NAME=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\">\n";
|
||||
echo "<SELECT SIZE=1 NAME=group>\n";
|
||||
$o=0;
|
||||
while ($inbound_to_print > $o)
|
||||
{
|
||||
if ($inbound[$o] == $group) {echo "<option selected value=\"$inbound[$o]\">$fullnum[$o] - $inbname[$o]</option>\n";}
|
||||
else {echo "<option value=\"$inbound[$o]\">$fullnum[$o] - $inbname[$o]</option>\n";}
|
||||
$o++;
|
||||
}
|
||||
echo "</SELECT>\n";
|
||||
echo "<INPUT TYPE=Submit NAME=ΕΠΙΒΕΒΑΙΩΣΗ VALUE=ΥΠΟΒΑΛΛΩ>\n";
|
||||
echo "</FORM>\n\n";
|
||||
|
||||
echo "<PRE><FONT SIZE=2>\n\n";
|
||||
|
||||
|
||||
if (!$group)
|
||||
{
|
||||
echo "\n\n";
|
||||
echo "ΠΑΡΑΚΑΛΩ ΕΠΙΛΕΞΤΕ ΕΝΑΝ ΑΡΙΘΜΟ ΚΑΙ ΗΜΕΡΟΜΗΝΙΑ ΑΝΩΤΕΡΩ, ΚΑΙ ΠΑΤΗΣΤΕ ΕΠΙΒΕΒΑΙΩΣΗ\n";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
echo "ASTERISK: Στατιστικά Εισερχομένων Κλησεων $NOW_TIME\n";
|
||||
|
||||
echo "\n";
|
||||
echo "---------- TOTALS\n";
|
||||
|
||||
$extenSQL = "and extension='" . mysql_real_escape_string($group) . "'";
|
||||
if (eregi("\*",$group))
|
||||
{$extenSQL = "and extension LIKE \"%$group\"";}
|
||||
$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$TOTALcalls = sprintf("%10s", $row[0]);
|
||||
$average_hold_seconds = ($row[1] / $row[0]);
|
||||
$average_hold_seconds = round($average_hold_seconds, 0);
|
||||
$average_hold_seconds = sprintf("%10s", $average_hold_seconds);
|
||||
|
||||
echo "Συνολικές κλήσεις που ήρθαν σε αυτό τον αριθμό: $TOTALcalls\n";
|
||||
echo "Average Call Length(seconds) for all Calls: $average_hold_seconds\n";
|
||||
|
||||
echo "\n";
|
||||
echo "---------- ΕΓΚΑΤΑΛ\n";
|
||||
|
||||
$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$DROPcalls = sprintf("%10s", $row[0]);
|
||||
$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
|
||||
$DROPpercent = round($DROPpercent, 0);
|
||||
|
||||
if ($row[0])
|
||||
{
|
||||
$average_hold_seconds = ($row[1] / $row[0]);
|
||||
$average_hold_seconds = round($average_hold_seconds, 0);
|
||||
$average_hold_seconds = sprintf("%10s", $average_hold_seconds);
|
||||
}
|
||||
else {$DROPpercent=0; $average_hold_seconds=0;}
|
||||
echo "Total DROP Calls: (less than 10 seconds) $DROPcalls $DROPpercent%\n";
|
||||
echo "Average Call Length(seconds) for DROP Calls: $average_hold_seconds\n";
|
||||
|
||||
|
||||
##############################
|
||||
######### CALLS STATS
|
||||
|
||||
echo "\n";
|
||||
echo "---------- CALL LISTINGS\n";
|
||||
echo "+----------------------+----------------------+--------+---------------------+\n";
|
||||
echo "| CALLERID | CALLERIDNAME | LENGTH | DATE TIME |\n";
|
||||
echo "+----------------------+----------------------+--------+---------------------+\n";
|
||||
|
||||
$stmt="select number_dialed,caller_code,length_in_sec,start_time from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$users_to_print = mysql_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $users_to_print)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$CID = sprintf("%-20s", $row[0]);
|
||||
$CIDname = sprintf("%-20s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
|
||||
$datetime = sprintf("%-19s", $row[3]);
|
||||
$USERavgTALK = $row[2];
|
||||
|
||||
$USERavgTALK_M = ($USERavgTALK / 60);
|
||||
$USERavgTALK_M = round($USERavgTALK_M, 2);
|
||||
$USERavgTALK_M_int = intval("$USERavgTALK_M");
|
||||
$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
|
||||
$USERavgTALK_S = ($USERavgTALK_S * 60);
|
||||
$USERavgTALK_S = round($USERavgTALK_S, 0);
|
||||
if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
|
||||
$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
|
||||
$USERavgTALK_MS = sprintf("%6s", $USERavgTALK_MS);
|
||||
|
||||
echo "| $CID | $CIDname | $USERavgTALK_MS | $datetime |\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo "+----------------------+----------------------+--------+---------------------+\n";
|
||||
|
||||
##############################
|
||||
######### TIME STATS
|
||||
|
||||
if ($output == 'FULL')
|
||||
{
|
||||
|
||||
echo "\n";
|
||||
echo "---------- ΣΤΑΤΙΣΤΙΚΑ ΧΡΟΝΟΥ\n";
|
||||
|
||||
echo "<FONT SIZE=0>\n";
|
||||
|
||||
$hi_hour_count=0;
|
||||
$last_full_record=0;
|
||||
$i=0;
|
||||
$h=0;
|
||||
while ($i <= 96)
|
||||
{
|
||||
$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$hour_count[$i] = $row[0];
|
||||
if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
|
||||
if ($hour_count[$i] > 0) {$last_full_record = $i;}
|
||||
$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$drop_count[$i] = $row[0];
|
||||
$i++;
|
||||
|
||||
|
||||
$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$hour_count[$i] = $row[0];
|
||||
if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
|
||||
if ($hour_count[$i] > 0) {$last_full_record = $i;}
|
||||
$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$drop_count[$i] = $row[0];
|
||||
$i++;
|
||||
|
||||
$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$hour_count[$i] = $row[0];
|
||||
if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
|
||||
if ($hour_count[$i] > 0) {$last_full_record = $i;}
|
||||
$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$drop_count[$i] = $row[0];
|
||||
$i++;
|
||||
|
||||
$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$hour_count[$i] = $row[0];
|
||||
if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
|
||||
if ($hour_count[$i] > 0) {$last_full_record = $i;}
|
||||
$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$drop_count[$i] = $row[0];
|
||||
$i++;
|
||||
$h++;
|
||||
}
|
||||
|
||||
$hour_multiplier = (100 / $hi_hour_count);
|
||||
#$hour_multiplier = round($hour_multiplier, 0);
|
||||
|
||||
echo "<!-- HICOUNT: $hi_hour_count|$hour_multiplier -->\n";
|
||||
echo "ΓΡΑΦΙΚΗ ΠΑΡΑΣΤΑΣΗ ΜΕ 15ΛΕΠΤΕΣ ΑΥΞΗΣΕΙΣ ΤΩΝ ΣΥΝΟΛΙΚΩΝ ΚΛΗΣΕΩΝ\n";
|
||||
|
||||
$k=1;
|
||||
$Mk=0;
|
||||
$call_scale = '0';
|
||||
while ($k <= 102)
|
||||
{
|
||||
if ($Mk >= 5)
|
||||
{
|
||||
$Mk=0;
|
||||
$scale_num=($k / $hour_multiplier);
|
||||
$scale_num = round($scale_num, 0);
|
||||
$LENscale_num = (strlen($scale_num));
|
||||
$k = ($k + $LENscale_num);
|
||||
$call_scale .= "$scale_num";
|
||||
}
|
||||
else
|
||||
{
|
||||
$call_scale .= " ";
|
||||
$k++; $Mk++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
|
||||
#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP | DROPS | TOTAL |\n";
|
||||
echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
|
||||
echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
|
||||
|
||||
$ZZ = '00';
|
||||
$i=0;
|
||||
$h=4;
|
||||
$hour= -1;
|
||||
$no_lines_yet=1;
|
||||
|
||||
while ($i <= 96)
|
||||
{
|
||||
$char_counter=0;
|
||||
$time = ' ';
|
||||
if ($h >= 4)
|
||||
{
|
||||
$hour++;
|
||||
$h=0;
|
||||
if ($hour < 10) {$hour = "0$hour";}
|
||||
$time = "+$hour$ZZ+";
|
||||
}
|
||||
if ($h == 1) {$time = " 15 ";}
|
||||
if ($h == 2) {$time = " 30 ";}
|
||||
if ($h == 3) {$time = " 45 ";}
|
||||
$Ghour_count = $hour_count[$i];
|
||||
if ($Ghour_count < 1)
|
||||
{
|
||||
if ( ($no_lines_yet) or ($i > $last_full_record) )
|
||||
{
|
||||
$do_nothing=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$hour_count[$i] = sprintf("%-5s", $hour_count[$i]);
|
||||
echo "|$time|";
|
||||
$k=0; while ($k <= 102) {echo " "; $k++;}
|
||||
echo "| $hour_count[$i] |\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$no_lines_yet=0;
|
||||
$Xhour_count = ($Ghour_count * $hour_multiplier);
|
||||
$Yhour_count = (99 - $Xhour_count);
|
||||
|
||||
$Gdrop_count = $drop_count[$i];
|
||||
if ($Gdrop_count < 1)
|
||||
{
|
||||
$hour_count[$i] = sprintf("%-5s", $hour_count[$i]);
|
||||
|
||||
echo "|$time|<SPAN class=\"green\">";
|
||||
$k=0; while ($k <= $Xhour_count) {echo "*"; $k++; $char_counter++;}
|
||||
echo "*X</SPAN>"; $char_counter++;
|
||||
$k=0; while ($k <= $Yhour_count) {echo " "; $k++; $char_counter++;}
|
||||
while ($char_counter <= 101) {echo " "; $char_counter++;}
|
||||
echo "| 0 | $hour_count[$i] |\n";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$Xdrop_count = ($Gdrop_count * $hour_multiplier);
|
||||
|
||||
# if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
|
||||
|
||||
$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
|
||||
|
||||
$hour_count[$i] = sprintf("%-5s", $hour_count[$i]);
|
||||
$drop_count[$i] = sprintf("%-5s", $drop_count[$i]);
|
||||
|
||||
echo "|$time|<SPAN class=\"red\">";
|
||||
$k=0; while ($k <= $Xdrop_count) {echo ">"; $k++; $char_counter++;}
|
||||
echo "D</SPAN><SPAN class=\"green\">"; $char_counter++;
|
||||
$k=0; while ($k <= $XXhour_count) {echo "*"; $k++; $char_counter++;}
|
||||
echo "X</SPAN>"; $char_counter++;
|
||||
$k=0; while ($k <= $Yhour_count) {echo " "; $k++; $char_counter++;}
|
||||
while ($char_counter <= 102) {echo " "; $char_counter++;}
|
||||
echo "| $drop_count[$i] | $hour_count[$i] |\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$i++;
|
||||
$h++;
|
||||
}
|
||||
|
||||
|
||||
echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
</PRE>
|
||||
|
||||
</BODY></HTML>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
<?
|
||||
|
||||
$link=mysql_connect("localhost", "cron", "1234");
|
||||
mysql_select_db("asterisk");
|
||||
|
||||
$local_DEF = 'Local/';
|
||||
$conf_silent_prefix = '7';
|
||||
$local_AMP = '@';
|
||||
$ext_context = 'demo';
|
||||
$recording_exten = '8309';
|
||||
|
||||
$WeBServeRRooT = '/usr/local/apache2/htdocs';
|
||||
$WeBRooTWritablE = '1';
|
||||
|
||||
?>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 492 B |
@@ -0,0 +1,228 @@
|
||||
<?
|
||||
### inbound_popup.php
|
||||
###
|
||||
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
###
|
||||
# this is the inbound popup of a specific call that grabs the call and allows you to go and fetch info on that caller in the local CRM system.
|
||||
#
|
||||
# changes:
|
||||
# 60620-1329 - Added variable filtering to eliminate SQL injection attack threat
|
||||
# - Added required user/pass to gain access to this page
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
|
||||
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
|
||||
$PHP_SELF=$_SERVER['PHP_SELF'];
|
||||
if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
|
||||
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
|
||||
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
|
||||
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
|
||||
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
|
||||
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
|
||||
if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
|
||||
elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
|
||||
if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
|
||||
elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
|
||||
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
|
||||
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
|
||||
if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];}
|
||||
elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];}
|
||||
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
||||
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
|
||||
if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
|
||||
elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
|
||||
if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
|
||||
elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
|
||||
if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];}
|
||||
elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];}
|
||||
if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
|
||||
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["extension"])) {$extension=$_GET["extension"];}
|
||||
elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];}
|
||||
if (isset($_GET["channel"])) {$channel=$_GET["channel"];}
|
||||
elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];}
|
||||
if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];}
|
||||
elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];}
|
||||
if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];}
|
||||
elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];}
|
||||
if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];}
|
||||
elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];}
|
||||
if (isset($_GET["address1"])) {$address1=$_GET["address1"];}
|
||||
elseif (isset($_POST["address1"])) {$address1=$_POST["address1"];}
|
||||
if (isset($_GET["address2"])) {$address2=$_GET["address2"];}
|
||||
elseif (isset($_POST["address2"])) {$address2=$_POST["address2"];}
|
||||
if (isset($_GET["address3"])) {$address3=$_GET["address3"];}
|
||||
elseif (isset($_POST["address3"])) {$address3=$_POST["address3"];}
|
||||
if (isset($_GET["city"])) {$city=$_GET["city"];}
|
||||
elseif (isset($_POST["city"])) {$city=$_POST["city"];}
|
||||
if (isset($_GET["state"])) {$state=$_GET["state"];}
|
||||
elseif (isset($_POST["state"])) {$state=$_POST["state"];}
|
||||
if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];}
|
||||
elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
|
||||
if (isset($_GET["province"])) {$province=$_GET["province"];}
|
||||
elseif (isset($_POST["province"])) {$province=$_POST["province"];}
|
||||
if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
|
||||
elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
|
||||
if (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];}
|
||||
elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];}
|
||||
if (isset($_GET["email"])) {$email=$_GET["email"];}
|
||||
elseif (isset($_POST["email"])) {$email=$_POST["email"];}
|
||||
if (isset($_GET["security"])) {$security=$_GET["security"];}
|
||||
elseif (isset($_POST["security"])) {$security=$_POST["security"];}
|
||||
if (isset($_GET["comments"])) {$comments=$_GET["comments"];}
|
||||
elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];}
|
||||
if (isset($_GET["status"])) {$status=$_GET["status"];}
|
||||
elseif (isset($_POST["status"])) {$status=$_POST["status"];}
|
||||
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
|
||||
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
|
||||
if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];}
|
||||
elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];}
|
||||
|
||||
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
|
||||
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
|
||||
|
||||
$STARTtime = date("U");
|
||||
$TODAY = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$popup_page = './inbound_popup.php';
|
||||
$FILE_datetime = $STARTtime;
|
||||
|
||||
$ext_context = 'demo';
|
||||
if (!isset($begin_date)) {$begin_date = $TODAY;}
|
||||
if (!isset($end_date)) {$end_date = $TODAY;}
|
||||
|
||||
$stmt="SELECT count(*) from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and active = 'Y' and status IN('ACTIVE','ADMIN');";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
$fp = fopen ("./project_auth_entries.txt", "a");
|
||||
$date = date("r");
|
||||
$ip = getenv("REMOTE_ADDR");
|
||||
$browser = getenv("HTTP_USER_AGENT");
|
||||
|
||||
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
|
||||
{
|
||||
Header("WWW-Authenticate: Basic realm=\"VICI-ASTERISK\"");
|
||||
Header("HTTP/1.0 401 Unauthorized");
|
||||
echo "Ακυρο Ονομα Χρήστη/Κωδικός Πρόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if($auth>0)
|
||||
{
|
||||
$office_no=strtoupper($PHP_AUTH_USER);
|
||||
$password=strtoupper($PHP_AUTH_PW);
|
||||
$stmt="SELECT fullname,dialplan_number from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$LOGfullname=$row[0];
|
||||
fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n");
|
||||
fclose($fp);
|
||||
|
||||
##### get server listing for dynamic pulldown
|
||||
$stmt="SELECT fullname,dialplan_number,server_ip from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rsltx=mysql_query($stmt, $link);
|
||||
$rowx=mysql_fetch_row($rsltx);
|
||||
$fullname = $rowx[0];
|
||||
$dialplan_number = $rowx[1];
|
||||
$user_server_ip = $rowx[2];
|
||||
if ($DB) {echo "|$rowx[0]|$rowx[1]|$rowx[2]|\n";}
|
||||
}
|
||||
else
|
||||
{
|
||||
fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n");
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>ASTERISK ΑΠΟΜΑΚΡΥΣΜΕΝΟ ΕΙΣΕΡΧΟΜΕΝΟ: Υπερεμφανιζόμενο Παραθύρο</title>
|
||||
</head>
|
||||
<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
|
||||
<CENTER><FONT FACE="Courier" COLOR=BLACK SIZE=3>
|
||||
|
||||
<?
|
||||
|
||||
$stmt="SELECT count(*) from parked_channels where server_ip='$user_server_ip' and parked_time='" . mysql_real_escape_string($parked_time) . "' and channel='" . mysql_real_escape_string($channel) . "'";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$parked_count = $row[0];
|
||||
|
||||
if ($parked_count > 0)
|
||||
{
|
||||
|
||||
$stmt="DELETE from parked_channels where server_ip='$user_server_ip' and parked_time='" . mysql_real_escape_string($parked_time) . "' and channel='" . mysql_real_escape_string($channel) . "' LIMIT 1";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
$DTqueryCID = "RR$FILE_datetime$PHP_AUTH_USER";
|
||||
|
||||
### insert a NEW record to the vicidial_manager table to be processed
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$user_server_ip','','Redirect','$DTqueryCID','Exten: $dialplan_number','Channel: " . mysql_real_escape_string($channel) . "','Context: $ext_context','Priority: 1','Callerid: $DTqueryCID','','','','','')";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
echo "Η εντολή ανακατεύθυνσης στάλθηκε για το κανάλι $channel $NOW_TIME\n<BR><BR>\n";
|
||||
|
||||
|
||||
$url = 'https://10.10.10.15/internal/back_end_systems/cust_serv/index.php?Search=SEARCH&';
|
||||
$Suser = 'username=';
|
||||
$Spass = '&passwd=';
|
||||
$Sphone = '&phone=';
|
||||
|
||||
$newurl = "$url$Suser$PHP_AUTH_USER$Spass$PHP_AUTH_PW$Sphone$phone";
|
||||
if ( ($phone == 'unknown') or (strlen($phone)<9) )
|
||||
{$newurl = "$url$Suser$PHP_AUTH_USER$Spass$PHP_AUTH_PW";}
|
||||
|
||||
echo "<a href=\"$newurl\">Αναζήτηση του Πελάτη στο Σύστημα Εξυπηρέτησης Πελατών</a>\n<BR><BR>\n";
|
||||
|
||||
echo "<a href=\"$PHP_SELF\">Κλείσε αυτό το παράθυρο</a>\n<BR><BR>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Η εντολή ανακατεύθυνσης ΑΠΕΤΥΧΕ για το κανάλι $channel $NOW_TIME\n<BR><BR>\n";
|
||||
echo "<a href=\"$PHP_SELF\">Κλείσε αυτό το παράθυρο</a>\n<BR><BR>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$ENDtime = date("U");
|
||||
|
||||
$RUNtime = ($ENDtime - $STARTtime);
|
||||
|
||||
echo "\n\n\n<br><br><br>\n\n";
|
||||
|
||||
|
||||
echo "<font size=0>\n\n\n<br><br><br>\nχρόνος εκτέλεσης διαδικασίας: $RUNtime seconds</font>";
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
<?
|
||||
# phone_stats.php.php
|
||||
#
|
||||
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
#
|
||||
# changes:
|
||||
# 60620-1333 - Added variable filtering to eliminate SQL injection attack threat
|
||||
# - Added required user/pass to gain access to this page
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
|
||||
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
|
||||
$PHP_SELF=$_SERVER['PHP_SELF'];
|
||||
if (isset($_GET["group"])) {$group=$_GET["group"];}
|
||||
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
|
||||
if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];}
|
||||
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
|
||||
if (isset($_GET["begin_date"])) {$begin_date=$_GET["begin_date"];}
|
||||
elseif (isset($_POST["begin_date"])) {$begin_date=$_POST["begin_date"];}
|
||||
if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];}
|
||||
elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];}
|
||||
if (isset($_GET["extension"])) {$extension=$_GET["extension"];}
|
||||
elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["full_name"])) {$full_name=$_GET["full_name"];}
|
||||
elseif (isset($_POST["full_name"])) {$full_name=$_POST["full_name"];}
|
||||
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
|
||||
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
|
||||
if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];}
|
||||
elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];}
|
||||
|
||||
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
|
||||
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
|
||||
|
||||
$STARTtime = date("U");
|
||||
$TODAY = date("Y-m-d");
|
||||
$admin_page = './admin.php';
|
||||
|
||||
if (!isset($begin_date)) {$begin_date = $TODAY;}
|
||||
if (!isset($end_date)) {$end_date = $TODAY;}
|
||||
|
||||
$stmt="SELECT count(*) from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and active = 'Y' and status='ADMIN';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
$fp = fopen ("./project_auth_entries.txt", "a");
|
||||
$date = date("r");
|
||||
$ip = getenv("REMOTE_ADDR");
|
||||
$browser = getenv("HTTP_USER_AGENT");
|
||||
|
||||
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
|
||||
{
|
||||
Header("WWW-Authenticate: Basic realm=\"VICI-ASTERISK\"");
|
||||
Header("HTTP/1.0 401 Unauthorized");
|
||||
echo "Ακυρο Ονομα Χρήστη/Κωδικός Πρόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if($auth>0)
|
||||
{
|
||||
$office_no=strtoupper($PHP_AUTH_USER);
|
||||
$password=strtoupper($PHP_AUTH_PW);
|
||||
$stmt="SELECT fullname from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$LOGfullname=$row[0];
|
||||
fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n");
|
||||
fclose($fp);
|
||||
|
||||
##### get server listing for dynamic pulldown
|
||||
$stmt="SELECT fullname from phones where server_ip='$server_ip' and extension='$extension'";
|
||||
$rsltx=mysql_query($stmt, $link);
|
||||
$rowx=mysql_fetch_row($rsltx);
|
||||
$fullname = $row[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n");
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>ASTERISK ADMIN: Στατιστικά Τηλεφώνου</title>
|
||||
</head>
|
||||
<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
|
||||
<CENTER>
|
||||
<TABLE WIDTH=620 BGCOLOR=#D9E6FE cellpadding=2 cellspacing=0><TR BGCOLOR=#015B91><TD ALIGN=LEFT><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B> ΣΥΣΤΗΜΑ ΚΛΗΣΕΩΝ: Διαχείριση</TD><TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B><? echo date("l F j, Y G:i:s A") ?> </TD></TR>
|
||||
<TR BGCOLOR=#F0F5FE><TD ALIGN=LEFT COLSPAN=2><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=1><B> <a href="<? echo $admin_page ?>"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=1>ΛΙΣΤΑ ΤΗΛΕΦΩΝΩΝ</a> | <a href="<? echo $admin_page ?>?ADD=1"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=1>ΠΡΟΣΘΗΚΗ ΤΗΛΕΦΩΝΟΥ</a> | <a href="<? echo $admin_page ?>?ADD=5"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=1>ΑΝΑΖΗΤΗΣΗ ΤΗΛΕΦΩΝΟΥ</a> | <a href="<? echo $admin_page ?>?ADD=11"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=1>ΠΡΟΣΘΗΚΗ ΔΙΑΚΟΜΙΣΤΗ</a> | <a href="<? echo $admin_page ?>?ADD=10"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=1>ΛΙΣΤΑ ΔΙΑΚΟΜΙΣΤΩΝ</a></TD></TR>
|
||||
<TR BGCOLOR=#F0F5FE><TD ALIGN=LEFT COLSPAN=2><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=1><B> <a href="<? echo $admin_page ?>?ADD=100"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=1>ΕΜΦΑΝΙΣΗ ΣΥΝΔΙΑΛΕΞΕΩΝ</a> | <a href="<? echo $admin_page ?>?ADD=111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=1>ΠΡΟΣΘΗΚΗ ΣΥΝΔΙΑΛΕΞΗΣ</a></TD></TR>
|
||||
|
||||
|
||||
|
||||
|
||||
<?
|
||||
|
||||
echo "<TR BGCOLOR=\"#F0F5FE\"><TD ALIGN=LEFT COLSPAN=2><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2><B> \n";
|
||||
|
||||
echo "<form action=$PHP_SELF method=POST>\n";
|
||||
echo "<input type=hidden name=extension value=\"$extension\">\n";
|
||||
echo "<input type=hidden name=server_ip value=\"$server_ip\">\n";
|
||||
echo "<input type=text name=begin_date value=\"$begin_date\" size=10 maxsize=10> to \n";
|
||||
echo "<input type=text name=end_date value=\"$end_date\" size=10 maxsize=10> \n";
|
||||
echo "<input type=submit name=submit value=submit>\n";
|
||||
|
||||
|
||||
echo " $user - $full_name\n";
|
||||
|
||||
echo "</B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2>\n";
|
||||
|
||||
|
||||
$stmt="SELECT count(*),channel_group, sum(length_in_sec) from call_log where extension='$extension' and server_ip='$server_ip' and start_time >= '$begin_date 0:00:01' and start_time <= '$end_date 23:59:59' group by channel_group order by channel_group";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$statuses_to_print = mysql_num_rows($rslt);
|
||||
# echo "|$stmt|\n";
|
||||
|
||||
echo "<br><center>\n";
|
||||
|
||||
echo "<B>ΧΡΟΝΟΣ ΟΜΙΛΙΑΣ ΚΑΙ ΚΑΝΑΛΙΑ:</B>\n";
|
||||
|
||||
echo "<center><TABLE width=300 cellspacing=0 cellpadding=1>\n";
|
||||
echo "<tr><td><font size=2>ΚΑΝΑΛΙ ΟΜΑΔΑΣ </td><td align=right><font size=2>ΚΑΤΑΜΕΤΡΗΣΗ</td><td align=right><font size=2> ΩΡΕΣ:ΛΕΠΤΑ</td></tr>\n";
|
||||
|
||||
$total_calls=0;
|
||||
$o=0;
|
||||
while ($statuses_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if (eregi("1$|3$|5$|7$|9$", $o))
|
||||
{$bgcolor='bgcolor="#B9CBFD"';}
|
||||
else
|
||||
{$bgcolor='bgcolor="#9BB9FB"';}
|
||||
|
||||
$call_seconds = $row[2];
|
||||
$call_hours = ($call_seconds / 3600);
|
||||
$call_hours = round($call_hours, 2);
|
||||
$call_hours_int = intval("$call_hours");
|
||||
$call_minutes = ($call_hours - $call_hours_int);
|
||||
$call_minutes = ($call_minutes * 60);
|
||||
$call_minutes_int = round($call_minutes, 0);
|
||||
if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";}
|
||||
|
||||
echo "<tr $bgcolor><td><font size=2>$row[1]</td>";
|
||||
echo "<td align=right><font size=2> $row[0]</td>\n";
|
||||
echo "<td align=right><font size=2> $call_hours_int:$call_minutes_int</td></tr>\n";
|
||||
$total_calls = ($total_calls + $row[0]);
|
||||
|
||||
$call_seconds=0;
|
||||
$o++;
|
||||
}
|
||||
|
||||
$stmt="SELECT sum(length_in_sec) from call_log where extension='$extension' and server_ip='$server_ip' and start_time >= '$begin_date 0:00:01' and start_time <= '$end_date 23:59:59'";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$counts_to_print = mysql_num_rows($rslt);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$call_seconds = $row[0];
|
||||
$call_hours = ($call_seconds / 3600);
|
||||
$call_hours = round($call_hours, 2);
|
||||
$call_hours_int = intval("$call_hours");
|
||||
$call_minutes = ($call_hours - $call_hours_int);
|
||||
$call_minutes = ($call_minutes * 60);
|
||||
$call_minutes_int = round($call_minutes, 0);
|
||||
if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";}
|
||||
# echo "|$stmt|\n";
|
||||
|
||||
echo "<tr><td><font size=2>ΣΥΝΟΛΙΚΕΣ ΚΛΗΣΕΙΣ</td><td align=right><font size=2> $total_calls</td><td align=right><font size=2> $call_hours_int:$call_minutes_int</td></tr>\n";
|
||||
echo "</TABLE></center>\n";
|
||||
echo "<br><br>\n";
|
||||
|
||||
echo "<center>\n";
|
||||
|
||||
echo "<B>ΤΕΛΕΥΤΑΙΕΣ 1000 ΚΛΗΣΕΙΣ ΓΙΑ ΤΟ ΔΙΑΣΤΗΜΑ ΗΜΕΡΟΜΗΝΙΑΣ:</B>\n";
|
||||
echo "<TABLE width=400 cellspacing=0 cellpadding=1>\n";
|
||||
echo "<tr><td><font size=2>ΑΡΙΘΜΟΣ </td><td><font size=2>ΚΑΝΑΛΙ ΟΜΑΔΑΣ </td><td align=right><font size=2> ΗΜΕΡΑ</td><td align=right><font size=2> LENGTH(MIN.)</td></tr>\n";
|
||||
|
||||
$stmt="SELECT number_dialed,channel_group,start_time,length_in_min from call_log where extension='$extension' and server_ip='$server_ip' and start_time >= '$begin_date 0:00:01' and start_time <= '$end_date 23:59:59' LIMIT 1000";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$events_to_print = mysql_num_rows($rslt);
|
||||
# echo "|$stmt|\n";
|
||||
|
||||
$total_calls=0;
|
||||
$o=0;
|
||||
$event_start_seconds='';
|
||||
$event_stop_seconds='';
|
||||
while ($events_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if (eregi("1$|3$|5$|7$|9$", $o))
|
||||
{$bgcolor='bgcolor="#B9CBFD"';}
|
||||
else
|
||||
{$bgcolor='bgcolor="#9BB9FB"';}
|
||||
echo "<tr $bgcolor><td><font size=2>$row[0]</td>";
|
||||
echo "<td align=right><font size=2> $row[1]</td>\n";
|
||||
echo "<td align=right><font size=2> $row[2]</td>\n";
|
||||
echo "<td align=right><font size=2> $row[3]</td></tr>\n";
|
||||
|
||||
|
||||
$call_seconds=0;
|
||||
$o++;
|
||||
}
|
||||
|
||||
|
||||
echo "</TABLE></center>\n";
|
||||
|
||||
|
||||
$ENDtime = date("U");
|
||||
|
||||
$RUNtime = ($ENDtime - $STARTtime);
|
||||
|
||||
echo "\n\n\n<br><br><br>\n\n";
|
||||
|
||||
|
||||
echo "<font size=0>\n\n\n<br><br><br>\nχρόνος εκτέλεσης διαδικασίας: $RUNtime seconds</font>";
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
</TD></TR><TABLE>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
<?
|
||||
### remote_inbound.php
|
||||
###
|
||||
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
###
|
||||
# the purpose of this script and webpage is to allow for remote or local users of the system to log in and grab phone calls that are coming inbound into the Asterisk server and being put in the parked_channels table while they hear a soundfile for a limited amount of time before being forwarded on to either a set extension or a voicemail box. This gives remote or local agents a way to grab calls without tying up their phone lines all day. The agent sees the refreshing screen of calls on park and when they want to take one they just click on it, and a small window opens that will allow them to grab the call and/or look up more information on the caller through the callerID that is given(if available)
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
|
||||
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
|
||||
$PHP_SELF=$_SERVER['PHP_SELF'];
|
||||
$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];}
|
||||
$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"]; if (!$ΕΠΙΒΕΒΑΙΩΣΗ) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];}
|
||||
|
||||
|
||||
$STARTtime = date("U");
|
||||
$TODAY = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$popup_page = './inbound_popup.php';
|
||||
|
||||
$stmt="SELECT count(*) from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and active = 'Y' and status IN('ACTIVE','ADMIN');";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
$fp = fopen ("./project_auth_entries.txt", "a");
|
||||
$date = date("r");
|
||||
$ip = getenv("REMOTE_ADDR");
|
||||
$browser = getenv("HTTP_USER_AGENT");
|
||||
|
||||
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
|
||||
{
|
||||
Header("WWW-Authenticate: Basic realm=\"VICI-ASTERISK\"");
|
||||
Header("HTTP/1.0 401 Unauthorized");
|
||||
echo "Ακυρο Ονομα Χρήστη/Κωδικός Πρόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if($auth>0)
|
||||
{
|
||||
$office_no=strtoupper($PHP_AUTH_USER);
|
||||
$password=strtoupper($PHP_AUTH_PW);
|
||||
$stmt="SELECT fullname,dialplan_number from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$LOGfullname=$row[0];
|
||||
fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n");
|
||||
fclose($fp);
|
||||
|
||||
##### get server listing for dynamic pulldown
|
||||
$stmt="SELECT fullname,dialplan_number,server_ip from phones where login='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rsltx=mysql_query($stmt, $link);
|
||||
$rowx=mysql_fetch_row($rsltx);
|
||||
$fullname = $rowx[0];
|
||||
$dialplan_number = $rowx[1];
|
||||
$user_server_ip = $rowx[2];
|
||||
if ($DB) {echo "|$rowx[0]|$rowx[1]|$rowx[2]|\n";}
|
||||
}
|
||||
else
|
||||
{
|
||||
fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n");
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>ASTERISK ΑΠΟΜΑΚΡΥΣΜΕΝΟ ΕΙΣΕΡΧΟΜΕΝΟ: Κύριο</TITLE></HEAD>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n";
|
||||
echo"<META HTTP-EQUIV=Refresh CONTENT=\"5; URL=$PHP_SELF\">\n";
|
||||
echo"</HEAD>\n";
|
||||
|
||||
?>
|
||||
|
||||
<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
|
||||
<CENTER><FONT FACE="Courier" COLOR=BLACK SIZE=3>
|
||||
|
||||
<?
|
||||
|
||||
|
||||
echo "$NOW_TIME $PHP_AUTH_USER - $fullname - ΚΛΗΣΕΙΣ ΣΤΑΛΘΗΚΑΝ ΠΡΟΣ: $dialplan_number<BR><BR>\n";
|
||||
|
||||
echo "Πατήστε στο κανάλι παρακάτω, που θα επιθυμούσατε να έχετε κατευθύνει στο τηλέφωνό σας<BR><BR>\n";
|
||||
|
||||
echo "<PRE>\n";
|
||||
echo "CHANNEL ΔΙΑΚΟΜΙΣΤΗΣ CHANNEL_GROUP EXTENSION PARKED_BY PARKED_TIME \n";
|
||||
echo "----------------------------------------------------------------------------------------------\n";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$stmt="SELECT count(*) from parked_channels where server_ip='$user_server_ip' order by parked_time";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$parked_count = $row[0];
|
||||
if ($parked_count > 0)
|
||||
{
|
||||
$stmt="SELECT * from parked_channels where server_ip='$user_server_ip' and channel_group LIKE \"IN_%\" order by parked_time";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$parked_to_print = mysql_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $parked_to_print)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$channel = sprintf("%-11s", $row[0]);
|
||||
$server = sprintf("%-14s", $row[1]);
|
||||
$channel_group = sprintf("%-16s", $row[2]);
|
||||
$extension = sprintf("%-13s", $row[3]);
|
||||
$parked_by = sprintf("%-21s", $row[4]);
|
||||
$parked_time = sprintf("%-19s", $row[5]);
|
||||
|
||||
echo "<A HREF=\"$popup_page?phone=$row[4]&channel=$row[0]&parked_time=$row[5]&server_ip=$user_server_ip&DB=\" target=\"_blank\">$channel</A>$server$channel_group$extension$parked_by$parked_time\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "**********************************************************************************************\n";
|
||||
echo "**********************************************************************************************\n";
|
||||
echo "*************************************** NO PARKED CALLS **************************************\n";
|
||||
echo "**********************************************************************************************\n";
|
||||
echo "**********************************************************************************************\n";
|
||||
}
|
||||
|
||||
|
||||
$ENDtime = date("U");
|
||||
|
||||
$RUNtime = ($ENDtime - $STARTtime);
|
||||
|
||||
echo "</PRE>\n\n\n<br><br><br>\n\n";
|
||||
|
||||
|
||||
echo "<font size=0>\n\n\n<br><br><br>\nχρόνος εκτέλεσης διαδικασίας: $RUNtime seconds</font>";
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user