Added "Show Confetti" campaign setting, allowing for confetti to be shown to agents when they disposition a call as a SALE and/or a CALLBACK flagged status.

Added "Abandon Check Queue" feature, to catch dropped Call Menu calls that are tagged with a Lead ID. For more information, see the bottom of the INBOUND_CALLBACK_QUEUE.txt document.
Added "Asterisk Restart URL" to the Modify Servers page, this can send a URL request any time Asterisk is auto-restarted on that server.
Added display of inbound Call Menu calls to the Admin Modify Lead page if CallerID display option is used on page.

git-svn-id: svn://192.168.202.10@3699 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2023-03-12 15:42:36 +00:00
parent eab35a726b
commit 92d80cf587
17 changed files with 1324 additions and 45 deletions
+56 -1
View File
@@ -159,9 +159,10 @@
# 220921-1255 - Added vicidial_user_logins_daily TEOD population
# 221116-1157 - Added vicidial_long_extensions TEOD truncating
# 230118-1623 - Added Playback audio then hangup extension
# 230309-0926 - Added ara_url for server asterisk reboots, daily rolling of vicidial_abandon_check_queue table
#
$build = '230118-1623';
$build = '230309-0926';
$DB=0; # Debug flag
$teodDB=0; # flag to log Timeclock End of Day processes to log file
@@ -1678,6 +1679,33 @@ if ($timeclock_end_of_day_NOW > 0)
}
# roll of vicidial_abandon_check_queue records, keep only 1 day of records in active table
if (!$Q) {print "\nProcessing vicidial_abandon_check_queue table...\n";}
$stmtA = "INSERT IGNORE INTO vicidial_abandon_check_queue_archive SELECT * from vicidial_abandon_check_queue;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows = $sthA->rows;
$event_string = "$sthArows rows inserted into vicidial_abandon_check_queue_archive table";
if (!$Q) {print "$event_string \n";}
if ($teodDB) {&teod_logger;}
$rv = $sthA->err();
if (!$rv)
{
$stmtA = "DELETE FROM vicidial_abandon_check_queue WHERE abandon_time < \"$RMSQLdate\";";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows = $sthA->rows;
$event_string = "$sthArows rows deleted from vicidial_abandon_check_queue table";
if (!$Q) {print "$event_string \n";}
if ($teodDB) {&teod_logger;}
$stmtA = "optimize table vicidial_abandon_check_queue;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
}
# reset in-group closing_time_now_trigger trigger flag
$stmtA = "UPDATE vicidial_inbound_groups SET closing_time_now_trigger='N' WHERE closing_time_now_trigger='Y';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
@@ -4957,6 +4985,33 @@ if ($active_asterisk_server =~ /Y/)
`$PATHhome/start_asterisk_boot.pl`;
}
##### Get the ara_url for this server's server_ip #####
$stmtA = "SELECT ara_url where server_ip='$server_ip';";
if ($DB) {print "$stmtA\n";}
$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;
$ara_url = $aryA[0];
}
$sthA->finish();
# Call the ara_url
if ($ara_url ne '')
{
$ara_url =~ s/ /+/gi;
$ara_url =~ s/&/\\&/gi;
$launch = $PATHhome . "/AST_send_URL.pl";
$launch .= " --SYSLOG" if ($SYSLOG);
$launch .= " --lead_id=0";
$launch .= " --function=QM_SOCKET_SEND";
$launch .= " --compat_url=" . $ara_url;
system($launch . ' &');
}
}
}
################################################################################
+422 -3
View File
@@ -6,7 +6,7 @@
# adjusts the auto_dial_level for vicidial adaptive-predictive campaigns.
# gather call stats for campaigns and in-groups
#
# Copyright (C) 2021 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG
# 60823-1302 - First build from AST_VDhopper.pl
@@ -59,9 +59,10 @@
# 211022-1638 - Added incall_tally_threshold_seconds campaign feature
# 212207-2207 - Added IQNANQ to drop SQL calculation queries
# 211122-1457 - Fix for logging bug and modification to drop percentage calculation
# 230309-1009 - Added abandon_check_queue feature
#
$build='212207-2207';
$build='230309-1009';
# constants
$DB=0; # Debug flag, set to 0 for no debug messages, On an active system this will generate lots of lines of output per minute
$US='__';
@@ -318,7 +319,7 @@ $dbhB = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
if ($DBX) {print "CONNECTED TO DATABASE: $VARDB_server|$VARDB_database\n";}
##### gather relevent system settings
$stmtA = "SELECT cache_carrier_stats_realtime,ofcom_uk_drop_calc,call_quota_lead_ranking,use_non_latin,allow_shared_dial from system_settings;";
$stmtA = "SELECT cache_carrier_stats_realtime,ofcom_uk_drop_calc,call_quota_lead_ranking,use_non_latin,allow_shared_dial,abandon_check_queue from system_settings;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -330,6 +331,7 @@ if ($sthArows > 0)
$SScall_quota_lead_ranking = $aryA[2];
$non_latin = $aryA[3];
$SSallow_shared_dial = $aryA[4];
$SSabandon_check_queue = $aryA[5];
}
$sthA->finish();
@@ -358,6 +360,16 @@ $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthA->finish();
$stmtA = "INSERT IGNORE into vicidial_campaign_stats_debug SET campaign_id='--CALLBACK-QUEUE--',server_ip='ADAPT';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthA->finish();
$stmtA = "INSERT IGNORE into vicidial_campaign_stats_debug SET campaign_id='--ABANDON-QUEUE--',server_ip='ADAPT';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthA->finish();
$stmtA = "INSERT IGNORE into vicidial_campaign_stats_debug (campaign_id,server_ip) select campaign_id,'SHARED' from vicidial_campaigns;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1274,6 +1286,7 @@ while ($master_loop < $CLIloops)
$sthA->finish();
if ($DB) {print "\nActive Inbound Callback Queue Entries: |$ICBQcountA|$stmtA|\n";}
$callback_debug = "\nActive Inbound Callback Queue Entries: |$ICBQcountA|\n";
if ($ICBQcountA > 0)
{
@@ -1640,6 +1653,8 @@ while ($master_loop < $CLIloops)
$sthA->finish();
if ($DB) {print "\nOrphan SENDING Inbound Callback Queue Entries: |$ICBQcountS|$stmtA|\n";}
$callback_send_debug = "\nOrphan SENDING Inbound Callback Queue Entries: |$ICBQcountS|\n";
$callback_debug = "$callback_debug$callback_send_debug";
if ($ICBQcountS > 0)
{
@@ -1649,6 +1664,8 @@ while ($master_loop < $CLIloops)
if ($DBX) {$agi_string = "$ICBQaffected_rowsORPHAN|$stmtC|"; print "$agi_string\n";}
}
$callback_debug_flag='--CALLBACK-QUEUE--';
&callback_logger;
}
##########################################################
##### END check for stuck SENDING inbound callback queue records #####
@@ -2074,6 +2091,378 @@ while ($master_loop < $CLIloops)
##########################################################
#############################################################
##### BEGIN check for abandon_check_queue calls #####
#############################################################
if ( ( ($stat_count =~ /30$|80$/) || ($stat_count==1) ) && ($SSabandon_check_queue > 0) )
{
$acq_rejected=0;
$acq_check_dead=0;
$acq_complete_dead=0;
$acq_active_call=0;
$hopper_insert_sent=0;
$now_date_epoch = time();
$epochTWENTYFOURhoursAGO = ($now_date_epoch - 86400);
($Ssec,$Smin,$Shour,$Smday,$Smon,$Syear,$Swday,$Syday,$Sisdst) = localtime($epochTWENTYFOURhoursAGO);
$Smon++; $Syear = ($Syear + 1900);
if ($Smon < 10) {$Smon = "0$Smon";}
if ($Smday < 10) {$Smday = "0$Smday";}
if ($Shour < 10) {$Shour = "0$Shour";}
if ($Smin < 10) {$Smin = "0$Smin";}
if ($Ssec < 10) {$Ssec = "0$Ssec";}
$timeTWENTYFOURhoursAGO = "$Syear-$Smon-$Smday $Shour:$Smin:$Ssec";
$stmtA = "SELECT abandon_check_id,call_id,lead_id,abandon_time,reject_reason,check_status,UNIX_TIMESTAMP(abandon_time),phone_number,source from vicidial_abandon_check_queue where abandon_time > \"$timeTWENTYFOURhoursAGO\" and check_status IN('NEW','PROCESSING');";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsACQ=$sthA->rows;
$acq=0;
while ($sthArowsACQ > $acq)
{
@aryA = $sthA->fetchrow_array;
$Aabandon_check_id[$acq] = $aryA[0];
$Acall_id[$acq] = $aryA[1];
$Alead_id[$acq] = $aryA[2];
$Aabandon_time[$acq] = $aryA[3];
$Areject_reason[$acq] = $aryA[4];
$Acheck_status[$acq] = $aryA[5];
$Aabandon_timeEPOCH[$acq] = $aryA[6];
$Aphone_number[$acq] = $aryA[7];
$Asource[$acq] = $aryA[8];
$acq++;
}
$sthA->finish();
if ($DB) {print "\nTotal abandon check queue calls: |$acq|$stmtA|\n";}
$callback_debug = "\nTotal abandon check queue calls: |$acq|\n";
if ($acq > 0)
{
$acq=0;
while ($sthArowsACQ > $acq)
{
### see if lead is in the hopper right now
$VHcount='';
$stmtA = "SELECT count(*) from vicidial_hopper where lead_id='$Alead_id[$acq]';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsACQh=$sthA->rows;
if ($sthArowsACQh > 0)
{
@aryA = $sthA->fetchrow_array;
$VHcount = $aryA[0];
}
$sthA->finish();
if ($VHcount > 0)
{
# Update vicidial_abandon_check_queue record with REJECT status
$stmtA = "UPDATE vicidial_abandon_check_queue SET check_status='REJECT', reject_reason='Lead already in hopper, process' where abandon_check_id='$Aabandon_check_id[$acq]';";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print "vicidial_abandon_check_queue UPDATED: $affected_rows|$stmtA|\n";}
$acq_rejected = ($acq_rejected + $affected_rows);
$callback_debug .= " Abandon Already in hopper REJECT: $affected_rows|$acq|$Aabandon_check_id[$acq]|$Alead_id[$acq]\n";
}
else
{
### see if lead is in a call with an agent right now
$VLAcount='';
$stmtA = "SELECT count(*) from vicidial_live_agents where lead_id='$Alead_id[$acq]';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsACQa=$sthA->rows;
if ($sthArowsACQa > 0)
{
@aryA = $sthA->fetchrow_array;
$VLAcount = $aryA[0];
}
$sthA->finish();
if ($VLAcount > 0)
{
# Update vicidial_abandon_check_queue record with REJECT status
$stmtA = "UPDATE vicidial_abandon_check_queue SET check_status='REJECT', reject_reason='Lead in agent call, process' where abandon_check_id='$Aabandon_check_id[$acq]';";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print "vicidial_abandon_check_queue UPDATED: $affected_rows|$stmtA|\n";}
$acq_rejected = ($acq_rejected + $affected_rows);
$callback_debug .= " Abandon AGENT CALL REJECT: $affected_rows|$acq|$Aabandon_check_id[$acq]|$Alead_id[$acq]\n";
}
else
{
### see if lead is an active call right now
$VACcount='';
$stmtA = "SELECT count(*) from vicidial_auto_calls where lead_id='$Alead_id[$acq]';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsACQc=$sthA->rows;
if ($sthArowsACQc > 0)
{
@aryA = $sthA->fetchrow_array;
$VACcount = $aryA[0];
}
$sthA->finish();
if ($VACcount > 0)
{
if ($DBX) {print "vicidial_abandon_check ACTIVE CALL: $Alead_id[$acq]|$Aabandon_check_id[$acq]|$Acall_id[$acq]|$Aabandon_time[$acq]|\n";}
$acq_active_call++;
}
else
{
### see if lead was handled by an agent after abandon
$VALcount='';
$stmtA = "SELECT count(*) from vicidial_agent_log where lead_id='$Alead_id[$acq]' and event_time > \"$VDL_eighteen\" and talk_epoch > $Aabandon_timeEPOCH[$acq];";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsACQv=$sthA->rows;
if ($sthArowsACQv > 0)
{
@aryA = $sthA->fetchrow_array;
$VALcount = $aryA[0];
}
$sthA->finish();
if ($VALcount > 0)
{
# Update vicidial_abandon_check_queue record with REJECT status
$stmtA = "UPDATE vicidial_abandon_check_queue SET check_status='REJECT', reject_reason='Lead handled by agent, process' where abandon_check_id='$Aabandon_check_id[$acq]';";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print "vicidial_abandon_check_queue UPDATED agent: $affected_rows|$stmtA|\n";}
$acq_rejected = ($acq_rejected + $affected_rows);
$callback_debug .= " Abandon UPDATED, Agent REJECT: $affected_rows|$acq|$Aabandon_check_id[$acq]|$Alead_id[$acq]\n";
}
else
{
### see if lead was recently in the live_inboud_log table (Y2281224360000140002)
$Alive_channel=0;
$Achannel=''; $Aserver_ip=''; $Acaller_id=''; $Astart_time=''; $Acomment_d='';
$stmtA = "SELECT channel,server_ip,caller_id,start_time,comment_d from live_inbound_log where start_time > \"$VDL_hour\" and caller_id LIKE \"%$Alead_id[$acq]\" order by start_time desc limit 1;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsACQc=$sthA->rows;
if ($sthArowsACQc > 0)
{
@aryA = $sthA->fetchrow_array;
$Achannel = $aryA[0];
$Aserver_ip = $aryA[1];
$Acaller_id = $aryA[2];
$Astart_time = $aryA[3];
$Acomment_d = $aryA[4];
}
$sthA->finish();
if ($sthArowsACQc > 0)
{
$stmtA = "SELECT count(*) from live_channels where server_ip='$Aserver_ip' and channel='$Achannel';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsACQlc=$sthA->rows;
if ($sthArowsACQlc > 0)
{
@aryA = $sthA->fetchrow_array;
$Alive_channel = $aryA[0];
}
$sthA->finish();
}
if ($Alive_channel > 0)
{
if ($DBX) {print "vicidial_abandon_check ACTIVE CHANNEL: $Alead_id[$acq]|$Aabandon_check_id[$acq]|$Acall_id[$acq]|$Aabandon_time[$acq]|$Aserver_ip|$Achannel|\n";}
$acq_active_call++;
$callback_debug .= " Abandon ACTIVE CHANNEL: $affected_rows|$acq|$Aabandon_check_id[$acq]|$Alead_id[$acq]\n";
}
else
{
if ( ($Areject_reason[$acq] =~ /DeadCheck/) && ($Acheck_status[$acq] =~ /PROCESSING/) )
{
### call is dead, 2nd check, time to insert lead into hopper through the Non-Agent API update_lead function
$stmtA = "UPDATE vicidial_abandon_check_queue SET check_status='COMPLETE', reject_reason='DEAD: |$now_date|$Aserver_ip|$Achannel' where abandon_check_id='$Aabandon_check_id[$acq]';";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print "vicidial_abandon_check_queue UPDATED, Complete: $affected_rows|$stmtA|\n";}
$acq_complete_dead = ($acq_complete_dead + $affected_rows);
$callback_debug .= " Abandon UPDATED, Complete DEAD: $affected_rows|$acq|$Aabandon_check_id[$acq]|$Alead_id[$acq]\n";
### find wget binary
$exit_no_wget=0;
$wgetbin = '';
if ( -e ('/bin/wget')) {$wgetbin = '/bin/wget';}
else
{
if ( -e ('/usr/bin/wget')) {$wgetbin = '/usr/bin/wget';}
else
{
if ( -e ('/usr/local/bin/wget')) {$wgetbin = '/usr/local/bin/wget';}
else
{
if ($AGILOG) {$agi_string = "Can't find wget binary! Exiting..."; &agi_output;}
$exit_no_wget=1;
}
}
}
if ($exit_no_wget > 0)
{
if ($DB) {print "vicidial_abandon_check_queue ERROR, wget not found!\n";}
$callback_debug .= " Abandon ERROR: wget not found!\n";
}
else
{
$abandon_hopper_url='';
$stmtA= "SELECT container_entry from vicidial_settings_containers where container_id='ABANDON_HOPPER_URL';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsAHU=$sthA->rows;
if ($sthArowsAHU > 0)
{
@aryA = $sthA->fetchrow_array;
$abandon_hopper_url = $aryA[0];
}
$sthA->finish();
if (length($abandon_hopper_url) < 5)
{
if ($DB) {print "vicidial_abandon_check_queue ERROR, ABANDON_HOPPER_URL not valid! |$abandon_hopper_url|\n";}
$callback_debug .= " Abandon ERROR: URL not valid! |$abandon_hopper_url|\n";
}
else
{
$temp_lead_id = $Alead_id[$acq];
$temp_phone_number = $Aphone_number[$acq];
$temp_source = $Asource[$acq];
$temp_call_id = $Acall_id[$acq];
$temp_abandon_time = $Aabandon_time[$acq];
$temp_reject_reason = $Areject_reason[$acq];
$temp_check_status = $Acheck_status[$acq];
$abandon_hopper_url =~ s/--A--lead_id--B--/$temp_lead_id/gi;
$abandon_hopper_url =~ s/--A--phone_number--B--/$temp_phone_number/gi;
$abandon_hopper_url =~ s/--A--source--B--/$temp_source/gi;
$abandon_hopper_url =~ s/--A--call_id--B--/$temp_call_id/gi;
$abandon_hopper_url =~ s/--A--abandon_time--B--/$temp_abandon_time/gi;
$abandon_hopper_url =~ s/--A--reject_reason--B--/$temp_reject_reason/gi;
$abandon_hopper_url =~ s/--A--check_status--B--/$temp_check_status/gi;
$abandon_hopper_url =~ s/ /+/gi;
$abandon_hopper_url =~ s/&/\\&/gi;
### insert a new url log entry
$SQL_log = "$abandon_hopper_url";
$SQL_log =~ s/;|\||\\//gi;
$stmtA = "INSERT INTO vicidial_url_log SET uniqueid='$uniqueid',url_date='$now_date',url_type='abandonchk',url='$SQL_log',url_response='';";
$affected_rows = $dbhA->do($stmtA);
$stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;";
$sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$url_id = $aryA[0];
}
$sthA->finish();
$url = $abandon_hopper_url;
$url =~ s/'/\\'/gi;
$url =~ s/"/\\"/gi;
$secW = time();
`$wgetbin --no-check-certificate --output-document=/tmp/ASUBtmpD$US$url_id$US$secX --output-file=/tmp/ASUBtmpF$US$url_id$US$secX $url `;
$secY = time();
$response_sec = ($secY - $secW);
open(Wdoc, "/tmp/ASUBtmpD$US$url_id$US$secX") || die "can't open /tmp/ASUBtmpD$US$url_id$US$secX: $!\n";
@Wdoc = <Wdoc>;
close(Wdoc);
$i=0;
$Wdocline_cat='';
foreach(@Wdoc)
{
$Wdocline = $Wdoc[$i];
$Wdocline =~ s/\n|\r//gi;
$Wdocline =~ s/\t|\`|\"//gi;
$Wdocline_cat .= "$Wdocline";
$i++;
}
if (length($Wdocline_cat) < 1)
{
$Wdocline_cat='<RESPONSE EMPTY>';
}
open(Wfile, "/tmp/ASUBtmpF$US$url_id$US$secX") || die "can't open /tmp/ASUBtmpF$US$url_id$US$secX: $!\n";
@Wfile = <Wfile>;
close(Wfile);
$i=0;
$Wfileline_cat='';
foreach(@Wfile)
{
$Wfileline = $Wfile[$i];
$Wfileline =~ s/\n|\r/!/gi;
$Wfileline =~ s/\"|\`/'/gi;
$Wfileline =~ s/ |\t|\`//gi;
$Wfileline_cat .= "$Wfileline";
$i++;
}
if (length($Wfileline_cat)<1)
{$Wfileline_cat='<HEADER EMPTY>';}
### update url log entry
$stmtA = "UPDATE vicidial_url_log SET url_response=\"$Wdocline_cat|$Wfileline_cat\",response_sec='$response_sec' where url_log_id='$url_id';";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print "vicidial_abandon_check_queue SENT, vicidial_url_log: $url_id|$response_sec|\n";}
$hopper_insert_sent++;
$callback_debug .= " Abandon SENT: $affected_rows|$acq|$Aabandon_check_id[$acq]|$Alead_id[$acq]\n";
}
}
}
else
{
### call is dead, 1st check, flag record
$stmtA = "UPDATE vicidial_abandon_check_queue SET check_status='PROCESSING', reject_reason='DeadCheck $now_date' where abandon_check_id='$Aabandon_check_id[$acq]';";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print "vicidial_abandon_check_queue UPDATED, Dead Check: $affected_rows|$stmtA|\n";}
$acq_check_dead = ($acq_check_dead + $affected_rows);
$callback_debug .= " Abandon UPDATED, Dead Check: $affected_rows|$acq|$Aabandon_check_id[$acq]|$Alead_id[$acq]\n";
}
}
}
}
}
}
$acq++;
if ($DB)
{
if ($acq =~ /10$/i) {print STDERR "0 $acq / $sthArowsACQ \r";}
if ($acq =~ /20$/i) {print STDERR "+ $acq / $sthArowsACQ \r";}
if ($acq =~ /30$/i) {print STDERR "| $acq / $sthArowsACQ \r";}
if ($acq =~ /40$/i) {print STDERR "\\ $acq / $sthArowsACQ \r";}
if ($acq =~ /50$/i) {print STDERR "- $acq / $sthArowsACQ \r";}
if ($acq =~ /60$/i) {print STDERR "/ $acq / $sthArowsACQ \r";}
if ($acq =~ /70$/i) {print STDERR "| $acq / $sthArowsACQ \r";}
if ($acq =~ /80$/i) {print STDERR "+ $acq / $sthArowsACQ \r";}
if ($acq =~ /90$/i) {print STDERR "0 $acq / $sthArowsACQ \r";}
if ($acq =~ /00$/i)
{
print "$acq / $sthArowsACQ ($acq_rejected|$acq_check_dead|$acq_complete_dead|$acq_active_call|$hopper_insert_sent| |$Alead_id[$acq]|$Aabandon_check_id[$acq]|$Acall_id[$acq]|$Aabandon_time[$acq]| \n";
}
}
}
}
if ($DB) {print "Abandon check queue finished - calls: $acq rejected: $acq_rejected ($acq_check_dead|$acq_complete_dead|$acq_active_call|$hopper_insert_sent) \n";}
$callback_debug .= "\nAbandon check queue finished - calls: $acq rejected: $acq_rejected ($acq_check_dead|$acq_complete_dead|$acq_active_call|$hopper_insert_sent)\n";
$callback_debug_flag='--ABANDON-QUEUE--';
&callback_logger;
}
##########################################################
##### END check for abandon_check_queue calls #####
##########################################################
usleep($CLIdelay*1000*1000);
$stat_count++;
@@ -2134,6 +2523,27 @@ sub adaptive_logger
$adaptive_string='';
}
sub callback_logger
{
if ($SYSLOG)
{
$VDHCLOGfile = "$PATHlogs/VDadaptive-$callback_debug_flag.$file_date";
### open the log file for writing ###
open(Aout, ">>$VDHCLOGfile")
|| die "Can't open $VDHCLOGfile: $!\n";
print Aout "$now_date$adaptive_string\n";
close(Aout);
}
$stmtA = "UPDATE vicidial_campaign_stats_debug SET entry_time='$now_date',adapt_output='$callback_debug' where campaign_id='$callback_debug_flag' and server_ip='ADAPT';";
$affected_rows = $dbhA->do($stmtA);
$adaptive_string='';
}
sub get_time_now
{
$secX = time();
@@ -2189,6 +2599,15 @@ sub get_time_now
if ($Vmday < 10) {$Vmday = "0$Vmday";}
$VDL_one = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec";
### get date-time of 18 hours ago ###
$VDL_eighteen = ($secX - (18 * 60 * 60));
($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_eighteen);
$Vyear = ($Vyear + 1900);
$Vmon++;
if ($Vmon < 10) {$Vmon = "0$Vmon";}
if ($Vmday < 10) {$Vmday = "0$Vmday";}
$VDL_eighteen = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec";
$timeclock_end_of_day_NOW=0;
### Grab system_settings values from the database
$stmtA = "SELECT count(*) from system_settings where timeclock_end_of_day LIKE \"%$current_hourmin%\";";