diff --git a/agc_2-X/trunk/www/vicidial/AST_timeonVDAD.php b/agc_2-X/trunk/www/vicidial/AST_timeonVDAD.php deleted file mode 100644 index 9675f284..00000000 --- a/agc_2-X/trunk/www/vicidial/AST_timeonVDAD.php +++ /dev/null @@ -1,257 +0,0 @@ - LICENSE: GPLv2 -### -# live real-time stats for the VICIDIAL Auto-Dialer -# -# changes: -# 50406-0920 - Added Paused agents < 1 min (Chris Doyle) -# 60620-1040 - Added variable filtering to eliminate SQL injection attack threat -# - Added required user/pass to gain access to this page -# - -header ("Content-type: text/html; charset=utf-8"); - -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["server_ip"])) {$server_ip=$_GET["server_ip"];} - elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} -if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} - elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} -if (isset($_GET["submit"])) {$submit=$_GET["submit"];} - elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} -if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} - elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} - -$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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; - exit; - } - -$NOW_TIME = date("Y-m-d H:i:s"); -$STARTtime = date("U"); -$epochSIXhoursAGO = ($STARTtime - 21600); -$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); - -$reset_counter++; - -if ($reset_counter > 7) - { - $reset_counter=0; - - $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; -# $rslt=mysql_query($stmt, $link); - if ($DB) {echo "$stmt\n";} - - if ($DB) - { - $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; -# $rslt=mysql_query($stmt, $link); - echo "$stmt\n"; - } - } - -?> - - - - - -\n"; -echo"\n"; -echo "VICIDIAL: Time On VDAD\n"; -echo "
";
-
-###################################################################################
-###### TIME ON SYSTEM
-###################################################################################
-
-echo "VICIDIAL: Agents Time On Calls                         $NOW_TIME    REPORTS\n\n";
-echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
-echo "| STATION    | USER   | SESSIONID | CHANNEL    | STATUS | START TIME          | MINUTES |\n";
-echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
-
-
-$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where server_ip='" . mysql_real_escape_string($server_ip) . "' order by extension;";
-$rslt=mysql_query($stmt, $link);
-if ($DB) {echo "$stmt\n";}
-$talking_to_print = mysql_num_rows($rslt);
-	if ($talking_to_print > 0)
-	{
-	$i=0;
-	$agentcount=0;
-	while ($i < $talking_to_print)
-		{
-		$row=mysql_fetch_row($rslt);
-			if (eregi("READY|PAUSED",$row[4]))
-			{
-			$row[3]='';
-			$row[5]=' - WAITING - ';
-			$row[6]=$row[7];
-			}
-		$extension = eregi_replace('Local/',"",$row[0]);
-		$extension =		sprintf("%-10s", $extension);
-			while(strlen($extension)>10) {$extension = substr("$extension", 0, -1);}
-		$user =				sprintf("%-6s", $row[1]);
-		$sessionid =		sprintf("%-9s", $row[2]);
-		$channel =			sprintf("%-10s", $row[3]);
-			$cc=0;
-		while ( (strlen($channel) > 10) and ($cc < 100) )
-			{
-			$channel = eregi_replace(".$","",$channel);   
-			$cc++;
-			if (strlen($channel) <= 10) {$cc=101;}
-			}
-		$status =			sprintf("%-6s", $row[4]);
-		$start_time =		sprintf("%-19s", $row[5]);
-		$call_time_S = ($STARTtime - $row[6]);
-
-		$call_time_M = ($call_time_S / 60);
-		$call_time_M = round($call_time_M, 2);
-		$call_time_M_int = intval("$call_time_M");
-		$call_time_SEC = ($call_time_M - $call_time_M_int);
-		$call_time_SEC = ($call_time_SEC * 60);
-		$call_time_SEC = round($call_time_SEC, 0);
-		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
-		$call_time_MS = "$call_time_M_int:$call_time_SEC";
-		$call_time_MS =		sprintf("%7s", $call_time_MS);
-		$G = '';		$EG = '';
-		if ($call_time_M_int >= 5) {$G=''; $EG='';}
-		if ($call_time_M_int >= 10) {$G=''; $EG='';}
-		if (eregi("PAUSED",$row[4])) 
-			{
-			if ($call_time_M_int >= 1) 
-				{$i++; continue;} 
-			else
-				{$G=''; $EG='';}
-			}
-
-		$agentcount++;
-		echo "| $G$extension$EG | $G$user$EG | $G$sessionid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
-
-		$i++;
-		}
-
-		echo "+------------|--------+-----------+------------+--------+---------------------+---------+\n";
-		echo "  $agentcount agents logged in on server $server_ip\n\n";
-
-		echo "             - Paused agents\n";
-		echo "             - 5 minutes or more on call\n";
-		echo "             - Over 10 minutes on call\n";
-
-	}
-	else
-	{
-	echo "**************************************************************************************\n";
-	echo "**************************************************************************************\n";
-	echo "********************************* NO AGENTS ON CALLS *********************************\n";
-	echo "**************************************************************************************\n";
-	echo "**************************************************************************************\n";
-	}
-
-
-###################################################################################
-###### OUTBOUND CALLS
-###################################################################################
-echo "\n\n";
-echo "----------------------------------------------------------------------------------------";
-echo "\n\n";
-echo "VICIDIAL: Time On VDAD                                              $NOW_TIME\n\n";
-echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
-echo "| CHANNEL    | STATUS | CAMPAIGN | PHONE NUMBER       | START TIME          | MINUTES |\n";
-echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
-
-#$link=mysql_connect("localhost", "cron", "1234");
-# $linkX=mysql_connect("localhost", "cron", "1234");
-#mysql_select_db("asterisk");
-
-$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by auto_call_id;";
-$rslt=mysql_query($stmt, $link);
-if ($DB) {echo "$stmt\n";}
-$parked_to_print = mysql_num_rows($rslt);
-	if ($parked_to_print > 0)
-	{
-	$i=0;
-	while ($i < $parked_to_print)
-		{
-		$row=mysql_fetch_row($rslt);
-
-		$channel =			sprintf("%-10s", $row[0]);
-			$cc=0;
-		while ( (strlen($channel) > 10) and ($cc < 100) )
-			{
-			$channel = eregi_replace(".$","",$channel);   
-			$cc++;
-			if (strlen($channel) <= 10) {$cc=101;}
-			}
-		$status =			sprintf("%-6s", $row[1]);
-		$campaign =			sprintf("%-8s", $row[2]);
-			$all_phone = "$row[3]$row[4]";
-		$number_dialed =	sprintf("%-18s", $all_phone);
-		$start_time =		sprintf("%-19s", $row[5]);
-		$call_time_S = ($STARTtime - $row[6]);
-
-		$call_time_M = ($call_time_S / 60);
-		$call_time_M = round($call_time_M, 2);
-		$call_time_M_int = intval("$call_time_M");
-		$call_time_SEC = ($call_time_M - $call_time_M_int);
-		$call_time_SEC = ($call_time_SEC * 60);
-		$call_time_SEC = round($call_time_SEC, 0);
-		if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
-		$call_time_MS = "$call_time_M_int:$call_time_SEC";
-		$call_time_MS =		sprintf("%7s", $call_time_MS);
-		$G = '';		$EG = '';
-		if (eregi("LIVE",$status)) {$G=''; $EG='';}
-	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
-
-		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
-
-		$i++;
-		}
-
-		echo "+------------+--------+----------+--------------------+---------------------+---------+\n";
-		echo "  $i calls being placed on server $server_ip\n\n";
-
-		echo "             - LIVE CALL WAITING\n";
-	#	echo "             - Over 5 minutes on hold\n";
-
-		}
-	else
-	{
-	echo "***************************************************************************************\n";
-	echo "***************************************************************************************\n";
-	echo "******************************* NO LIVE CALLS WAITING *********************************\n";
-	echo "***************************************************************************************\n";
-	echo "***************************************************************************************\n";
-	}
-
-
-?>
-
- - diff --git a/agc_2-X/trunk/www/vicidial/AST_timeonVDAD_closer.php b/agc_2-X/trunk/www/vicidial/AST_timeonVDAD_closer.php index 23eb851e..a7179efc 100644 --- a/agc_2-X/trunk/www/vicidial/AST_timeonVDAD_closer.php +++ b/agc_2-X/trunk/www/vicidial/AST_timeonVDAD_closer.php @@ -9,6 +9,7 @@ # # 60620-1037 - Added variable filtering to eliminate SQL injection attack threat # - Added required user/pass to gain access to this page +# 61114-2004 - Changed to display CLOSER and DEFAULT, added trunk shortage # header ("Content-type: text/html; charset=utf-8"); @@ -20,12 +21,14 @@ $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; $PHP_SELF=$_SERVER['PHP_SELF']; if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} -if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} - elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} -if (isset($_GET["submit"])) {$submit=$_GET["submit"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} -if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["closer_display"])) {$closer_display=$_GET["closer_display"];} + elseif (isset($_POST["closer_display"])) {$closer_display=$_POST["closer_display"];} $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -74,47 +77,76 @@ if ($reset_counter > 7) \n"; echo " \n"; -echo"\n"; +echo"\n"; echo "VICIDIAL: Time On VDAD\n"; echo "
";
 
+###################################################################################
+###### SERVER INFORMATION
+###################################################################################
+
+$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where server_ip='" . mysql_real_escape_string($server_ip) . "';";
+$rslt=mysql_query($stmt, $link);
+$row=mysql_fetch_row($rslt);
+$balanceSHORT = $row[0];
+
+echo "SERVER: $server_ip\n";
+
+
+
 ###################################################################################
 ###### TIME ON SYSTEM
 ###################################################################################
 
-echo "VICIDIAL: Agents Time On Calls                         $NOW_TIME    REPORTS\n\n";
+if ($closer_display>0) {$closer_display_reverse=0;   $closer_reverse_link='DEFAULT';}
+else {$closer_display_reverse=1;   $closer_reverse_link='CLOSER';}
+
+echo "VICIDIAL: Agents Time On Calls           $NOW_TIME    $closer_reverse_link | REPORTS\n\n";
+
+if ($closer_display>0)
+{
 echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
 echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES | CAMPAIGN     | FRONT  |\n";
 echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
-
+}
+else
+{
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+}
 
 $stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by extension;";
 $rslt=mysql_query($stmt, $link);
@@ -168,55 +200,83 @@ $talking_to_print = mysql_num_rows($rslt);
 		if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
 		$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
 		$call_time_MS[$i] =		sprintf("%7s", $call_time_MS[$i]);
+
+		if ($closer_display<1)
+			{
+			$G = '';		$EG = '';
+			if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+			if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+			if (eregi("PAUSED",$row[4])) 
+				{
+				if ($call_time_M_int >= 1) 
+					{$i++; continue;} 
+				else
+					{$G=''; $EG='';}
+				}
+			$agentcount++;
+			echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG |\n";
+			}
 		$i++;
 		}
-		$ext_count = $i;
-		$i=0;
-	while ($i < $ext_count)
+
+		if ($closer_display>0)
 		{
 
-		$stmt="select campaign_id from vicidial_auto_calls where lead_id='$lead_id[$i]' and server_ip='" . mysql_real_escape_string($server_ip) . "';";
-		$rslt=mysql_query($stmt, $link);
-		if ($DB) {echo "$stmt\n";}
-		$camp_to_print = mysql_num_rows($rslt);
-		if ($camp_to_print > 0)
+			$ext_count = $i;
+			$i=0;
+		while ($i < $ext_count)
 			{
-			$row=mysql_fetch_row($rslt);
-			$campaign = sprintf("%-12s", $row[0]);
-			$camp_color = $row[0];
+
+			$stmt="select campaign_id from vicidial_auto_calls where lead_id='$lead_id[$i]' and server_ip='" . mysql_real_escape_string($server_ip) . "';";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$camp_to_print = mysql_num_rows($rslt);
+			if ($camp_to_print > 0)
+				{
+				$row=mysql_fetch_row($rslt);
+				$campaign = sprintf("%-12s", $row[0]);
+				$camp_color = $row[0];
+				}
+			else
+				{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
+			if (eregi("READY|PAUSED|CLOSER",$status[$i]))
+				{$campaign = '            ';   	$camp_color = '';}
+
+			$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$xfer_to_print = mysql_num_rows($rslt);
+			if ($xfer_to_print > 0)
+				{
+				$row=mysql_fetch_row($rslt);
+				$fronter = sprintf("%-6s", $row[0]);
+				}
+			else
+				{$fronter = '      ';}
+
+			$G = '';		$EG = '';
+			$G=""; $EG='';
+		#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+		#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+
+			echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
+
+			$i++;
 			}
-		else
-			{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
-		if (eregi("READY|PAUSED|CLOSER",$status[$i]))
-			{$campaign = '            ';   	$camp_color = '';}
-
-		$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
-		$rslt=mysql_query($stmt, $link);
-		if ($DB) {echo "$stmt\n";}
-		$xfer_to_print = mysql_num_rows($rslt);
-		if ($xfer_to_print > 0)
-			{
-			$row=mysql_fetch_row($rslt);
-			$fronter = sprintf("%-6s", $row[0]);
-			}
-		else
-			{$fronter = '      ';}
-
-		$G = '';		$EG = '';
-		$G=""; $EG='';
-	#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
-	#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
-
-		echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
-
-		$i++;
-		}
-
 		echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
 		echo "  $i agents logged in on server $server_ip\n\n";
-
 	#	echo "             - 5 minutes or more on call\n";
 	#	echo "             - Over 10 minutes on call\n";
+		}
+	else
+		{
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+		echo "  $agentcount agents logged in on server $server_ip\n\n";
+
+		echo "             - Paused agents\n";
+		echo "             - 5 minutes or more on call\n";
+		echo "             - Over 10 minutes on call\n";
+		}
 
 	}
 	else
@@ -235,15 +295,11 @@ $talking_to_print = mysql_num_rows($rslt);
 #echo "\n\n";
 echo "----------------------------------------------------------------------------------------";
 echo "\n\n";
-echo "VICIDIAL: Time On VDAD                                              $NOW_TIME\n\n";
+echo "VICIDIAL: Time On VDAD            TRUNK SHORT: $balanceSHORT              $NOW_TIME\n\n";
 echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
 echo "| CHANNEL             | STATUS | CAMPAIGN     | PHONE NUMBER       | CALLTIME | MINUTES |\n";
 echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
 
-#$link=mysql_connect("localhost", "cron", "1234");
-# $linkX=mysql_connect("localhost", "cron", "1234");
-#mysql_select_db("asterisk");
-
 $stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by auto_call_id desc;";
 $rslt=mysql_query($stmt, $link);
 if ($DB) {echo "$stmt\n";}