From 1c0be8416a9ed7733cdde6f4df17d597edeb9537 Mon Sep 17 00:00:00 2001 From: mattf Date: Thu, 1 Feb 2018 17:46:27 +0000 Subject: [PATCH] Fix for no-dial options in auto-dial script Added live call and shortage counts per server tables to campaign debug report git-svn-id: svn://192.168.202.10@2903 3d104415-ff17-0410-8863-d5cf3c621b8a --- bin/AST_VDauto_dial.pl | 17 +++++++++++- www/vicidial/campaign_debug.php | 49 ++++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/bin/AST_VDauto_dial.pl b/bin/AST_VDauto_dial.pl index 38e448d2..38a34d51 100644 --- a/bin/AST_VDauto_dial.pl +++ b/bin/AST_VDauto_dial.pl @@ -1082,10 +1082,25 @@ while($one_day_interval > 0) if ( ($DBIPadlevel[$user_CIPct] < 1) || ($DBIPdial_method[$user_CIPct] =~ /MANUAL|INBOUND_MAN/) ) { $event_string="Manual Dial Override for Shortage |$DBIPadlevel[$user_CIPct]|$DBIPtrunk_shortage[$user_CIPct]|"; - &event_logger; $debug_string .= "$event_string\n"; + &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) ) ) + { + $event_string="Inbound Queue No-Dial Override for Shortage |$DBIPexistcalls_IN_LIVE[$user_CIPct]|$DBIPtrunk_shortage[$user_CIPct]|"; + $debug_string .= "$event_string\n"; + &event_logger; + $DBIPtrunk_shortage[$user_CIPct] = 0; + } + if ($DBIPinbound_no_agents_no_dial_trigger[$user_CIPct] > 0) + { + $event_string="Inbound No-Agents No-Dial Override for Shortage |$DBIPinbound_no_agents_no_dial_trigger[$user_CIPct]|$DBIPtrunk_shortage[$user_CIPct]|"; + $debug_string .= "$event_string\n"; + &event_logger; + $DBIPtrunk_shortage[$user_CIPct] = 0; + } + $stmtA = "UPDATE vicidial_campaign_server_stats SET local_trunk_shortage='$DBIPtrunk_shortage[$user_CIPct]',update_time='$now_date' where server_ip='$server_ip' and campaign_id='$DBIPcampaign[$user_CIPct]';"; $affected_rows = $dbhA->do($stmtA); } diff --git a/www/vicidial/campaign_debug.php b/www/vicidial/campaign_debug.php index 3ce576eb..cc0bc937 100644 --- a/www/vicidial/campaign_debug.php +++ b/www/vicidial/campaign_debug.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2018 Matt Florell LICENSE: AGPLv2 # # CHANGES # 110514-1231 - First build @@ -13,6 +13,7 @@ # 141007-2209 - Finalized adding QXZ translation to all admin files # 141229-2042 - Added code for on-the-fly language translations display # 170409-1534 - Added IP List validation code +# 180201-1245 - Added live call and shortage counts per server tables # $startMS = microtime(); @@ -321,6 +322,52 @@ else $i++; } + $stmt="select server_ip,update_time,local_trunk_shortage from vicidial_campaign_server_stats where campaign_id='" . mysqli_real_escape_string($link, $group) . "' order by server_ip limit 100;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $shortages_to_print = mysqli_num_rows($rslt); + if ($shortages_to_print > 0) + { + echo "Per-Server Shortages:\n"; + echo " SERVER DATE/TIME SHORT\n"; + } + $i=0; + while ($shortages_to_print > $i) + { + $row=mysqli_fetch_row($rslt); + + echo sprintf("%-15s", $row[0])." "; + echo sprintf("%-20s", $row[1])." "; + echo sprintf("%-8s", $row[2])."\n"; + + $i++; + } + echo "\n"; + + + $stmt="select count(*),call_type,server_ip from vicidial_auto_calls where campaign_id='" . mysqli_real_escape_string($link, $group) . "' group by call_type,server_ip order by server_ip,call_type limit 100;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $shortages_to_print = mysqli_num_rows($rslt); + if ($shortages_to_print > 0) + { + echo "Per-Server and Per-Type Campaign Calls:\n"; + echo " SERVER CALL TYPE COUNT\n"; + } + $i=0; + while ($shortages_to_print > $i) + { + $row=mysqli_fetch_row($rslt); + + echo sprintf("%-15s", $row[2])." "; + echo sprintf("%-11s", $row[1])." "; + echo sprintf("%-8s", $row[0])."\n"; + + $i++; + } + echo "\n"; + + $closer_groupsSQL = preg_replace("/^ | -$/","",$closer_campaigns); $closer_groupsSQL = preg_replace("/ /","','",$closer_groupsSQL);