Added max_inbound_auto_reenable system setting and function to re-enable agent in-group selections after max_inbound_calls has been raised
git-svn-id: svn://192.168.202.10@3975 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -180,9 +180,10 @@
|
||||
# 251024-2222 - Added crashed table detection
|
||||
# 260126-1334 - Added check of reserved_extensions against dialplan numbers when building conf files
|
||||
# 260327-0846 - Added check of empty phone dialplan extensions when building conf files
|
||||
# 260402-1440 - Added reset of vicidial_max_inbound_cache table entries
|
||||
#
|
||||
|
||||
$build = '260327-0846';
|
||||
$build = '260402-1440';
|
||||
|
||||
$DB=0; # Debug flag
|
||||
$teodDB=0; # flag to log Timeclock End of Day processes to log file
|
||||
@@ -509,7 +510,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
|
||||
|
||||
|
||||
##### Get the settings from system_settings #####
|
||||
$stmtA = "SELECT sounds_central_control_active,active_voicemail_server,custom_dialplan_entry,default_codecs,generate_cross_server_exten,voicemail_timezones,default_voicemail_timezone,call_menu_qualify_enabled,allow_voicemail_greeting,reload_timestamp,meetme_enter_login_filename,meetme_enter_leave3way_filename,allow_chats,enable_auto_reports,enable_drop_lists,expired_lists_inactive,sip_event_logging,call_quota_lead_ranking,inbound_answer_config,log_latency_gaps,demographic_quotas,weekday_resets,highest_lead_id,hopper_hold_inserts,stereo_recording,stereo_parallel_recording,recording_dtmf_muting,db_crashed_tables_check FROM system_settings;";
|
||||
$stmtA = "SELECT sounds_central_control_active,active_voicemail_server,custom_dialplan_entry,default_codecs,generate_cross_server_exten,voicemail_timezones,default_voicemail_timezone,call_menu_qualify_enabled,allow_voicemail_greeting,reload_timestamp,meetme_enter_login_filename,meetme_enter_leave3way_filename,allow_chats,enable_auto_reports,enable_drop_lists,expired_lists_inactive,sip_event_logging,call_quota_lead_ranking,inbound_answer_config,log_latency_gaps,demographic_quotas,weekday_resets,highest_lead_id,hopper_hold_inserts,stereo_recording,stereo_parallel_recording,recording_dtmf_muting,db_crashed_tables_check,max_inbound_auto_reenable FROM system_settings;";
|
||||
# print "$stmtA\n";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -545,6 +546,7 @@ if ($sthArows > 0)
|
||||
$SSstereo_parallel_recording = $aryA[25];
|
||||
$SSrecording_dtmf_muting = $aryA[26];
|
||||
$SSdb_crashed_tables_check = $aryA[27];
|
||||
$SSmax_inbound_auto_reenable = $aryA[28];
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($DBXXX > 0) {print "SYSTEM SETTINGS: $sounds_central_control_active|$active_voicemail_server|$SScustom_dialplan_entry|$SSdefault_codecs\n";}
|
||||
@@ -1541,6 +1543,30 @@ if ($timeclock_end_of_day_NOW > 0)
|
||||
if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";}
|
||||
$sthA->finish();
|
||||
|
||||
if ($SSmax_inbound_auto_reenable >= 2)
|
||||
{
|
||||
$stmtA = "UPDATE vicidial_max_inbound_cache SET status='OLD',notes=CONCAT(notes,'|TCEOD') WHERE status='NEW' and event_date >= \"$RMSQLdate\" and event_date < \"$FMSQLdate\";";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if($DB){print STDERR "\n|$affected_rows vicidial_max_inbound_cache records archived|\n";}
|
||||
if ($teodDB) {$event_string = "vicidial_max_inbound_cache records archived: $affected_rows"; &teod_logger;}
|
||||
}
|
||||
|
||||
$stmtA = "delete from vicidial_max_inbound_cache where event_date < \"$RMSQLdate\";";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if($DB){print STDERR "\n|$affected_rows vicidial_max_inbound_cache records deleted|\n";}
|
||||
if ($teodDB) {$event_string = "vicidial_max_inbound_cache records deleted: $affected_rows"; &teod_logger;}
|
||||
|
||||
$stmtA = "optimize table vicidial_max_inbound_cache;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";}
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA = "optimize table crashed_tables;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# agents that should appear to be logged in so that the calls can be transferred
|
||||
# out to them properly.
|
||||
#
|
||||
# Copyright (C) 2024 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2026 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGELOG:
|
||||
# 50215-0954 - First version of script
|
||||
@@ -58,9 +58,10 @@
|
||||
# 240219-1518 - Added daily_limit inbound option
|
||||
# 240420-2246 - Added ConfBridge code
|
||||
# 240516-2149 - Allow for ALT start_call_url, added --version flag
|
||||
# 260403-2253 - Added vicidial_max_inbound_cache logging
|
||||
#
|
||||
|
||||
$build = '240516-2149';
|
||||
$build = '260403-2253';
|
||||
|
||||
### begin parsing run-time options ###
|
||||
if (length($ARGV[0])>1)
|
||||
@@ -471,6 +472,17 @@ while($one_day_interval > 0)
|
||||
}
|
||||
if ($max_inbound_count >= $max_inbound_calls)
|
||||
{
|
||||
$RAWcloser_campaigns='';
|
||||
$stmtJ = "SELECT closer_campaigns FROM vicidial_remote_agents where user_start='$QHuser[$w]';";
|
||||
$sthA = $dbhA->prepare($stmtJ) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtJ ", $dbhA->errstr;
|
||||
$sthArowsVRA=$sthA->rows;
|
||||
if ($sthArowsVRA > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$RAWcloser_campaigns = $aryA[0];
|
||||
}
|
||||
|
||||
$max_inbound_triggered++;
|
||||
$stmtJ = "UPDATE vicidial_live_agents set closer_campaigns='' where user='$QHuser[$w]';";
|
||||
$affected_rows = $dbhA->do($stmtJ);
|
||||
@@ -481,6 +493,9 @@ while($one_day_interval > 0)
|
||||
$stmtJ = "UPDATE vicidial_remote_agents set closer_campaigns='' where user_start='$QHuser[$w]';";
|
||||
$affected_rows = $dbhA->do($stmtJ);
|
||||
|
||||
$stmtJ = "INSERT INTO vicidial_max_inbound_cache SET user='$QHuser[$w]', campaign_id='$QHcampaign_id[$w]', event_date=NOW(), blended='1', closer_campaigns='$RAWcloser_campaigns', max_inbound_count='$max_inbound_calls', call_count_today='$max_inbound_count', status='NEW', notes='VRA';";
|
||||
$affected_rows = $dbhA->do($stmtJ);
|
||||
|
||||
$stmtJ = "INSERT INTO vicidial_admin_log set event_date=NOW(), user='$QHuser[$w]', ip_address='$VARserver_ip', event_section='USERS', event_type='MODIFY', record_id='$QHuser[$w]', event_code='MAX IN CALLS MODIFY REMOTE AGENT', event_sql='DELETE FROM vicidial_live_inbound_agents where user=$QHuser[$w]', event_notes='|$max_inbound_count|$max_inbound_calls|$QHuser[$w]|$QHcall_id[$w]|RA|';";
|
||||
$affected_rows = $dbhA->do($stmtJ);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user