Added --wait-pause-code-swap option to cleanup-agent script
git-svn-id: svn://192.168.202.10@3930 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
# 201106-2146 - Added EXITEMPTY verb for queue_log cleanup section
|
||||
# 210523-2321 - Added optional check for qa_data duplicates, -qm-qa-duplicate-check
|
||||
# 220206-0714 - Added new -roll-back-preview-skips function to roll back the last_local_call_time and called_count for leads that were previewed and not dialed
|
||||
# 250625-2329 - Added --wait-pause-code-swap option
|
||||
#
|
||||
|
||||
# constants
|
||||
@@ -87,6 +88,7 @@ if (length($ARGV[0])>1)
|
||||
print " [-only-check-vicidial-log-agent] = will check for missing agent log entries\n";
|
||||
print " [-only-hold-cleanup] = will look for hold entries and correct agent log wait/talk times\n";
|
||||
print " [-roll-back-preview-skips] = roll back the last_local_call_time and called_count for leads that were previewed and not dialed\n";
|
||||
print " [-wait-pause-code-swap] = search for log wait times with 0-1 second of pause time and swap the wait time to pause\n";
|
||||
print " [-run-check] = concurrency check, die if another instance is running\n";
|
||||
print " [-quiet] = quiet, no output\n";
|
||||
print " [-test] = test\n";
|
||||
@@ -222,6 +224,11 @@ if (length($ARGV[0])>1)
|
||||
$roll_back_preview_skips=1;
|
||||
if ($Q < 1) {print "\n----- ROLL BACK PREVIEW SKIPS: $roll_back_preview_skips -----\n\n";}
|
||||
}
|
||||
if ($args =~ /-wait-pause-code-swap/i)
|
||||
{
|
||||
$wait_pause_code_swap=1;
|
||||
if ($Q < 1) {print "\n----- WAIT PAUSE CODE SWAP: $wait_pause_code_swap -----\n\n";}
|
||||
}
|
||||
if ($args =~ /-run-check/i)
|
||||
{
|
||||
$run_check=1;
|
||||
@@ -837,6 +844,60 @@ if ($roll_back_preview_skips > 0)
|
||||
|
||||
|
||||
|
||||
|
||||
### BEGIN check for pause code entries with 0-1 seconds of pause time and long wait time to swap
|
||||
if ($wait_pause_code_swap > 0)
|
||||
{
|
||||
if ($DB) {print " - check for pause code entries with 0-1 seconds of pause time and long wait time to swap \n";}
|
||||
$stmtA = "SELECT user,agent_log_id,pause_epoch,wait_epoch,talk_epoch,UNIX_TIMESTAMP(event_time),pause_sec,wait_sec,sub_status,event_time from vicidial_agent_log where sub_status NOT IN ('BLANK','ADDIAL','ANDIAL','LAGGED','LOGIN','NXDIAL') and sub_status IS NOT NULL and pause_sec=0 and wait_sec > 10 $VDAD_SQL_time;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if($DBX){print STDERR "\n$sthArows|$stmtA|\n";}
|
||||
$i=0;
|
||||
while ($sthArows > $i)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$swap_user[$i] = $aryA[0];
|
||||
$swap_agent_log_id[$i] = $aryA[1];
|
||||
$swap_pause_epoch[$i] = $aryA[2];
|
||||
$swap_wait_epoch[$i] = $aryA[3];
|
||||
$swap_talk_epoch[$i] = $aryA[4];
|
||||
$swap_event_epoch[$i] = $aryA[5];
|
||||
$swap_pause_sec[$i] = $aryA[6];
|
||||
$swap_wait_sec[$i] = $aryA[7];
|
||||
$swap_sub_status[$i] = $aryA[8];
|
||||
$swap_call_date[$i] = $aryA[9];
|
||||
|
||||
if ($DBX) {print "$i $swap_user[$i] $swap_agent_log_id[$i] $swap_pause_epoch[$i] $swap_wait_epoch[$i] $swap_talk_epoch[$i] $swap_event_epoch[$i] $swap_pause_sec[$i] $swap_wait_sec[$i] $swap_sub_status[$i] $swap_call_date[$i] \n";}
|
||||
$i++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
$i=0;
|
||||
while ($sthArows > $i)
|
||||
{
|
||||
$NEWwait_epoch = ($swap_pause_epoch[$i] + $swap_wait_sec[$i]);
|
||||
##### update vicidial_agent_log record
|
||||
$stmtAX = "UPDATE vicidial_agent_log SET pause_sec='$swap_wait_sec[$i]',wait_sec='0',wait_epoch='$NEWwait_epoch' WHERE agent_log_id='$swap_agent_log_id[$i]';";
|
||||
if ($TEST < 1)
|
||||
{$VALaffected_rows = $dbhA->do($stmtAX);}
|
||||
if ($DB) {print " SWAP record updated: $VALaffected_rows|$stmtAX|\n";}
|
||||
$i++;
|
||||
}
|
||||
if ($DB > 0)
|
||||
{
|
||||
print "DONE: SWAPPED: $i \n";
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
### END check for pause code entries with 0-1 seconds of pause time and long wait time to swap
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### BEGIN check for vicidial_log entries with a user with no vicidial_agent_log entry
|
||||
if ($vl_val_check > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user