diff --git a/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php b/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php index 94440370..855319c4 100644 --- a/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php +++ b/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php @@ -4,6 +4,8 @@ # Copyright (C) 2006 Matt Florell LICENSE: GPLv2 # # live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# STOP=4000, SLOW=40, GO=4 seconds refresh interval # # changes: # 50406-0920 - Added Paused agents < 1 min (Chris Doyle) @@ -18,6 +20,7 @@ # 60905-1342 - Fixed non INCALL|QUEUE timer column # 61002-1642 - Added TRUNK SHORT/FILL stats # 61101-1318 - Added SIP and IAX Listen and Barge links option +# 61101-1647 - Added Usergroup column and user name option as well as sorting # header ("Content-type: text/html; charset=utf-8"); @@ -35,6 +38,8 @@ 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["usergroup"])) {$usergroup=$_GET["usergroup"];} + elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];} if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} @@ -47,9 +52,21 @@ if (isset($_GET["SIPmonitorLINK"])) {$SIPmonitorLINK=$_GET["SIPmonitorLINK"]; elseif (isset($_POST["SIPmonitorLINK"])) {$SIPmonitorLINK=$_POST["SIPmonitorLINK"];} if (isset($_GET["IAXmonitorLINK"])) {$IAXmonitorLINK=$_GET["IAXmonitorLINK"];} elseif (isset($_POST["IAXmonitorLINK"])) {$IAXmonitorLINK=$_POST["IAXmonitorLINK"];} +if (isset($_GET["UGdisplay"])) {$UGdisplay=$_GET["UGdisplay"];} + elseif (isset($_POST["UGdisplay"])) {$UGdisplay=$_POST["UGdisplay"];} +if (isset($_GET["UidORname"])) {$UidORname=$_GET["UidORname"];} + elseif (isset($_POST["UidORname"])) {$UidORname=$_POST["UidORname"];} +if (isset($_GET["orderby"])) {$orderby=$_GET["orderby"];} + elseif (isset($_POST["orderby"])) {$orderby=$_POST["orderby"];} -if (!isset($group)) {$group='';} + +if (!isset($RR)) {$gRRroup=4;} +if (!isset($group)) {$group='';} +if (!isset($usergroup)) {$usergroup='';} +if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes +if (!isset($UidORname)) {$UidORname=0;} # 0=id, 1=name +if (!isset($orderby)) {$orderby='timeup';} function get_server_load($windows = false) { $os = strtolower(PHP_OS); @@ -128,6 +145,19 @@ while ($i < $groups_to_print) $i++; } +$stmt="select * from vicidial_user_groups;"; +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$usergroups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $usergroups_to_print) + { + $row=mysql_fetch_row($rslt); + $usergroups[$i] =$row[0]; + $i++; + } + if (!isset($RR)) {$RR=40;} $NFB = ''; @@ -147,37 +177,48 @@ if ($reset_counter > 7) \n"; -echo"\n"; +echo"\n"; echo "VICIDIAL: Time On VDAD Campaign: $group\n"; echo "
\n"; echo "VICIDIAL: Realtime Campaign: \n"; -echo "\n"; +echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; echo "\n"; $o++; } echo "\n"; +if ($UGdisplay > 0) + { + echo "\n"; + } echo "         \n"; -echo "STOP | SLOW | GO"; +echo "STOP | "; +echo "SLOW | "; +echo "GO"; echo "       MODIFY | REPORTS \n"; echo "\n\n"; @@ -196,6 +252,10 @@ if (!$group) {echo "

please select a campaign from the pulldown above 0) ) else {$diffpctONEMIN = '0.00';} $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;"; + } $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $balanceSHORT = $row[0]; @@ -248,7 +320,7 @@ echo "
"; echo ""; echo ""; echo ""; -echo ""; +echo ""; echo ""; echo ""; @@ -290,13 +362,31 @@ echo ""; echo ""; +echo ""; +echo ""; - echo ""; - echo ""; + echo "+ VIEW MORE SETTINGS"; } - +if ($UGdisplay>0) + { + echo "       HIDE USER GROUP"; + } +else + { + echo "       VIEW USER GROUP"; + } +if ($UidORname>0) + { + echo "       SHOW AGENT ID"; + } +else + { + echo "       SHOW AGENT NAME"; + } +echo ""; +echo ""; echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME TIME:   $NOW_TIME
DIFF: echo "ORDER:  $DIALorder    
"; + if ($adastats<2) { - echo "
+ VIEW MORE SETTINGS
"; echo "
\n\n"; @@ -316,7 +406,12 @@ if (eregi("CLOSER",$group)) $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) . "';";} + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} + else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;"; + } $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $parked_to_print = mysql_num_rows($rslt); @@ -374,21 +469,68 @@ $agent_total=0; $Aecho = ''; $Aecho .= "VICIDIAL: Agents Time On Calls Campaign: $group $NOW_TIME\n\n"; -if ( ($SIPmonitorLINK>0) or ($IAXmonitorLINK>0) ) + +if ($UGdisplay > 0) { - $Aecho .= "+------------|--------+------------------+-------+--------+-----------------+-----------------+---------+------------+\n"; - $Aecho .= "| STATION | USER | SESSIONID | BARGE | STATUS | SERVER IP | CALL SERVER IP | MM:SS | CAMPAIGN |\n"; - $Aecho .= "+------------|--------+------------------+-------+--------+-----------------+-----------------+---------+------------+\n"; + if ( ($SIPmonitorLINK>0) or ($IAXmonitorLINK>0) ) + { + $Aline = "+------------|------------+--------------+------------------+-------+--------+-----------------+-----------------+---------+------------+\n"; + $Aecho .= "$Aline"; + $Aecho .= "| STATION | USER | USER GROUP | SESSIONID | BARGE | STATUS | SERVER IP | CALL SERVER IP | MM:SS | CAMPAIGN |\n"; + $Aecho .= "$Aline"; + } + else + { + $Aline = "+------------|------------+--------------+-----------+--------+-----------------+-----------------+---------+------------+\n"; + $Aecho .= "$Aline"; + $Aecho .= "| STATION | USER | USER GROUP | SESSIONID | STATUS | SERVER IP | CALL SERVER IP | MM:SS | CAMPAIGN |\n"; + $Aecho .= "$Aline"; + } } else { - $Aecho .= "+------------|--------+-----------+--------+-----------------+-----------------+---------+------------+\n"; - $Aecho .= "| STATION | USER | SESSIONID | STATUS | SERVER IP | CALL SERVER IP | MM:SS | CAMPAIGN |\n"; - $Aecho .= "+------------|--------+-----------+--------+-----------------+-----------------+---------+------------+\n"; + if ( ($SIPmonitorLINK>0) or ($IAXmonitorLINK>0) ) + { + $Aline = "+------------|------------+------------------+-------+--------+-----------------+-----------------+---------+------------+\n"; + $Aecho .= "$Aline"; + $Aecho .= "| STATION | USER | SESSIONID | BARGE | STATUS | SERVER IP | CALL SERVER IP | MM:SS | CAMPAIGN |\n"; + $Aecho .= "$Aline"; + } + else + { + $Aline = "+------------|------------+-----------+--------+-----------------+-----------------+---------+------------+\n"; + $Aecho .= "$Aline"; + $Aecho .= "| STATION | USER | SESSIONID | STATUS | SERVER IP | CALL SERVER IP | MM:SS | CAMPAIGN |\n"; + $Aecho .= "$Aline"; + } } +if ($orderby=='timeup') {$orderSQL='status,last_call_time';} +if ($orderby=='timedown') {$orderSQL='status desc,last_call_time desc';} +if ($orderby=='campaignup') {$orderSQL='campaign_id,status,last_call_time';} +if ($orderby=='campaigndown') {$orderSQL='campaign_id desc,status desc,last_call_time desc';} +if ($orderby=='groupup') {$orderSQL='user_group,status,last_call_time';} +if ($orderby=='groupdown') {$orderSQL='user_group desc,status desc,last_call_time desc';} +if ($UidORname > 0) + { + if ($orderby=='userup') {$orderSQL='full_name,status,last_call_time';} + if ($orderby=='userdown') {$orderSQL='full_name desc,status desc,last_call_time desc';} + } +else + { + if ($orderby=='userup') {$orderSQL='vicidial_live_agents.user';} + if ($orderby=='userdown') {$orderSQL='vicidial_live_agents.user desc';} + } + +if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} +else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} +if (strlen($usergroup)<1) {$usergroupSQL = '';} +else {$usergroupSQL = " and user_group='" . mysql_real_escape_string($usergroup) . "'";} + +$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user $groupSQL $usergroupSQL order by $orderSQL;"; + +#$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user and campaign_id='" . mysql_real_escape_string($group) . "' order by $orderSQL;"; -$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); @@ -406,13 +548,25 @@ $talking_to_print = mysql_num_rows($rslt); $extension = eregi_replace('Local/',"",$row[0]); $extension = sprintf("%-10s", $extension); while(strlen($extension)>10) {$extension = substr("$extension", 0, -1);} - $user = sprintf("%-6s", $row[1]); + $Luser = $row[1]; + $user = sprintf("%-10s", $row[1]); $Lsessionid = $row[2]; $sessionid = sprintf("%-9s", $row[2]); + $Lstatus = $row[3]; $status = sprintf("%-6s", $row[3]); $server_ip = sprintf("%-15s", $row[4]); $call_server_ip = sprintf("%-15s", $row[7]); $campaign_id = sprintf("%-10s", $row[8]); + if ($UGdisplay > 0) + { + $user_group = sprintf("%-12s", $row[9]); + while(strlen($user_group)>12) {$user_group = substr("$user_group", 0, -1);} + } + if ($UidORname > 0) + { + $user = sprintf("%-10s", $row[10]); + while(strlen($user)>10) {$user = substr("$user", 0, -1);} + } if (!eregi("INCALL|QUEUE",$row[3])) {$call_time_S = ($STARTtime - $row[6]);} else @@ -428,21 +582,37 @@ $talking_to_print = mysql_num_rows($rslt); $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 ($Lstatus=='INCALL') + { + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$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 >= 5) + if ($call_time_M_int >= 30) {$i++; continue;} else - {$G=''; $EG=''; $agent_paused++; $agent_total++;} + { + $agent_paused++; $agent_total++; + $G=''; $EG=''; + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } } # 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='';} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) + { + $G=''; $EG=''; + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } $L=''; $R=''; @@ -451,27 +621,29 @@ $talking_to_print = mysql_num_rows($rslt); if ($SIPmonitorLINK>1) {$R=" | BARGE";} if ($IAXmonitorLINK>1) {$R=" | BARGE";} + if ($UGdisplay > 0) {$UGD = " $G$user_group$EG |";} + else {$UGD = "";} + $agentcount++; - $Aecho .= "| $G$extension$EG | $G$user$EG | $G$sessionid$EG$L$R | $G$status$EG | $G$server_ip$EG | $G$call_server_ip$EG | $G$call_time_MS$EG | $G$campaign_id$EG |\n"; + $Aecho .= "| $G$extension$EG | $G$user$EG |$UGD $G$sessionid$EG$L$R | $G$status$EG | $G$server_ip$EG | $G$call_server_ip$EG | $G$call_time_MS$EG | $G$campaign_id$EG |\n"; $i++; } - if ( ($SIPmonitorLINK>0) or ($IAXmonitorLINK>0) ) - { - $Aecho .= "+------------|--------+------------------+-------+--------+-----------------+-----------------+---------+------------+\n"; - } - else - { - $Aecho .= "+------------|--------+-----------+--------+-----------------+-----------------+---------+------------+\n"; - } + $Aecho .= "$Aline"; $Aecho .= " $agentcount agents logged in on all servers\n"; $Aecho .= " System Load Average: $load_ave\n\n"; - $Aecho .= " - Paused agents\n"; # $Aecho .= " - Balanced call\n"; - $Aecho .= " - Agent waiting for call\n"; - $Aecho .= " - Over 5 minutes on call\n"; + $Aecho .= " - Agent waiting for call\n"; + $Aecho .= " - Agent waiting for call > 1 minute\n"; + $Aecho .= " - Agent waiting for call > 5 minutes\n"; + $Aecho .= " - Agent on call > 10 seconds\n"; + $Aecho .= " - Agent on call > 1 minute\n"; + $Aecho .= " - Agent on call > 5 minutes\n"; + $Aecho .= " - Agent Paused > 10 seconds\n"; + $Aecho .= " - Agent Paused > 1 minute\n"; + $Aecho .= " - Agent Paused > 5 minutes\n"; if ($agent_ready > 0) {$B=''; $BG='';} if ($agent_ready > 4) {$B=''; $BG='';}