Added PARK status to Real-time report, added LAGGED pause code to auto-paused agent records
git-svn-id: svn://192.168.202.10@1219 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -80,6 +80,7 @@
|
||||
# 90630-2252 - Added Sangoma CDP pre-Answer call processing
|
||||
# 90816-0057 - Changed default vicidial_log time to 0 from 1 second
|
||||
# 90827-1227 - Added list_id logging in vicidial_log on NA calls
|
||||
# 90907-0919 - Added LAGGED pause code update for paused agents, reduced logging if no issues
|
||||
#
|
||||
|
||||
|
||||
@@ -1237,10 +1238,16 @@ while($one_day_interval > 0)
|
||||
if ($KLcallerid[$kill_vac] !~ /^M\d\d\d\d\d\d\d\d\d\d/)
|
||||
{
|
||||
$stmtA = "UPDATE vicidial_live_agents set status='PAUSED',random_id='10' where callerid='$KLcallerid[$kill_vac]';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$Vaffected_rows = $dbhA->do($stmtA);
|
||||
|
||||
$event_string = "| dead call vla agent PAUSED $affected_rows|$CLlead_id|$CLphone_number|$CLstatus|";
|
||||
&event_logger;
|
||||
if ($Vaffected_rows > 0)
|
||||
{
|
||||
$stmtA = "UPDATE vicidial_agent_log set sub_status='LAGGED' where agent_log_id IN(SELECT agent_log_id from vicidial_live_agents where callerid='$KLcallerid[$kill_vac]');";
|
||||
$VLaffected_rows = $dbhA->do($stmtA);
|
||||
|
||||
$event_string = "| dead call vla agent PAUSED $Vaffected_rows|$VLaffected_rows|$CLlead_id|$CLphone_number|$CLstatus|";
|
||||
&event_logger;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ($enable_queuemetrics_logging > 0) && ($CLstatus =~ /LIVE/) )
|
||||
@@ -1549,67 +1556,89 @@ while($one_day_interval > 0)
|
||||
|
||||
|
||||
### pause agents that have disconnected or closed their apps over 30 seconds ago
|
||||
$stmtA = "UPDATE vicidial_live_agents set status='PAUSED',random_id='10' where server_ip='$server_ip' and last_update_time < '$PDtsSQLdate' and status NOT IN('PAUSED')";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
|
||||
$event_string = "| lagged call vla agent PAUSED $affected_rows|$PDtsSQLdate|$BDtsSQLdate|$tsSQLdate|";
|
||||
&event_logger;
|
||||
|
||||
if ($affected_rows > 0)
|
||||
$toPAUSEcount=0;
|
||||
$stmtA = "SELECT count(*) FROM vicidial_live_agents where server_ip='$server_ip' and last_update_time < '$PDtsSQLdate' and status NOT IN('PAUSED');";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsC=$sthA->rows;
|
||||
if ($sthArowsC > 0)
|
||||
{
|
||||
@VALOuser=@MT; @VALOcampaign=@MT; @VALOtimelog=@MT; @VALOextension=@MT;
|
||||
$logcount=0;
|
||||
$stmtA = "SELECT user,campaign_id,last_update_time,extension FROM vicidial_live_agents where server_ip='$server_ip' and status = 'PAUSED' and random_id='10' order by last_update_time desc limit $affected_rows";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$rec_count=0;
|
||||
$rec_countCUSTDATA=0;
|
||||
while ($sthArows > $rec_count)
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$toPAUSEcount = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
$affected_rows=0;
|
||||
|
||||
if ($toPAUSEcount > 0)
|
||||
{
|
||||
$stmtA = "UPDATE vicidial_agent_log set sub_status='LAGGED' where agent_log_id IN(SELECT agent_log_id from vicidial_live_agents where server_ip='$server_ip' and last_update_time < '$PDtsSQLdate' and status NOT IN('PAUSED'));";
|
||||
$VLaffected_rows = $dbhA->do($stmtA);
|
||||
|
||||
$stmtA = "UPDATE vicidial_live_agents set status='PAUSED',random_id='10' where server_ip='$server_ip' and last_update_time < '$PDtsSQLdate' and status NOT IN('PAUSED');";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
|
||||
$event_string = "| lagged call vla agent PAUSED $affected_rows|$VLaffected_rows|$PDtsSQLdate|$BDtsSQLdate|$tsSQLdate|";
|
||||
&event_logger;
|
||||
|
||||
if ($affected_rows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VALOuser[$logcount] = "$aryA[0]";
|
||||
$VALOcampaign[$logcount] = "$aryA[1]";
|
||||
$VALOtimelog[$logcount] = "$aryA[2]";
|
||||
$VALOextension[$logcount] = "$aryA[3]";
|
||||
$logcount++;
|
||||
$rec_count++;
|
||||
}
|
||||
$sthA->finish();
|
||||
$logrun=0;
|
||||
foreach(@VALOuser)
|
||||
{
|
||||
$VALOuser_group='';
|
||||
$stmtA = "SELECT user_group FROM vicidial_users where user='$VALOuser[$logrun]';";
|
||||
@VALOuser=@MT; @VALOcampaign=@MT; @VALOtimelog=@MT; @VALOextension=@MT;
|
||||
$logcount=0;
|
||||
$stmtA = "SELECT user,campaign_id,last_update_time,extension FROM vicidial_live_agents where server_ip='$server_ip' and status = 'PAUSED' and random_id='10' order by last_update_time desc limit $affected_rows";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$UGrec_count=0;
|
||||
while ($sthArows > $UGrec_count)
|
||||
$rec_count=0;
|
||||
$rec_countCUSTDATA=0;
|
||||
while ($sthArows > $rec_count)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VALOuser_group = "$aryA[0]";
|
||||
$UGrec_count++;
|
||||
$VALOuser[$logcount] = "$aryA[0]";
|
||||
$VALOcampaign[$logcount] = "$aryA[1]";
|
||||
$VALOtimelog[$logcount] = "$aryA[2]";
|
||||
$VALOextension[$logcount] = "$aryA[3]";
|
||||
$logcount++;
|
||||
$rec_count++;
|
||||
}
|
||||
$sthA->finish();
|
||||
$stmtA = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VALOuser[$logrun]','LOGOUT','$VALOcampaign[$logrun]','$SQLdate','$now_date_epoch','$VALOuser_group');";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$logrun=0;
|
||||
foreach(@VALOuser)
|
||||
{
|
||||
$VALOuser_group='';
|
||||
$stmtA = "SELECT user_group FROM vicidial_users where user='$VALOuser[$logrun]';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$UGrec_count=0;
|
||||
while ($sthArows > $UGrec_count)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VALOuser_group = "$aryA[0]";
|
||||
$UGrec_count++;
|
||||
}
|
||||
$sthA->finish();
|
||||
$stmtA = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VALOuser[$logrun]','LOGOUT','$VALOcampaign[$logrun]','$SQLdate','$now_date_epoch','$VALOuser_group');";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
|
||||
$event_string = "| lagged agent LOGOUT entry inserted $VALOuser[$logrun]|$VALOcampaign[$logrun]|$VALOextension[$logcount]|";
|
||||
&event_logger;
|
||||
$event_string = "| lagged agent LOGOUT entry inserted $VALOuser[$logrun]|$VALOcampaign[$logrun]|$VALOextension[$logcount]|";
|
||||
&event_logger;
|
||||
|
||||
$logrun++;
|
||||
$logrun++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
### delete call records that are SENT for over 2 minutes
|
||||
$stmtA = "DELETE FROM vicidial_auto_calls where server_ip='$server_ip' and call_time < '$XDSQLdate' and status NOT IN('XFER','CLOSER','LIVE','IVR')";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$VACaffected_rows = $dbhA->do($stmtA);
|
||||
|
||||
$event_string = "| lagged call vac agent DELETED $affected_rows|$XDSQLdate|";
|
||||
&event_logger;
|
||||
if ($VACaffected_rows > 0)
|
||||
{
|
||||
$event_string = "| lagged call vac agent DELETED $VACaffected_rows|$XDSQLdate|";
|
||||
&event_logger;
|
||||
}
|
||||
|
||||
|
||||
### For debugging purposes, try to grab Jammed calls and log them to jam logfile
|
||||
|
||||
@@ -54,10 +54,11 @@
|
||||
# 90627-0608 - Some Formatting changes, added in-group name display
|
||||
# 90701-0657 - Fixed inbound=No calculation issues
|
||||
# 90808-0212 - Fixed inbound only non-ALL bug, changed times to use agent last_state_change
|
||||
# 90907-0915 - Added PARK status
|
||||
#
|
||||
|
||||
$version = '2.0.5-45';
|
||||
$build = '90808-0212';
|
||||
$version = '2.0.5-46';
|
||||
$build = '90907-0915';
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
|
||||
@@ -1303,8 +1304,8 @@ $Aecho .= "VICIDIAL: Agents Time On Calls Campaign: $group_string $NO
|
||||
|
||||
$HDbegin = "+";
|
||||
$HTbegin = "|";
|
||||
$HDstation = "------------+";
|
||||
$HTstation = " STATION |";
|
||||
$HDstation = "--------------+";
|
||||
$HTstation = " STATION |";
|
||||
$HDphone = "------------+";
|
||||
$HTphone = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$phoneord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone\">PHONE</a> |";
|
||||
$HDuser = "--------------------+";
|
||||
@@ -1552,14 +1553,14 @@ $calls_to_list = mysql_num_rows($rslt);
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
$extension = eregi_replace('Local/',"",$Aextension[$i]);
|
||||
$extension = sprintf("%-10s", $extension);
|
||||
while(strlen($extension)>10) {$extension = substr("$extension", 0, -1);}
|
||||
$extension = sprintf("%-12s", $extension);
|
||||
while(strlen($extension)>12) {$extension = substr("$extension", 0, -1);}
|
||||
}
|
||||
else
|
||||
{
|
||||
$extension = eregi_replace('Local/',"",$Aextension[$i]);
|
||||
$extension = sprintf("%-40s", $extension);
|
||||
while(mb_strlen($extension, 'utf-8')>10) {$extension = mb_substr("$extension", 0, -1,'utf8');}
|
||||
$extension = sprintf("%-48s", $extension);
|
||||
while(mb_strlen($extension, 'utf-8')>12) {$extension = mb_substr("$extension", 0, -1,'utf8');}
|
||||
}
|
||||
|
||||
$phone = sprintf("%-10s", $phone_split[0]);
|
||||
@@ -1584,12 +1585,25 @@ $calls_to_list = mysql_num_rows($rslt);
|
||||
|
||||
if (eregi("INCALL",$Lstatus))
|
||||
{
|
||||
### temporarily deactivate DEAD calls display until bug is fixed
|
||||
if (!ereg("$Acallerid[$i]\|",$callerids))
|
||||
$stmtP="select count(*) from parked_channels where channel_group='$Acallerid[$i]';";
|
||||
$rsltP=mysql_query($stmtP,$link);
|
||||
$rowP=mysql_fetch_row($rsltP);
|
||||
$parked_channel = $rowP[0];
|
||||
|
||||
if ($parked_channel > 0)
|
||||
{
|
||||
$Astatus[$i] = 'DEAD';
|
||||
$Lstatus = 'DEAD';
|
||||
$status = ' DEAD ';
|
||||
$Astatus[$i] = 'PARK';
|
||||
$Lstatus = 'PARK';
|
||||
$status = ' PARK ';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ereg("$Acallerid[$i]\|",$callerids))
|
||||
{
|
||||
$Astatus[$i] = 'DEAD';
|
||||
$Lstatus = 'DEAD';
|
||||
$status = ' DEAD ';
|
||||
}
|
||||
}
|
||||
|
||||
if ( (eregi("AUTO",$comments)) or (strlen($comments)<1) )
|
||||
@@ -1630,7 +1644,7 @@ $calls_to_list = mysql_num_rows($rslt);
|
||||
while(mb_strlen($user, 'utf-8')>18) {$user = mb_substr("$user", 0, -1,'utf8');}
|
||||
}
|
||||
}
|
||||
if (!eregi("INCALL|QUEUE",$Astatus[$i]))
|
||||
if (!eregi("INCALL|QUEUE|PARK",$Astatus[$i]))
|
||||
{$call_time_S = ($STARTtime - $Astate_change[$i]);}
|
||||
else
|
||||
{$call_time_S = ($STARTtime - $Acall_time[$i]);}
|
||||
@@ -1638,7 +1652,7 @@ $calls_to_list = mysql_num_rows($rslt);
|
||||
$call_time_MS = sec_convert($call_time_S,'M');
|
||||
$call_time_MS = sprintf("%7s", $call_time_MS);
|
||||
$G = ''; $EG = '';
|
||||
if ($Lstatus=='INCALL')
|
||||
if ( ($Lstatus=='INCALL') or ($Lstatus=='PARK') )
|
||||
{
|
||||
if ($call_time_S >= 10) {$G='<SPAN class="thistle"><B>'; $EG='</B></SPAN>';}
|
||||
if ($call_time_S >= 60) {$G='<SPAN class="violet"><B>'; $EG='</B></SPAN>';}
|
||||
@@ -1696,7 +1710,7 @@ $calls_to_list = mysql_num_rows($rslt);
|
||||
# if ( (strlen($Acall_server_ip[$i])> 4) and ($Acall_server_ip[$i] != "$Aserver_ip[$i]") )
|
||||
# {$G='<SPAN class="orange"><B>'; $EG='</B></SPAN>';}
|
||||
|
||||
if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;}
|
||||
if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) or (eregi("PARK",$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)) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user