Added several small options.php settings for agent and admin screens
Added highest_lead_id collection and display in system settings Added code for hopper_hold_inserts system and campaign settings Fixed dead call max issue within manual alt dialing in agent screen git-svn-id: svn://192.168.202.10@3776 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -488,7 +488,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 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 FROM system_settings;";
|
||||
# print "$stmtA\n";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -518,6 +518,7 @@ if ($sthArows > 0)
|
||||
$SSlog_latency_gaps = $aryA[19];
|
||||
$SSdemographic_quotas = $aryA[20];
|
||||
$SSweekday_resets = $aryA[21];
|
||||
$SShighest_lead_id = $aryA[22];
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($DBXXX > 0) {print "SYSTEM SETTINGS: $sounds_central_control_active|$active_voicemail_server|$SScustom_dialplan_entry|$SSdefault_codecs\n";}
|
||||
@@ -5253,6 +5254,27 @@ if ($active_asterisk_server =~ /Y/)
|
||||
system($launch . ' &');
|
||||
}
|
||||
}
|
||||
|
||||
$highest_lead_id=999999999;
|
||||
$stmtA = "SELECT lead_id from vicidial_list order by lead_id desc limit 1;";
|
||||
$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;
|
||||
$highest_lead_id = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
if ($highest_lead_id > $SShighest_lead_id)
|
||||
{
|
||||
$stmtA = "UPDATE system_settings SET highest_lead_id='$highest_lead_id';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
|
||||
if ($DBX) {print "Highest Lead ID updated: $highest_lead_id > $SShighest_lead_id \n";}
|
||||
}
|
||||
}
|
||||
################################################################################
|
||||
##### END Confirm Asterisk is running, and if not restart it from the screen
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
# 180511-2018 - Added --YearYMDdatedir option
|
||||
# 180616-2248 - Added --localdatedir option
|
||||
# 230131-2321 - Allowed for handling of stereo gateway recordings
|
||||
# 231116-0757 - Added --ftp-active option flag for Active (non-Passive) FTP connections
|
||||
#
|
||||
|
||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||
@@ -86,6 +87,7 @@ $file_limit = 1000;
|
||||
$list_limit = 1000;
|
||||
$FTPpersistent=0;
|
||||
$FTPvalidate=0;
|
||||
$FTPpassive=1;
|
||||
|
||||
### begin parsing run-time options ###
|
||||
if (length($ARGV[0])>1)
|
||||
@@ -106,7 +108,6 @@ if (length($ARGV[0])>1)
|
||||
print " [--test] = test\n";
|
||||
print " [--transfer-limit=XXX] = number of files to transfer before exiting\n";
|
||||
print " [--list-limit=XXX] = number of files to list in the directory before moving on\n";
|
||||
print " [--debugX] = super debug\n";
|
||||
print " [--GSM] = copy GSM files\n";
|
||||
print " [--MP3] = copy MPEG-Layer-3 files\n";
|
||||
print " [--OGG] = copy OGG Vorbis files\n";
|
||||
@@ -118,7 +119,6 @@ if (length($ARGV[0])>1)
|
||||
print " [--YearYMDdatedir] = put into Year/YYYYMMDD dated directories\n";
|
||||
print " [--localdatedir] = create dated directories inside of FTP directory on local server\n";
|
||||
print " [--run-check] = concurrency check, die if another instance is running\n";
|
||||
print " [--max-files=x] = maximum number of files to process, defaults to 100000\n";
|
||||
print " [--ftp-server=XXX] = FTP server\n";
|
||||
print " [--ftp-port=XXX] = FTP server port\n";
|
||||
print " [--ftp-login=XXX] = FTP server login account\n";
|
||||
@@ -126,6 +126,7 @@ if (length($ARGV[0])>1)
|
||||
print " [--ftp-dir=XXX] = FTP server directory\n";
|
||||
print " [--ftp-persistent] = Does not log out between every file transmission\n";
|
||||
print " [--ftp-validate] = Checks for a file size on the file after transmission\n";
|
||||
print " [--ftp-active] = Use Active (non-Passive) FTP connection\n";
|
||||
print "\n";
|
||||
exit;
|
||||
}
|
||||
@@ -287,6 +288,12 @@ if (length($ARGV[0])>1)
|
||||
if ($DB > 0)
|
||||
{print "\n----- FTP VALIDATE: $FTPvalidate -----\n\n";}
|
||||
}
|
||||
if ($args =~ /--ftp-active/i)
|
||||
{
|
||||
$FTPpassive=0;
|
||||
if ($DB > 0)
|
||||
{print "\n----- FTP ACTIVE(non-Passive) connection: 1 ($FTPpassive) -----\n\n";}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -505,9 +512,25 @@ foreach(@FILES)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($FTPpassive > 0)
|
||||
{
|
||||
if($DBX){print STDERR "Connecting to FTP server in passive mode...\n";}
|
||||
$ftp = Net::FTP->new("$VARFTP_host", Port => $VARFTP_port, Debug => $FTPdb);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($DBX){print STDERR "Connecting to FTP server in active mode...\n";}
|
||||
$ftp = Net::FTP->new("$VARFTP_host", Port => $VARFTP_port, Debug => $FTPdb, Passive => 0);
|
||||
}
|
||||
$ftp = Net::FTP->new("$VARFTP_host", Port => $VARFTP_port, Debug => $FTPdb);
|
||||
$ftp->login("$VARFTP_user","$VARFTP_pass");
|
||||
$ftp->cwd("$VARFTP_dir");
|
||||
|
||||
if ($FTPpassive < 1)
|
||||
{
|
||||
if($DBX){print STDERR "Forcing FTP connection to active mode...\n";}
|
||||
$ftp->passive("0");
|
||||
}
|
||||
}
|
||||
if ($NODATEDIR < 1)
|
||||
{
|
||||
|
||||
@@ -561,7 +561,7 @@ while ($master_loop < $CLIloops)
|
||||
$hopper_ready_count=0;
|
||||
$agents_loggedin_count=0;
|
||||
### Find out how many leads are in the hopper from a specific campaign
|
||||
$stmtA = "SELECT count(*) from vicidial_hopper where campaign_id='$campaign_id[$i]' and status='READY';";
|
||||
$stmtA = "SELECT count(*) from vicidial_hopper where campaign_id='$campaign_id[$i]' and status IN('READY','RHOLD');";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
|
||||
@@ -155,9 +155,10 @@
|
||||
# 230204-2144 - Added ability to use ALT na_call_url entries
|
||||
# 230215-1534 - Fix for AGENTDIRECT No-Agent Call URL calls, Issue #1396
|
||||
# 230223-0826 - Fix for enhanced_disconnect_logging=3 issue
|
||||
# 231116-0911 - Added hopper_hold_inserts option
|
||||
#
|
||||
|
||||
$build='230223-0826';
|
||||
$build='231116-0911';
|
||||
$script='AST_VDauto_dial';
|
||||
### begin parsing run-time options ###
|
||||
if (length($ARGV[0])>1)
|
||||
@@ -336,7 +337,7 @@ $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|';
|
||||
|
||||
#############################################
|
||||
##### START QUEUEMETRICS LOGGING LOOKUP #####
|
||||
$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,outbound_autodial_active,queuemetrics_loginout,queuemetrics_addmember_enabled,queuemetrics_pause_type,enable_drop_lists,call_quota_lead_ranking,timeclock_end_of_day,allow_shared_dial,call_limit_24hour FROM system_settings;";
|
||||
$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,outbound_autodial_active,queuemetrics_loginout,queuemetrics_addmember_enabled,queuemetrics_pause_type,enable_drop_lists,call_quota_lead_ranking,timeclock_end_of_day,allow_shared_dial,call_limit_24hour,hopper_hold_inserts FROM system_settings;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@@ -358,6 +359,7 @@ if ($sthArows > 0)
|
||||
$timeclock_end_of_day = $aryA[12];
|
||||
$allow_shared_dial = $aryA[13];
|
||||
$SScall_limit_24hour = $aryA[14];
|
||||
$SShopper_hold_inserts = $aryA[15];
|
||||
}
|
||||
$sthA->finish();
|
||||
##### END QUEUEMETRICS LOGGING LOOKUP #####
|
||||
@@ -953,7 +955,7 @@ while($one_day_interval > 0)
|
||||
|
||||
### grab the dial_level and multiply by active agents to get your goalcalls
|
||||
$DBIPadlevel[$user_CIPct]=0;
|
||||
$stmtA = "SELECT auto_dial_level,local_call_time,dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,closer_campaigns,omit_phone_code,available_only_ratio_tally,auto_alt_dial,campaign_allow_inbound,queue_priority,dial_method,use_custom_cid,inbound_queue_no_dial,available_only_tally_threshold,available_only_tally_threshold_agents,dial_level_threshold,dial_level_threshold_agents,adaptive_dl_diff_target,dl_diff_target_method,inbound_no_agents_no_dial_container,inbound_no_agents_no_dial_threshold,cid_group_id,scheduled_callbacks_auto_reschedule,call_quota_lead_ranking,dial_timeout_lead_container,drop_call_seconds,drop_action,drop_inbound_group,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,cid_group_id_two,incall_tally_threshold_seconds,auto_alt_threshold FROM vicidial_campaigns where campaign_id='$DBIPcampaign[$user_CIPct]'";
|
||||
$stmtA = "SELECT auto_dial_level,local_call_time,dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,closer_campaigns,omit_phone_code,available_only_ratio_tally,auto_alt_dial,campaign_allow_inbound,queue_priority,dial_method,use_custom_cid,inbound_queue_no_dial,available_only_tally_threshold,available_only_tally_threshold_agents,dial_level_threshold,dial_level_threshold_agents,adaptive_dl_diff_target,dl_diff_target_method,inbound_no_agents_no_dial_container,inbound_no_agents_no_dial_threshold,cid_group_id,scheduled_callbacks_auto_reschedule,call_quota_lead_ranking,dial_timeout_lead_container,drop_call_seconds,drop_action,drop_inbound_group,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,cid_group_id_two,incall_tally_threshold_seconds,auto_alt_threshold,hopper_hold_inserts FROM vicidial_campaigns where campaign_id='$DBIPcampaign[$user_CIPct]'";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@@ -1003,6 +1005,8 @@ while($one_day_interval > 0)
|
||||
$DBIPcid_group_id_two[$user_CIPct] = $aryA[35];
|
||||
$DBIPincall_tally_threshold_seconds[$user_CIPct] = $aryA[36];
|
||||
$DBIPauto_alt_threshold[$user_CIPct] = $aryA[37];
|
||||
$DBIPhopper_hold_inserts[$user_CIPct] = $aryA[38];
|
||||
if ($SShopper_hold_inserts < 1) {$DBIPhopper_hold_inserts[$user_CIPct] = 'DISABLED';}
|
||||
|
||||
# check for Dial Timeout Lead override
|
||||
if ( (length($DBIPdial_timeout_lead_container[$user_CIPct]) > 1) && ($DBIPdial_timeout_lead_container[$user_CIPct] !~ /^DISABLED$/i) )
|
||||
@@ -2853,7 +2857,7 @@ while($one_day_interval > 0)
|
||||
$VD_auto_alt_dial = 'NONE';
|
||||
$VD_auto_alt_dial_statuses='';
|
||||
$VD_call_quota_lead_ranking='DISABLED';
|
||||
$stmtA="SELECT auto_alt_dial,auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc,call_quota_lead_ranking,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,auto_alt_threshold FROM vicidial_campaigns where campaign_id='$CLcampaign_id';";
|
||||
$stmtA="SELECT auto_alt_dial,auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc,call_quota_lead_ranking,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,auto_alt_threshold,hopper_hold_inserts FROM vicidial_campaigns where campaign_id='$CLcampaign_id';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@@ -2871,6 +2875,8 @@ while($one_day_interval > 0)
|
||||
$VD_call_limit_24hour = $aryA[8];
|
||||
$VD_call_limit_24hour_override = $aryA[9];
|
||||
$VD_auto_alt_threshold = $aryA[10];
|
||||
$VD_hopper_hold_inserts = $aryA[11];
|
||||
if ($SShopper_hold_inserts < 1) {$VD_hopper_hold_inserts = 'DISABLED';}
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
@@ -3282,7 +3288,9 @@ while($one_day_interval > 0)
|
||||
}
|
||||
if ($passed_24hour_call_count > 0)
|
||||
{
|
||||
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ALT',user='',priority='25',source='A';";
|
||||
$hopper_status='READY';
|
||||
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
|
||||
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ALT',user='',priority='25',source='A';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$event_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &event_logger;
|
||||
$aad_string = "$CLlead_id|$VD_alt_phone|$CLcampaign_id|ALT|25|hopper insert|"; &aad_output;
|
||||
@@ -3386,7 +3394,9 @@ while($one_day_interval > 0)
|
||||
}
|
||||
if ($passed_24hour_call_count > 0)
|
||||
{
|
||||
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ADDR3',user='',priority='20',source='A';";
|
||||
$hopper_status='READY';
|
||||
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
|
||||
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ADDR3',user='',priority='20',source='A';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$event_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &event_logger;
|
||||
$aad_string = "$CLlead_id|$VD_address3|$CLcampaign_id|ADDR3|20|hopper insert|"; &aad_output;
|
||||
@@ -3536,7 +3546,9 @@ while($one_day_interval > 0)
|
||||
}
|
||||
if ($passed_24hour_call_count > 0)
|
||||
{
|
||||
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15',source='A';";
|
||||
$hopper_status='READY';
|
||||
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
|
||||
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15',source='A';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$event_string = "-- VDH record inserted: |$affected_rows| |$stmtA|X$Xlast|$VD_altdial_id|"; &event_logger;
|
||||
$aad_string = "$CLlead_id|$VD_altdial_phone|$CLcampaign_id|X$Xlast|15|hopper insert|"; &aad_output;
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
# 220311-1922 - Added List CID Group Override option
|
||||
# 220623-1622 - Added List dial_prefix override
|
||||
# 230830-1056 - Changed outbound_calls_per_second max to allow up to 1000 CPS
|
||||
# 231116-0916 - Added hopper_hold_inserts option
|
||||
#
|
||||
|
||||
### begin parsing run-time options ###
|
||||
@@ -218,7 +219,7 @@ $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|';
|
||||
&event_logger;
|
||||
|
||||
### Grab system_settings values from the database
|
||||
$stmtA = "SELECT use_non_latin,call_limit_24hour FROM system_settings;";
|
||||
$stmtA = "SELECT use_non_latin,call_limit_24hour,hopper_hold_inserts FROM system_settings;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@@ -227,6 +228,7 @@ if ($sthArows > 0)
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$non_latin = $aryA[0];
|
||||
$SScall_limit_24hour = $aryA[1];
|
||||
$SShopper_hold_inserts = $aryA[2];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
@@ -396,7 +398,9 @@ while($one_day_interval > 0)
|
||||
$DBIPcid_group_id[$camp_CIPct] = $aryA[9];
|
||||
$DBIPscheduled_callbacks_auto_reschedule[$camp_CIPct] = $aryA[10];
|
||||
$DBIPdial_timeout_lead_container[$camp_CIPct] = $aryA[11];
|
||||
$DBIPcid_group_id_two[$camp_CIPct] =$aryA[12];
|
||||
$DBIPcid_group_id_two[$camp_CIPct] = $aryA[12];
|
||||
$DBIPhopper_hold_inserts[$camp_CIPct] = $aryA[13];
|
||||
if ($SShopper_hold_inserts < 1) {$DBIPhopper_hold_inserts[$camp_CIPct] = 'DISABLED';}
|
||||
|
||||
if ($omit_phone_code =~ /Y/) {$DBIPomitcode[$camp_CIPct] = 1;}
|
||||
else {$DBIPomitcode[$camp_CIPct] = 0;}
|
||||
|
||||
@@ -12,10 +12,11 @@
|
||||
#
|
||||
# CHANGELOG
|
||||
# 230427-1424 - First build
|
||||
# 231116-0921 - Added hopper_hold_inserts option
|
||||
#
|
||||
|
||||
# constants
|
||||
$build = '230427-1424';
|
||||
$build = '231116-0921';
|
||||
$script='demo_quota';
|
||||
$DB=0; # Debug flag, set to 0 for no debug messages. Can be overriden with CLI --debug flag
|
||||
$US='__';
|
||||
@@ -1086,7 +1087,7 @@ foreach(@campaign_id)
|
||||
if ($DBX) {print "DQ List AUTO Resets enabled, checking hopper count: $demographic_quotas_list_resets[$i] \n";}
|
||||
$hopper_begin_output .= "DQ List AUTO Resets enabled, checking hopper count: $demographic_quotas_list_resets[$i] \n";
|
||||
$hopper_leads=0;
|
||||
$stmtA="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id[$i]' and status IN('READY');";
|
||||
$stmtA="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id[$i]' and status IN('READY','RHOLD');";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@@ -1523,7 +1524,7 @@ foreach(@campaign_id)
|
||||
if ($ranked_leads > 0)
|
||||
{
|
||||
$hopper_leads=0;
|
||||
$stmtA="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id[$i]' and status IN('READY');";
|
||||
$stmtA="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id[$i]' and status IN('READY','RHOLD');";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
# - S = Standard hopper load
|
||||
# - D = Campaign Drop-Run
|
||||
#
|
||||
# Copyright (C) 2021 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGELOG
|
||||
# 50810-1613 - Added database server variable definitions lookup
|
||||
@@ -107,10 +107,11 @@
|
||||
# 210719-1519 - Added additional state override methods for call_limit_24hour
|
||||
# 220822-0938 - Change DNC check queries to put phone_number in double-quotes instead of single-quotes
|
||||
# 230428-2017 - Added demographic_quotas code
|
||||
# 231116-0821 - Added hopper_hold_inserts system and campaign settings options
|
||||
#
|
||||
|
||||
# constants
|
||||
$build = '230428-2017';
|
||||
$build = '231116-0821';
|
||||
$script='AST_VDhopper';
|
||||
$DB=0; # Debug flag, set to 0 for no debug messages. Can be overriden with CLI --debug flag
|
||||
$US='__';
|
||||
@@ -362,7 +363,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
|
||||
|
||||
### Grab system_settings values from the database
|
||||
$anyone_callback_inactive_lists='default';
|
||||
$stmtA = "SELECT anyone_callback_inactive_lists,enable_international_dncs,daily_call_count_limit,use_non_latin,call_limit_24hour,UNIX_TIMESTAMP(call_limit_24hour_reset),UNIX_TIMESTAMP(NOW()) FROM system_settings;";
|
||||
$stmtA = "SELECT anyone_callback_inactive_lists,enable_international_dncs,daily_call_count_limit,use_non_latin,call_limit_24hour,UNIX_TIMESTAMP(call_limit_24hour_reset),UNIX_TIMESTAMP(NOW()),hopper_hold_inserts FROM system_settings;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@@ -376,6 +377,7 @@ if ($sthArows > 0)
|
||||
$SScall_limit_24hour = $aryA[4];
|
||||
$SScall_limit_24hour_reset = $aryA[5];
|
||||
$SScall_limit_24hour_now = $aryA[6];
|
||||
$SShopper_hold_inserts = $aryA[7];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
@@ -636,7 +638,7 @@ if ($CBHOLD_count > 0)
|
||||
$DNCL=0;
|
||||
|
||||
### look up callback DNC settings for campaign
|
||||
$stmtA = "SELECT callback_dnc,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override FROM vicidial_campaigns where campaign_id='$CA_campaign_id[$CAu]';";
|
||||
$stmtA = "SELECT callback_dnc,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,hopper_hold_inserts FROM vicidial_campaigns where campaign_id='$CA_campaign_id[$CAu]';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@@ -651,6 +653,8 @@ if ($CBHOLD_count > 0)
|
||||
$VD_call_limit_24hour_scope = $aryA[5];
|
||||
$VD_call_limit_24hour = $aryA[6];
|
||||
$VD_call_limit_24hour_override = $aryA[7];
|
||||
$VD_hopper_hold_inserts = $aryA[8];
|
||||
if ($SShopper_hold_inserts < 1) {$VD_hopper_hold_inserts = 'DISABLED';}
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
@@ -754,7 +758,9 @@ if ($CBHOLD_count > 0)
|
||||
$event_string = "|CALLBACKS LISTACT|$affected_rows|";
|
||||
&event_logger;
|
||||
|
||||
$stmtA = "INSERT INTO $vicidial_hopper SET lead_id='$CA_lead_id[$CAu]',campaign_id='$CA_campaign_id[$CAu]',list_id='$CA_list_id[$CAu]',gmt_offset_now='$CA_gmt_offset_now[$CAu]',user='',state=\"$CA_state[$CAu]\",priority='50',source='C',vendor_lead_code=\"$CA_vendor_lead_code[$CAu]\";";
|
||||
$hopper_statusSQL='';
|
||||
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_statusSQL = ",status='RHOLD'";}
|
||||
$stmtA = "INSERT INTO $vicidial_hopper SET lead_id='$CA_lead_id[$CAu]',campaign_id='$CA_campaign_id[$CAu]',list_id='$CA_list_id[$CAu]',gmt_offset_now='$CA_gmt_offset_now[$CAu]',user='',state=\"$CA_state[$CAu]\",priority='50',source='C',vendor_lead_code=\"$CA_vendor_lead_code[$CAu]\"$hopper_statusSQL;";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if ($DB) {print "ANYONE Scheduled Callback Inserted into hopper: $affected_rows|$CA_lead_id[$CAu]\n";}
|
||||
}
|
||||
@@ -837,7 +843,7 @@ if ($hopper_dnc_count > 0)
|
||||
$VD_campaign_id = $AAD_campaign_id[$aad];
|
||||
$VD_lead_id = $AAD_lead_id[$aad];
|
||||
### look up auto-alt-dial settings for campaign
|
||||
$stmtA = "SELECT auto_alt_dial,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override FROM vicidial_campaigns where campaign_id='$AAD_campaign_id[$aad]';";
|
||||
$stmtA = "SELECT auto_alt_dial,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,hopper_hold_inserts FROM vicidial_campaigns where campaign_id='$AAD_campaign_id[$aad]';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@@ -852,6 +858,8 @@ if ($hopper_dnc_count > 0)
|
||||
$VD_call_limit_24hour_scope = $aryA[5];
|
||||
$VD_call_limit_24hour = $aryA[6];
|
||||
$VD_call_limit_24hour_override = $aryA[7];
|
||||
$VD_hopper_hold_inserts = $aryA[8];
|
||||
if ($SShopper_hold_inserts < 1) {$VD_hopper_hold_inserts = 'DISABLED';}
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
@@ -947,7 +955,9 @@ if ($hopper_dnc_count > 0)
|
||||
}
|
||||
if ($passed_24hour_call_count > 0)
|
||||
{
|
||||
$stmtA = "UPDATE $vicidial_hopper SET status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ALT',user='',priority='25' where hopper_id='$AAD_hopper_id[$aad]';";
|
||||
$hopper_status='READY';
|
||||
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
|
||||
$stmtA = "UPDATE $vicidial_hopper SET status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ALT',user='',priority='25' where hopper_id='$AAD_hopper_id[$aad]';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if ($DB) {$event_string = "-- VDH record updated: |$affected_rows| |$stmtA|"; &event_logger;}
|
||||
$aad_string = "$AAD_lead_id[$aad]|$VD_alt_phone|$AAD_campaign_id[$aad]|ALT|25|hopper insert|"; &aad_output;
|
||||
@@ -1055,7 +1065,9 @@ if ($hopper_dnc_count > 0)
|
||||
}
|
||||
if ($passed_24hour_call_count > 0)
|
||||
{
|
||||
$stmtA = "UPDATE $vicidial_hopper SET status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ADDR3',user='',priority='20' where hopper_id='$AAD_hopper_id[$aad]';";
|
||||
$hopper_status='READY';
|
||||
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
|
||||
$stmtA = "UPDATE $vicidial_hopper SET status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ADDR3',user='',priority='20' where hopper_id='$AAD_hopper_id[$aad]';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if ($DB) {$event_string = "-- VDH record updated: |$affected_rows| |$stmtA|"; &event_logger;}
|
||||
$aad_string = "$AAD_lead_id[$aad]|$VD_address3|$AAD_campaign_id[$aad]|ADDR3|20|hopper insert|"; &aad_output;
|
||||
@@ -1207,7 +1219,9 @@ if ($hopper_dnc_count > 0)
|
||||
}
|
||||
if ($passed_24hour_call_count > 0)
|
||||
{
|
||||
$stmtA = "UPDATE $vicidial_hopper SET status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15' where hopper_id='$AAD_hopper_id[$aad]';";
|
||||
$hopper_status='READY';
|
||||
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
|
||||
$stmtA = "UPDATE $vicidial_hopper SET status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15' where hopper_id='$AAD_hopper_id[$aad]';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if ($DB) {$event_string = "-- VDH record updated: |$affected_rows| |$stmtA|X$Xlast|$VD_altdial_id|"; &event_logger;}
|
||||
$aad_string = "$AAD_lead_id[$aad]|$VD_altdial_phone|$AAD_campaign_id[$aad]|X$Xlast|15|hopper insert|"; &aad_output;
|
||||
@@ -1277,11 +1291,11 @@ $ANY_hopper_vlc_dup_check='N';
|
||||
|
||||
if (length($CLIcampaign)>1)
|
||||
{
|
||||
$stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,dial_statuses,list_order_mix,use_campaign_dnc,drop_lockout_time,no_hopper_dialing,auto_alt_dial_statuses,dial_timeout,auto_hopper_multi,use_auto_hopper,auto_trim_hopper,lead_order_randomize,lead_order_secondary,call_count_limit,hopper_vlc_dup_check,use_other_campaign_dnc,callback_dnc,hopper_drop_run_trigger,daily_call_count_limit,daily_limit_manual,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,demographic_quotas,demographic_quotas_container from vicidial_campaigns where campaign_id IN('$CLIcampaign');";
|
||||
$stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,dial_statuses,list_order_mix,use_campaign_dnc,drop_lockout_time,no_hopper_dialing,auto_alt_dial_statuses,dial_timeout,auto_hopper_multi,use_auto_hopper,auto_trim_hopper,lead_order_randomize,lead_order_secondary,call_count_limit,hopper_vlc_dup_check,use_other_campaign_dnc,callback_dnc,hopper_drop_run_trigger,daily_call_count_limit,daily_limit_manual,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,demographic_quotas,demographic_quotas_container,hopper_hold_inserts from vicidial_campaigns where campaign_id IN('$CLIcampaign');";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,dial_statuses,list_order_mix,use_campaign_dnc,drop_lockout_time,no_hopper_dialing,auto_alt_dial_statuses,dial_timeout,auto_hopper_multi,use_auto_hopper,auto_trim_hopper,lead_order_randomize,lead_order_secondary,call_count_limit,hopper_vlc_dup_check,use_other_campaign_dnc,callback_dnc,hopper_drop_run_trigger,daily_call_count_limit,daily_limit_manual,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,demographic_quotas,demographic_quotas_container from vicidial_campaigns where active='Y';";
|
||||
$stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,dial_statuses,list_order_mix,use_campaign_dnc,drop_lockout_time,no_hopper_dialing,auto_alt_dial_statuses,dial_timeout,auto_hopper_multi,use_auto_hopper,auto_trim_hopper,lead_order_randomize,lead_order_secondary,call_count_limit,hopper_vlc_dup_check,use_other_campaign_dnc,callback_dnc,hopper_drop_run_trigger,daily_call_count_limit,daily_limit_manual,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,demographic_quotas,demographic_quotas_container,hopper_hold_inserts from vicidial_campaigns where active='Y';";
|
||||
}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -1330,6 +1344,8 @@ while ($sthArows > $rec_count)
|
||||
$demographic_quotas[$rec_count] = $aryA[34];
|
||||
$demographic_quotas_container[$rec_count] = $aryA[35];
|
||||
$demographic_quotasSQL[$rec_count] = '';
|
||||
$hopper_hold_inserts[$rec_count] = $aryA[36];
|
||||
if ($SShopper_hold_inserts < 1) {$hopper_hold_inserts[$rec_count] = 'DISABLED';}
|
||||
|
||||
if ( ($demographic_quotas[$rec_count] =~ /ENABLED|COMPLETE/) && ( (length($demographic_quotas_container[$rec_count]) > 0) && ($demographic_quotas_container[$rec_count] !~ /DISABLED/) ) )
|
||||
{$demographic_quotasSQL[$rec_count] = "and rank!='-9999'";}
|
||||
@@ -1398,7 +1414,7 @@ while ($sthArows > $rec_count)
|
||||
{
|
||||
if ($DB) { print "---------------Auto Trim Hopper Enabled For $campaign_id[$rec_count]---------------------\n"; }
|
||||
|
||||
$stmtB = "SELECT COUNT(*) FROM $vicidial_hopper WHERE campaign_id='$campaign_id[$rec_count]' and status IN ('READY') and source IN('S','N');";
|
||||
$stmtB = "SELECT COUNT(*) FROM $vicidial_hopper WHERE campaign_id='$campaign_id[$rec_count]' and status IN ('READY','RHOLD') and source IN('S','N');";
|
||||
$sthB = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr;
|
||||
$sthB->execute or die "executing: $stmtB ", $dbhA->errstr;
|
||||
@aryLead = $sthB->fetchrow_array;
|
||||
@@ -1414,7 +1430,7 @@ while ($sthArows > $rec_count)
|
||||
if ( $camp_leads > ( 2 * $hopper_level[$rec_count] ) )
|
||||
{
|
||||
$num_to_delete = $camp_leads - 2 * $hopper_level[$rec_count];
|
||||
$stmtB = "DELETE FROM $vicidial_hopper WHERE campaign_id='$campaign_id[$rec_count]' AND source='S' AND status IN ('READY') LIMIT $num_to_delete";
|
||||
$stmtB = "DELETE FROM $vicidial_hopper WHERE campaign_id='$campaign_id[$rec_count]' AND source='S' AND status IN ('READY','RHOLD') LIMIT $num_to_delete";
|
||||
$affected_rows = $dbhA->do($stmtB);
|
||||
|
||||
if ($DB)
|
||||
@@ -2196,7 +2212,7 @@ foreach(@campaign_id)
|
||||
|
||||
### Find out how many leads are READY in the hopper from a specific campaign
|
||||
$hopper_ready_count=0;
|
||||
$stmtA = "SELECT count(*) from $vicidial_hopper where campaign_id='$campaign_id[$i]' and status='READY';";
|
||||
$stmtA = "SELECT count(*) from $vicidial_hopper where campaign_id='$campaign_id[$i]' and status IN('READY','RHOLD');";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@@ -3616,13 +3632,15 @@ foreach(@campaign_id)
|
||||
{
|
||||
if ( ($DCCLlead == '0') && ($TFHCCLlead == '0') )
|
||||
{
|
||||
$stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority,source,vendor_lead_code) values('$leads_to_hopper[$h]','$campaign_id[$i]','READY','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]',\"$state_to_hopper[$h]\",'$hopperPRIORITY','$source_to_hopper[$h]',\"$vlc_to_hopper[$h]\");";
|
||||
$hopper_status='READY';
|
||||
if ($hopper_hold_inserts[$i] =~ /ENABLED/) {$hopper_status='RHOLD';}
|
||||
$stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority,source,vendor_lead_code) values('$leads_to_hopper[$h]','$campaign_id[$i]','$hopper_status','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]',\"$state_to_hopper[$h]\",'$hopperPRIORITY','$source_to_hopper[$h]',\"$vlc_to_hopper[$h]\");";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$DBinserted = ($DBinserted + $affected_rows);
|
||||
if ($DBX) {print "LEAD INSERTED: $affected_rows|$leads_to_hopper[$h]|\n";}
|
||||
if ($DB_detail)
|
||||
{
|
||||
$detail_string = "|$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|$vlc_to_hopper[$h]|$source_to_hopper[$h]|$phone_code_to_hopper[$h]|$postal_code_to_hopper[$h]|";
|
||||
$detail_string = "|$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|$vlc_to_hopper[$h]|$source_to_hopper[$h]|$phone_code_to_hopper[$h]|$postal_code_to_hopper[$h]|$hopper_status|";
|
||||
&detail_logger;
|
||||
}
|
||||
}
|
||||
@@ -3645,7 +3663,7 @@ foreach(@campaign_id)
|
||||
if ($DBX) {print "LEAD INSERTED AS DNC: $affected_rows|$leads_to_hopper[$h]|\n";}
|
||||
if ($DB_detail)
|
||||
{
|
||||
$detail_string = "|$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|$vlc_to_hopper[$h]|$source_to_hopper[$h]|$phone_code_to_hopper[$h]|$postal_code_to_hopper[$h]|";
|
||||
$detail_string = "|$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|$vlc_to_hopper[$h]|$source_to_hopper[$h]|$phone_code_to_hopper[$h]|$postal_code_to_hopper[$h]|DNC|";
|
||||
&detail_logger;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -524,6 +524,20 @@ if (!$T)
|
||||
if (!$Q) {print " - OPTIMIZE vicidial_users \n";}
|
||||
|
||||
|
||||
$stmtA = "OPTIMIZE table system_settings;";
|
||||
if($DB){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T)
|
||||
{
|
||||
$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 (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";}
|
||||
$sthA->finish();
|
||||
}
|
||||
if (!$Q) {print " - OPTIMIZE system_settings \n";}
|
||||
|
||||
|
||||
### Gather active servers from the database
|
||||
$stmtA = "SELECT server_ip,server_id FROM servers where active='Y' and active_asterisk_server='Y';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
# 220118-2207 - Added auto_alt_threshold campaign & list settings
|
||||
# 221221-2134 - Added enhanced_disconnect_logging=3 support , issue #1367
|
||||
# 230120-1557 - Added CAMPDTO dialplan variable for ^DC 3-way agent screen calls
|
||||
# 231116-0846 - Added hopper_hold_inserts option
|
||||
#
|
||||
|
||||
# defaults for PreFork
|
||||
@@ -883,6 +884,21 @@ sub process_request
|
||||
|
||||
if ($park_abandon < 1)
|
||||
{
|
||||
$highest_lead_id=999999999;
|
||||
$highest_lead_id_test=999999999;
|
||||
### Grab highest lead_id value from vicidial_list
|
||||
$stmtA = "SELECT highest_lead_id from system_settings;";
|
||||
$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;
|
||||
$highest_lead_id = $aryA[0];
|
||||
$highest_lead_id_test = ($highest_lead_id + 10000);
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
if ($request =~ /--HVcauses--/i)
|
||||
{
|
||||
$HVcauses=1;
|
||||
@@ -1396,11 +1412,17 @@ sub process_request
|
||||
|
||||
if (length($VDL_status) > 0)
|
||||
{
|
||||
$stmtA = "UPDATE vicidial_list set status='$VDL_status' where lead_id = '$CIDlead_id';";
|
||||
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||
$VDADaffected_rows = $dbhA->do($stmtA);
|
||||
if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$VDADaffected_rows|$CIDlead_id"; &agi_output;}
|
||||
|
||||
if ($CIDlead_id < $highest_lead_id_test)
|
||||
{
|
||||
$stmtA = "UPDATE vicidial_list set status='$VDL_status' where lead_id = '$CIDlead_id';";
|
||||
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||
$VDADaffected_rows = $dbhA->do($stmtA);
|
||||
if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update 1: |$VDADaffected_rows|$CIDlead_id"; &agi_output;}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($AGILOG) {$agi_string = "-- VDAD highest_lead_id test failed: |$highest_lead_id|$highest_lead_id_test|$CIDlead_id"; &agi_output;}
|
||||
}
|
||||
$stmtA = "UPDATE vicidial_auto_calls set status='$VDAC_status' where callerid = '$callerid';";
|
||||
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||
$VDACaffected_rows = $dbhA->do($stmtA);
|
||||
@@ -1962,7 +1984,7 @@ sub process_request
|
||||
$stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$VD_lead_id';";
|
||||
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$VD_lead_id"; &agi_output;}
|
||||
if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update 2: |$affected_rows|$VD_lead_id"; &agi_output;}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2063,11 +2085,24 @@ sub process_request
|
||||
}
|
||||
}
|
||||
|
||||
### Grab system_settings values from the database
|
||||
$anyone_callback_inactive_lists='default';
|
||||
$stmtA = "SELECT hopper_hold_inserts FROM system_settings;";
|
||||
$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;
|
||||
$SShopper_hold_inserts = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
### check to see if campaign has alt_dial or call quotas enabled
|
||||
$VD_auto_alt_dial = 'NONE';
|
||||
$VD_auto_alt_dial_statuses='';
|
||||
$VD_call_quota_lead_ranking='DISABLED';
|
||||
$stmtA="SELECT auto_alt_dial,auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc,call_quota_lead_ranking,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,auto_alt_threshold FROM vicidial_campaigns where campaign_id='$VD_campaign_id';";
|
||||
$stmtA="SELECT auto_alt_dial,auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc,call_quota_lead_ranking,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,auto_alt_threshold,hopper_hold_inserts FROM vicidial_campaigns where campaign_id='$VD_campaign_id';";
|
||||
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -2087,6 +2122,8 @@ sub process_request
|
||||
$VD_call_limit_24hour = $aryA[8];
|
||||
$VD_call_limit_24hour_override = $aryA[9];
|
||||
$CLauto_alt_threshold = $aryA[10];
|
||||
$VD_hopper_hold_inserts = $aryA[11];
|
||||
if ($SShopper_hold_inserts < 1) {$VD_hopper_hold_inserts = 'DISABLED';}
|
||||
$epc_countCAMPDATA++;
|
||||
}
|
||||
|
||||
@@ -2217,7 +2254,9 @@ sub process_request
|
||||
}
|
||||
if ($passed_24hour_call_count > 0)
|
||||
{
|
||||
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ALT',user='',priority='25',source='A';";
|
||||
$hopper_status='READY';
|
||||
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
|
||||
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ALT',user='',priority='25',source='A';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &agi_output;}
|
||||
if ($AGILOG) {$aad_string = "$VD_lead_id|$VD_alt_phone|$VD_campaign_id|ALT|25|hopper insert|"; &aad_output;}
|
||||
@@ -2323,7 +2362,9 @@ sub process_request
|
||||
}
|
||||
if ($passed_24hour_call_count > 0)
|
||||
{
|
||||
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ADDR3',user='',priority='20',source='A';";
|
||||
$hopper_status='READY';
|
||||
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
|
||||
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ADDR3',user='',priority='20',source='A';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &agi_output;}
|
||||
if ($AGILOG) {$aad_string = "$VD_lead_id|$VD_address3|$VD_campaign_id|ADDR3|20|hopper insert|"; &aad_output;}
|
||||
@@ -2471,7 +2512,9 @@ sub process_request
|
||||
}
|
||||
if ($passed_24hour_call_count > 0)
|
||||
{
|
||||
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15',source='A';";
|
||||
$hopper_status='READY';
|
||||
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
|
||||
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15',source='A';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|X$Xlast|$VD_altdial_id|"; &agi_output;}
|
||||
if ($AGILOG) {$aad_string = "$VD_lead_id|$VD_altdial_phone|$VD_campaign_id|X$Xlast|15|hopper insert|"; &aad_output;}
|
||||
|
||||
Reference in New Issue
Block a user