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 # 60504-2023 - Modified click-to-listen for SIP phones by Angelito Manansala # 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']; $server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} $reset_counter=$_GET["reset_counter"]; if (!$reset_counter) {$reset_counter=$_POST["reset_counter"];} $RR=$_GET["RR"]; if (!$RR) {$RR=$_POST["RR"];} $group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} $DB=$_GET["DB"]; if (!$DB) {$DB=$_POST["DB"];} $submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} $SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} $NOW_TIME = date("Y-m-d 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;"; $rslt=mysql_query($stmt, $link); 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 (!$RR) {$RR=40;} $NFB = ''; $NFE = ''; $F=''; $FG=''; $B=''; $BG=''; $reset_counter++; if ($reset_counter > 7) { $reset_counter=0; } ?> \n"; echo"\n"; echo "VF DIALER: Time On VDAD Campaign: $group\n"; echo "
\n"; echo "VF DIALER: Realtime Campaign: \n"; echo "\n"; echo "\n"; echo "\n"; echo "                   \n"; echo "STOP | GO \n"; echo "           MODIFY \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 from vicidial_campaigns where campaign_id='$group';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); echo "
"; echo "DIAL LEVEL: $row[0]         "; echo "STATUSES: $row[1], $row[2], $row[3], $row[4], $row[5]         "; echo "ORDER: $row[6]"; echo "\n\n"; } ################################################################################### ###### OUTBOUND CALLS ################################################################################### if (eregi("CLOSER",$group)) {$stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and (campaign_id='$group' or campaign_id LIKE \"CL_%\");";} else {$stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and campaign_id='$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 " NO LIVE CALLS WAITING \n"; } ################################################################################### ###### TIME ON SYSTEM ################################################################################### $agent_incall=0; $agent_ready=0; $agent_paused=0; $agent_total=0; $Aecho = ''; $Aecho .= "VF DIALER: Agents Time On Calls Campaign: $group $NOW_TIME\n\n"; $Aecho .= "+------------|--------+------------------+--------+-----------------+-----------------+---------+------------+\n"; $Aecho .= "| STATION | USER | SESSIONID | STATUS | SERVER IP | CALL SERVER 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='$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='';} $sessionid = trim($sessionid); $agentcount++; $Aecho .= "| $G$extension$EG | $G$user$EG | $G$sessionid$EG LISTEN | $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"; $Aecho .= " NOTE: Click LISTERN to monitor agent call, you must have installed softphone on you machine.\n\n"; $Aecho .= " - Paused agents\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 " NO AGENTS ON CALLS \n";
	}

?>