LICENSE: GPLv2 # # live real-time stats for the VICIDIAL Auto-Dialer all servers # # changes: # 50406-0920 - Added Paused agents < 1 min (Chris Doyle) # 51130-1218 - Modified layout and info to show all servers in a vicidial system # 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES # 60511-1343 - Added leads and drop info at the top of the screen # 60608-1539 - Fixed CLOSER tallies for active calls # 60619-1658 - 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["RR"])) {$RR=$_GET["RR"];} elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} if (isset($_GET["group"])) {$group=$_GET["group"];} elseif (isset($_POST["group"])) {$group=$_POST["group"];} if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["submit"])) {$submit=$_GET["submit"];} elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} if (!isset($group)) {$group='';} $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_TIME = date("Y-m-d H:i:s"); $NOW_DAY = date("Y-m-d"); $NOW_HOUR = date("H:i:s"); $STARTtime = date("U"); $epochSIXhoursAGO = ($STARTtime - 21600); $timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); $stmt="select campaign_id from vicidial_campaigns where active='Y';"; $rslt=mysql_query($stmt, $link); if (!isset($DB)) {$DB=0;} if ($DB) {echo "$stmt\n";} $groups_to_print = mysql_num_rows($rslt); $i=0; while ($i < $groups_to_print) { $row=mysql_fetch_row($rslt); $groups[$i] =$row[0]; $i++; } if (!isset($RR)) {$RR=40;} $NFB = ''; $NFE = ''; $F=''; $FG=''; $B=''; $BG=''; $reset_counter++; if (!isset($reset_counter)) {$reset_counter=0;} if ($reset_counter > 7) { $reset_counter=0; } ?> \n"; echo"\n"; echo "VICIDIAL: Time On VDAD Εκστρατεία: $group\n"; echo "
\n"; echo "VICIDIAL: Realtime Εκστρατεία: \n"; echo "\n"; echo "\n"; echo "\n"; echo "         \n"; echo "STOP | GO"; echo "         ΤΡΟΠΟΠΟΙΗΣΗ | ΑΝΑΦΟΡΕΣ \n"; echo "\n\n"; if (!$group) {echo "

please select a campaign from the pulldown above
\n"; exit;} else { $stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $HOPlev = $row[8]; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; $stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $VDhop = $row[0]; $stmt="select dialable_leads,calls_today,drops_today,drops_today_pct from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $DAleads = $row[0]; $callsTODAY = $row[1]; $dropsTODAY = $row[2]; $drpctTODAY = $row[3]; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
DIAL LEVEL:  $row[0]    STATUSES:  $row[1], $row[2], $row[3], $row[4], $row[5]     ORDER:  $row[6]     FILTER:  $row[7]    
HOPPER LEVEL:  $HOPlev     LEADS IN HOPPER:  $VDhop     DIALABLE LEADS:  $DAleads       TIME:
CALLS TODAY:  $callsTODAY     CALLS DROPPED:  $dropsTODAY     DROPPED PERCENT:  $drpctTODAY%       $NOW_TIME
"; echo "\n\n"; } ################################################################################### ###### OUTBOUND CALLS ################################################################################### if (eregi("CLOSER",$group)) { $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); $closer_campaigns = "'$closer_campaigns'"; $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );"; } else {$stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and campaign_id='" . mysql_real_escape_string($group) . "';";} $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $parked_to_print = mysql_num_rows($rslt); if ($parked_to_print > 0) { $i=0; $out_total=0; $out_ring=0; $out_live=0; while ($i < $parked_to_print) { $row=mysql_fetch_row($rslt); if (eregi("LIVE",$row[0])) {$out_live++;} else { if (eregi("CLOSER",$row[0])) {$nothing=1;} else {$out_ring++;} } $out_total++; $i++; } if ($out_live > 0) {$F=''; $FG='';} if ($out_live > 4) {$F=''; $FG='';} if ($out_live > 9) {$F=''; $FG='';} if ($out_live > 14) {$F=''; $FG='';} if (eregi("CLOSER",$group)) {echo "$NFB$out_total$NFE current active calls      \n";} else {echo "$NFB$out_total$NFE calls being placed       \n";} echo "$NFB$out_ring$NFE calls ringing         \n"; echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; } else { echo "ΔΕΝ ΥΠΑΡΧΟΥΝ ΕΝΕΡΓΕΣ ΚΛΗΣΕΙΣ ΣΕ ΑΝΑΜΟΝΗ\n"; } ################################################################################### ###### TIME ON SYSTEM ################################################################################### $agent_incall=0; $agent_ready=0; $agent_paused=0; $agent_total=0; $Aecho = ''; $Aecho .= "VICIDIAL: Agents Time On Calls Εκστρατεία: $group $NOW_TIME\n\n"; $Aecho .= "+------------|--------+-----------+--------+-----------------+-----------------+---------+------------+\n"; $Aecho .= "| STATION | USER | SESSIONID | STATUS | ΔΙΑΚΟΜΙΣΤΗΣ IP | CALL ΔΙΑΚΟΜΙΣΤΗΣ IP | MM:SS | CAMPAIGN |\n"; $Aecho .= "+------------|--------+-----------+--------+-----------------+-----------------+---------+------------+\n"; $stmt="select extension,user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id from vicidial_live_agents where campaign_id='" . mysql_real_escape_string($group) . "' order by status,last_call_time;"; $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[5]=$row[6]; } $extension = sprintf("%-10s", $row[0]); $user = sprintf("%-6s", $row[1]); $sessionid = sprintf("%-9s", $row[2]); $status = sprintf("%-6s", $row[3]); $server_ip = sprintf("%-15s", $row[4]); $call_server_ip = sprintf("%-15s", $row[7]); $campaign_id = sprintf("%-10s", $row[8]); $call_time_S = ($STARTtime - $row[5]); $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[3])) { if ($call_time_M_int >= 1) {$i++; continue;} else {$G=''; $EG=''; $agent_paused++; $agent_total++;} } # if ( (strlen($row[7])> 4) and ($row[7] != "$row[4]") ) # {$G=''; $EG='';} if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$G=''; $EG='';} $agentcount++; $Aecho .= "| $G$extension$EG | $G$user$EG | $G$sessionid$EG | $G$status$EG | $G$server_ip$EG | $G$call_server_ip$EG | $G$call_time_MS$EG | $G$campaign_id$EG |\n"; $i++; } $Aecho .= "+------------|--------+-----------+--------+-----------------+-----------------+---------+------------+\n"; $Aecho .= " $agentcount agents logged in on all servers\n\n"; $Aecho .= " - Χειριστές σε παύση\n"; # $Aecho .= " - Balanced call\n"; $Aecho .= " - Agent waiting for call\n"; $Aecho .= " - Over 5 minutes on call\n"; if ($agent_ready > 0) {$B=''; $BG='';} if ($agent_ready > 4) {$B=''; $BG='';} if ($agent_ready > 9) {$B=''; $BG='';} if ($agent_ready > 14) {$B=''; $BG='';} echo "\n
\n"; echo "$NFB$agent_total$NFE agents logged in         \n"; echo "$NFB$agent_incall$NFE agents in calls       \n"; echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; echo "$NFB$agent_paused$NFE paused agents       \n"; echo "
";
		echo "";
		echo "$Aecho";
	}
	else
	{
	echo " ΚΑΝΕΝΑΣ ΧΕΙΡΙΣΤΗΣ ΣΕ ΚΛΗΣΕΙΣ\n";
	}

?>