From d5413661bb6026a0e1d5750f2500e6debf28a90d Mon Sep 17 00:00:00 2001 From: mattf Date: Thu, 1 Mar 2018 18:45:21 +0000 Subject: [PATCH] Added additional logging for Timeclock end-of-day processes Ssmall changes for Inbound Queue No Dial git-svn-id: svn://192.168.202.10@2932 3d104415-ff17-0410-8863-d5cf3c621b8a --- agi/agi-VDAD_ALL_inbound.agi | 24 ++++++++--------- bin/ADMIN_keepalive_ALL.pl | 52 +++++++++++++++++++++++------------- bin/AST_VDauto_dial.pl | 31 ++++++++++++++++----- 3 files changed, 70 insertions(+), 37 deletions(-) diff --git a/agi/agi-VDAD_ALL_inbound.agi b/agi/agi-VDAD_ALL_inbound.agi index 925fb20d..8f764b50 100644 --- a/agi/agi-VDAD_ALL_inbound.agi +++ b/agi/agi-VDAD_ALL_inbound.agi @@ -5143,9 +5143,9 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override if ( ( length($phone_number) > 6 ) && ( $phone_number > 0) ) { ### insert a record into the vicidial_inbound_callback_queue table - $stmtA = "INSERT INTO vicidial_inbound_callback_queue SET icbq_date=NOW(),icbq_status='NEW',icbq_phone_number='$phone_number',icbq_phone_code='$phone_code',icbq_nextday_choice='U',lead_id='$insert_lead_id',group_id='$channel_group',queue_priority='$queue_priority',call_date='$SQLdateBEGIN',gmt_offset_now='$local_gmt';"; - $affected_rows = $dbhA->do($stmtA); - $dbhP=$dbhA; $mysql_count='02228'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + $stmtC = "INSERT INTO vicidial_inbound_callback_queue SET icbq_date=NOW(),icbq_status='NEW',icbq_phone_number='$phone_number',icbq_phone_code='$phone_code',icbq_nextday_choice='U',lead_id='$insert_lead_id',group_id='$channel_group',queue_priority='$queue_priority',call_date='$SQLdateBEGIN',gmt_offset_now='$local_gmt';"; + $affected_rows = $dbhA->do($stmtC); + $dbhP=$dbhA; $stmtA=$stmtC; $mysql_count='02228'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; $sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -5158,7 +5158,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override } $sthA->finish(); - if ($AGILOG) {$agi_string = "VDAD vicidial_inbound_callback_queue insert |$CALLBACK_insert_icbq_id|$stmtA|"; &agi_output;} + if ($AGILOG) {$agi_string = "VDAD vicidial_inbound_callback_queue insert |$CALLBACK_insert_icbq_id|$stmtC|"; &agi_output;} $DROPexten = "8300"; @@ -5639,9 +5639,9 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override if ( ( length($phone_number) > 6 ) && ( $phone_number > 0) ) { ### insert a record into the vicidial_inbound_callback_queue table - $stmtA = "INSERT INTO vicidial_inbound_callback_queue SET icbq_date=NOW(),icbq_status='NEW',icbq_phone_number='$phone_number',icbq_phone_code='$phone_code',icbq_nextday_choice='U',lead_id='$insert_lead_id',group_id='$channel_group',queue_priority='$queue_priority',call_date='$SQLdateBEGIN',gmt_offset_now='$local_gmt';"; - $affected_rows = $dbhA->do($stmtA); - $dbhP=$dbhA; $mysql_count='02230'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + $stmtC = "INSERT INTO vicidial_inbound_callback_queue SET icbq_date=NOW(),icbq_status='NEW',icbq_phone_number='$phone_number',icbq_phone_code='$phone_code',icbq_nextday_choice='U',lead_id='$insert_lead_id',group_id='$channel_group',queue_priority='$queue_priority',call_date='$SQLdateBEGIN',gmt_offset_now='$local_gmt';"; + $affected_rows = $dbhA->do($stmtC); + $dbhP=$dbhA; $stmtA=$stmtC; $mysql_count='02230'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; $sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -5654,7 +5654,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override } $sthA->finish(); - if ($AGILOG) {$agi_string = "VDAD vicidial_inbound_callback_queue insert |$CALLBACK_insert_icbq_id|$stmtA|"; &agi_output;} + if ($AGILOG) {$agi_string = "VDAD vicidial_inbound_callback_queue insert |$CALLBACK_insert_icbq_id|$stmtC|"; &agi_output;} $DROPexten = "8300"; @@ -6148,9 +6148,9 @@ if ($closing_check > 0) if ( ( length($phone_number) > 6 ) && ( $phone_number > 0) ) { ### insert a record into the vicidial_inbound_callback_queue table - $stmtA = "INSERT INTO vicidial_inbound_callback_queue SET icbq_date=NOW(),icbq_status='NEW',icbq_phone_number='$phone_number',icbq_phone_code='$phone_code',icbq_nextday_choice='U',lead_id='$insert_lead_id',group_id='$channel_group',queue_priority='$queue_priority',call_date='$SQLdateBEGIN',gmt_offset_now='$local_gmt';"; - $affected_rows = $dbhA->do($stmtA); - $dbhP=$dbhA; $mysql_count='02239'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + $stmtC = "INSERT INTO vicidial_inbound_callback_queue SET icbq_date=NOW(),icbq_status='NEW',icbq_phone_number='$phone_number',icbq_phone_code='$phone_code',icbq_nextday_choice='U',lead_id='$insert_lead_id',group_id='$channel_group',queue_priority='$queue_priority',call_date='$SQLdateBEGIN',gmt_offset_now='$local_gmt';"; + $affected_rows = $dbhA->do($stmtC); + $dbhP=$dbhA; $stmtA=$stmtC; $mysql_count='02239'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; $sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -6163,7 +6163,7 @@ if ($closing_check > 0) } $sthA->finish(); - if ($AGILOG) {$agi_string = "VDAD vicidial_inbound_callback_queue insert |$CALLBACK_insert_icbq_id|$stmtA|"; &agi_output;} + if ($AGILOG) {$agi_string = "VDAD vicidial_inbound_callback_queue insert |$CALLBACK_insert_icbq_id|$stmtC|"; &agi_output;} $DROPexten = "8300"; diff --git a/bin/ADMIN_keepalive_ALL.pl b/bin/ADMIN_keepalive_ALL.pl index 4bb9a857..2cfb9174 100644 --- a/bin/ADMIN_keepalive_ALL.pl +++ b/bin/ADMIN_keepalive_ALL.pl @@ -127,9 +127,10 @@ # 171010-2254 - Added process debug with --DebugXXX flag and screen logging # 171221-1628 - Added rolling of vicidial_ingroup_hour_counts records # 180204-0931 - Added rolling of vicidial_inbound_callback_queue records +# 180301-1257 - Added more teodDB logging # -$build = '180204-0931'; +$build = '180301-1257'; $DB=0; # Debug flag $teodDB=0; # flag to log Timeclock End of Day processes to log file @@ -921,7 +922,7 @@ if ($timeclock_auto_logout > 0) `/usr/bin/screen -d -m -S Timeclock $PATHhome/ADMIN_timeclock_auto_logout.pl 2>/dev/null 1>&2`; if ($teodDB) { - $event_string = "running Timeclock auto-logout process|/usr/bin/screen -d -m -S Timeclock $PATHhome/ADMIN_timeclock_auto_logout.pl 2>/dev/null 1>&2"; + $event_string = "running Timeclock auto-logout process $build|/usr/bin/screen -d -m -S Timeclock $PATHhome/ADMIN_timeclock_auto_logout.pl 2>/dev/null 1>&2"; &teod_logger; } } @@ -955,7 +956,7 @@ $sthA->finish(); if ($timeclock_end_of_day_NOW > 0) { - if ($teodDB) {$event_string = "Starting timeclock end of day processes: $stmtA|$timeclock_end_of_day_NOW"; &teod_logger;} + if ($teodDB) {$event_string = "Starting timeclock end of day processes: $stmtA|$timeclock_end_of_day_NOW|$build"; &teod_logger;} $stmtA = "SELECT agents_calls_reset,usacan_phone_dialcode_fix from system_settings;"; if ($DB) {print "|$stmtA|\n";} @@ -1308,10 +1309,11 @@ if ($timeclock_end_of_day_NOW > 0) $stmtA = "INSERT IGNORE INTO vicidial_campaign_hour_counts_archive SELECT * from vicidial_campaign_hour_counts where date_hour < '$today_start';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows = $sthA->rows; - if (!$Q) {print "$sthArows rows inserted into vicidial_campaign_hour_counts_archive table \n";} - + $event_string = "$sthArows rows inserted into vicidial_campaign_hour_counts_archive table"; + if (!$Q) {print "$event_string \n";} + if ($teodDB) {&teod_logger;} + $rv = $sthA->err(); if (!$rv) { @@ -1319,7 +1321,9 @@ if ($timeclock_end_of_day_NOW > 0) $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows = $sthA->rows; - if (!$Q) {print "$sthArows rows deleted from vicidial_campaign_hour_counts table \n";} + $event_string = "$sthArows rows deleted from vicidial_campaign_hour_counts table"; + if (!$Q) {print "$event_string \n";} + if ($teodDB) {&teod_logger;} $stmtA = "optimize table vicidial_campaign_hour_counts;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; @@ -1331,10 +1335,11 @@ if ($timeclock_end_of_day_NOW > 0) $stmtA = "INSERT IGNORE INTO vicidial_carrier_hour_counts_archive SELECT * from vicidial_carrier_hour_counts where date_hour < '$today_start';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows = $sthA->rows; - if (!$Q) {print "$sthArows rows inserted into vicidial_carrier_hour_counts_archive table \n";} - + $event_string = "$sthArows rows inserted into vicidial_carrier_hour_counts_archive table"; + if (!$Q) {print "$event_string \n";} + if ($teodDB) {&teod_logger;} + $rv = $sthA->err(); if (!$rv) { @@ -1342,7 +1347,9 @@ if ($timeclock_end_of_day_NOW > 0) $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows = $sthA->rows; - if (!$Q) {print "$sthArows rows deleted from vicidial_carrier_hour_counts table \n";} + $event_string = "$sthArows rows deleted from vicidial_carrier_hour_counts table"; + if (!$Q) {print "$event_string \n";} + if ($teodDB) {&teod_logger;} $stmtA = "optimize table vicidial_carrier_hour_counts;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; @@ -1354,10 +1361,11 @@ if ($timeclock_end_of_day_NOW > 0) $stmtA = "INSERT IGNORE INTO vicidial_ingroup_hour_counts_archive SELECT * from vicidial_ingroup_hour_counts where date_hour < '$today_start';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows = $sthA->rows; - if (!$Q) {print "$sthArows rows inserted into vicidial_ingroup_hour_counts_archive table \n";} - + $event_string = "$sthArows rows inserted into vicidial_ingroup_hour_counts_archive table"; + if (!$Q) {print "$event_string \n";} + if ($teodDB) {&teod_logger;} + $rv = $sthA->err(); if (!$rv) { @@ -1365,7 +1373,9 @@ if ($timeclock_end_of_day_NOW > 0) $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows = $sthA->rows; - if (!$Q) {print "$sthArows rows deleted from vicidial_ingroup_hour_counts table \n";} + $event_string = "$sthArows rows deleted from vicidial_ingroup_hour_counts table"; + if (!$Q) {print "$event_string \n";} + if ($teodDB) {&teod_logger;} $stmtA = "optimize table vicidial_ingroup_hour_counts;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; @@ -1377,10 +1387,11 @@ if ($timeclock_end_of_day_NOW > 0) $stmtA = "INSERT IGNORE INTO vicidial_inbound_callback_queue_archive SELECT * from vicidial_inbound_callback_queue where icbq_status IN('SENT','EXPIRED','DNCL','DNCC','ORPHAN');"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows = $sthA->rows; - if (!$Q) {print "$sthArows rows inserted into vicidial_inbound_callback_queue_archive table \n";} - + $event_string = "$sthArows rows inserted into vicidial_inbound_callback_queue_archive table"; + if (!$Q) {print "$event_string \n";} + if ($teodDB) {&teod_logger;} + $rv = $sthA->err(); if (!$rv) { @@ -1388,7 +1399,9 @@ if ($timeclock_end_of_day_NOW > 0) $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows = $sthA->rows; - if (!$Q) {print "$sthArows rows deleted from vicidial_inbound_callback_queue table \n";} + $event_string = "$sthArows rows deleted from vicidial_inbound_callback_queue table"; + if (!$Q) {print "$event_string \n";} + if ($teodDB) {&teod_logger;} $stmtA = "optimize table vicidial_inbound_callback_queue;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; @@ -1401,6 +1414,7 @@ if ($timeclock_end_of_day_NOW > 0) $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows = $sthA->rows; if (!$Q) {print "$sthArows vicidial_inbound_groups rows closing_time_now_trigger value reset \n";} + if ($teodDB) {$event_string = "$sthArows vicidial_inbound_groups rows closing_time_now_trigger value reset"; &teod_logger;} ##### BEGIN max stats end of day process ##### # set OPEN max stats records to CLOSING for processing diff --git a/bin/AST_VDauto_dial.pl b/bin/AST_VDauto_dial.pl index 9b2f582f..0f426924 100644 --- a/bin/AST_VDauto_dial.pl +++ b/bin/AST_VDauto_dial.pl @@ -127,6 +127,7 @@ # 170915-1817 - Added support for per server routing prefix needed for Asterisk 13+ # 180130-1346 - Added inbound_no_agents_no_dial campaign options # 180214-1559 - Added CID Group functionality +# 180301-1338 - Small changes for Inbound Queue No Dial # ### begin parsing run-time options ### @@ -373,6 +374,7 @@ while($one_day_interval > 0) @DBIPexistcalls_IN_ALL=@MT; @DBIPexistchats_IN_LIVE=@MT; @DBIPexistcalls_IN_LIVE=@MT; + @DBIPexistcalls_QUEUE_LIVE=@MT; @DBIPexistcalls_OUT=@MT; @DBIPgoalcalls=@MT; @DBIPmakecalls=@MT; @@ -825,9 +827,26 @@ while($one_day_interval > 0) $DBIPexistchats_IN_LIVE[$user_CIPct] = $aryA[0]; } $sthA->finish(); + + $stmtA = "SELECT count(*) FROM vicidial_inbound_callback_queue where icbq_status IN('LIVE','SENDING','NEW') and group_id IN($DBIPclosercamp[$user_CIPct]);"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $DBIPexistcalls_QUEUE_LIVE[$user_CIPct] = $aryA[0]; + } + $sthA->finish(); } else - {$DBIPexistcalls_IN[$user_CIPct]=0;} + { + $DBIPexistcalls_IN[$user_CIPct]=0; + $DBIPexistcalls_IN_ALL[$user_CIPct]=0; + $DBIPexistcalls_IN_LIVE[$user_CIPct]=0; + $DBIPexistchats_IN_LIVE[$user_CIPct]=0; + $DBIPexistcalls_QUEUE_LIVE[$user_CIPct]=0; + } ### Check for inbound no-agents no-dial $DBIPinbound_no_agents_no_dial_trigger[$user_CIPct]=0; @@ -973,7 +992,7 @@ while($one_day_interval > 0) if ($DBIPmakecalls[$user_CIPct] > 0) {$active_line_counter = ($DBIPmakecalls[$user_CIPct] + $active_line_counter);} - $event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: Calls to place: $DBIPmakecalls[$user_CIPct] ($DBIPgoalcalls[$user_CIPct] - $DBIPexistcalls[$user_CIPct] [$DBIPexistcalls_IN[$user_CIPct] + $DBIPexistcalls_OUT[$user_CIPct]|$DBIPexistcalls_IN_ALL[$user_CIPct]|$DBIPexistcalls_IN_LIVE[$user_CIPct]]) $active_line_counter $MVT_msg"; + $event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: Calls to place: $DBIPmakecalls[$user_CIPct] ($DBIPgoalcalls[$user_CIPct] - $DBIPexistcalls[$user_CIPct] [$DBIPexistcalls_IN[$user_CIPct] + $DBIPexistcalls_OUT[$user_CIPct]|$DBIPexistcalls_IN_ALL[$user_CIPct]|$DBIPexistcalls_IN_LIVE[$user_CIPct]|$DBIPexistcalls_QUEUE_LIVE[$user_CIPct]]) $active_line_counter $MVT_msg"; $debug_string .= "$event_string\n"; &event_logger; @@ -1089,9 +1108,9 @@ while($one_day_interval > 0) &event_logger; $DBIPtrunk_shortage[$user_CIPct] = 0; } - if ( ( ($DBIPinbound_queue_no_dial[$user_CIPct] =~ /ENABLED/) && ($DBIPexistcalls_IN_LIVE[$user_CIPct] > 0) ) || ( ($DBIPinbound_queue_no_dial[$user_CIPct] =~ /CHAT/) && ($DBIPexistchats_IN_LIVE[$user_CIPct] > 0) ) ) + if ( ( ($DBIPinbound_queue_no_dial[$user_CIPct] =~ /ENABLED|ALL_SERVERS/) && ( ($DBIPexistcalls_IN_LIVE[$user_CIPct] > 0) || ($DBIPexistcalls_QUEUE_LIVE[$user_CIPct] > 0) ) ) || ( ($DBIPinbound_queue_no_dial[$user_CIPct] =~ /CHAT/) && ($DBIPexistchats_IN_LIVE[$user_CIPct] > 0) ) ) { - $event_string="Inbound Queue No-Dial Override for Shortage |$DBIPexistcalls_IN_LIVE[$user_CIPct]|$DBIPtrunk_shortage[$user_CIPct]|"; + $event_string="Inbound Queue No-Dial Override for Shortage |$DBIPexistcalls_IN_LIVE[$user_CIPct]|$DBIPexistcalls_QUEUE_LIVE[$user_CIPct]|$DBIPtrunk_shortage[$user_CIPct]|"; $debug_string .= "$event_string\n"; &event_logger; $DBIPtrunk_shortage[$user_CIPct] = 0; @@ -1139,9 +1158,9 @@ while($one_day_interval > 0) } else { - if ( ( ($DBIPinbound_queue_no_dial[$user_CIPct] =~ /ENABLED/) && ($DBIPexistcalls_IN_LIVE[$user_CIPct] > 0) ) || ( ($DBIPinbound_queue_no_dial[$user_CIPct] =~ /CHAT/) && ($DBIPexistchats_IN_LIVE[$user_CIPct] > 0) ) ) + if ( ( ($DBIPinbound_queue_no_dial[$user_CIPct] =~ /ENABLED|ALL_SERVERS/) && ( ($DBIPexistcalls_IN_LIVE[$user_CIPct] > 0) || ($DBIPexistcalls_QUEUE_LIVE[$user_CIPct] > 0) ) ) || ( ($DBIPinbound_queue_no_dial[$user_CIPct] =~ /CHAT/) && ($DBIPexistchats_IN_LIVE[$user_CIPct] > 0) ) ) { - $event_string="$DBIPcampaign[$user_CIPct] $DBIPexistcalls_IN_LIVE[$user_CIPct] $DBIPexistchats_IN_LIVE[$user_CIPct]: INBOUND QUEUE NO DIAL, NO DIALING ($DBIPinbound_queue_no_dial[$user_CIPct])"; + $event_string="$DBIPcampaign[$user_CIPct] $DBIPexistcalls_IN_LIVE[$user_CIPct] $DBIPexistcalls_QUEUE_LIVE[$user_CIPct] $DBIPexistchats_IN_LIVE[$user_CIPct]: INBOUND QUEUE NO DIAL, NO DIALING ($DBIPinbound_queue_no_dial[$user_CIPct])"; &event_logger; } else