Added new campaign feature to automatically reschedule ANYONE callbacks when they are dispositioned as a non-Human-Answered status flag status.

git-svn-id: svn://192.168.202.10@3018 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2018-08-19 04:01:41 +00:00
parent 69192f6696
commit 2f2cdd004e
10 changed files with 1041 additions and 262 deletions
+46 -1
View File
@@ -129,9 +129,10 @@
# 180204-0931 - Added rolling of vicidial_inbound_callback_queue records
# 180301-1257 - Added more teodDB logging
# 180512-2214 - Added reset of hopper_calls_today
# 180818-2229 - Added rolling of vicidial_recent_ascb_calls records
#
$build = '180512-2214';
$build = '180818-2229';
$DB=0; # Debug flag
$teodDB=0; # flag to log Timeclock End of Day processes to log file
@@ -1409,6 +1410,32 @@ if ($timeclock_end_of_day_NOW > 0)
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
}
# roll of SENT/EXPIRED vicidial_recent_ascb_calls records
if (!$Q) {print "\nProcessing vicidial_recent_ascb_calls table...\n";}
$stmtA = "INSERT IGNORE INTO vicidial_recent_ascb_calls_archive SELECT * from vicidial_recent_ascb_calls where call_date < \"$TDSQLdate\";";
$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_recent_ascb_calls_archive table";
if (!$Q) {print "$event_string \n";}
if ($teodDB) {&teod_logger;}
$rv = $sthA->err();
if (!$rv)
{
$stmtA = "DELETE FROM vicidial_recent_ascb_calls WHERE call_date < \"$TDSQLdate\";";
$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_recent_ascb_calls table";
if (!$Q) {print "$event_string \n";}
if ($teodDB) {&teod_logger;}
$stmtA = "optimize table vicidial_recent_ascb_calls;";
$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;
@@ -1629,6 +1656,24 @@ if ($timeclock_end_of_day_NOW > 0)
##### END vicidial_vdad_log end of day process removing records older than 7 days #####
##### BEGIN vicidial_recent_ascb_calls_archive end of day process removing records older than 7 days #####
$stmtA = "DELETE from vicidial_recent_ascb_calls_archive where call_date < \"$SDSQLdate\";";
if($DBX){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA);
if($DB){print STDERR "\n|$affected_rows vicidial_recent_ascb_calls_archive records older than 7 days purged|\n";}
if ($teodDB) {$event_string = "vicidial_recent_ascb_calls_archive records older than 7 days purged: |$stmtA|$affected_rows|"; &teod_logger;}
$stmtA = "optimize table vicidial_recent_ascb_calls_archive;";
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();
##### END vicidial_recent_ascb_calls_archive end of day process removing records older than 7 days #####
##### BEGIN usacan_phone_dialcode_fix funciton #####
if ($usacan_phone_dialcode_fix > 0)
{
+819 -224
View File
File diff suppressed because it is too large Load Diff
+35 -7
View File
@@ -41,6 +41,7 @@
# 170915-1915 - Added support for per server routing prefix needed for Asterisk 13+
# 171205-2022 - Fix for double-dialing issue on high-volume systems
# 180214-1558 - Added CID Group functionality
# 180812-1025 - Added code for scheduled_callbacks_auto_reschedule campaign feature
#
### begin parsing run-time options ###
@@ -341,7 +342,7 @@ while($one_day_interval > 0)
### grab the dial_level and multiply by active agents to get your goalcalls
$DBIPadlevel[$camp_CIPct]=0;
$stmtA = "SELECT dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,omit_phone_code,auto_alt_dial,queue_priority,use_custom_cid,cid_group_id FROM vicidial_campaigns where campaign_id='$DBfill_campaign[$camp_CIPct]';";
$stmtA = "SELECT dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,omit_phone_code,auto_alt_dial,queue_priority,use_custom_cid,cid_group_id,scheduled_callbacks_auto_reschedule FROM vicidial_campaigns where campaign_id='$DBfill_campaign[$camp_CIPct]';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -360,6 +361,7 @@ while($one_day_interval > 0)
$DBIPqueue_priority[$camp_CIPct] = $aryA[7];
$DBIPuse_custom_cid[$camp_CIPct] = $aryA[8];
$DBIPcid_group_id[$camp_CIPct] = $aryA[9];
$DBIPscheduled_callbacks_auto_reschedule[$camp_CIPct] = $aryA[10];
if ($omit_phone_code =~ /Y/) {$DBIPomitcode[$camp_CIPct] = 1;}
else {$DBIPomitcode[$camp_CIPct] = 0;}
@@ -607,7 +609,7 @@ while($one_day_interval > 0)
$lead_id=''; $phone_code=''; $phone_number=''; $called_count='';
while ($call_CMPIPct < $UDaffected_rows)
{
$stmtA = "SELECT lead_id,alt_dial FROM vicidial_hopper where campaign_id='$DBfill_campaign[$camp_CIPct]' and status='QUEUE' and user='VDFC_$DB_camp_server_server_ip[$server_CIPct]' order by priority desc,hopper_id LIMIT 1;";
$stmtA = "SELECT lead_id,alt_dial,source FROM vicidial_hopper where campaign_id='$DBfill_campaign[$camp_CIPct]' and status='QUEUE' and user='VDFC_$DB_camp_server_server_ip[$server_CIPct]' order by priority desc,hopper_id LIMIT 1;";
print "|$stmtA|\n";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -616,8 +618,9 @@ while($one_day_interval > 0)
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$lead_id = $aryA[0];
$alt_dial = $aryA[1];
$lead_id = $aryA[0];
$alt_dial = $aryA[1];
$hopper_source = $aryA[2];
}
$sthA->finish();
@@ -755,6 +758,34 @@ while($one_day_interval > 0)
$vl_updates[$staggered_ct] = $stmtA;
}
$PADlead_id = sprintf("%010s", $lead_id); while (length($PADlead_id) > 10) {chop($PADlead_id);}
# VmddhhmmssLLLLLLLLLL Set the callerIDname to a unique call_id string
$VqueryCID = "V$CIDdate$PADlead_id";
if ( ( ($DBIPscheduled_callbacks_auto_reschedule[$camp_CIPct] !~ /DISABLED/) && (length($DBIPscheduled_callbacks_auto_reschedule[$camp_CIPct]) > 0) ) || ($hopper_source eq 'C') )
{
### gather vicidial_callbacks information for this lead, if any
$stmtA = "SELECT callback_id,callback_time,lead_status,list_id FROM vicidial_callbacks where lead_id='$lead_id' and status='LIVE' and recipient='ANYONE' order by callback_id limit 1;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsPSCB=$sthA->rows;
if ($sthArowsPSCB > 0)
{
@aryA = $sthA->fetchrow_array;
$PSCBcallback_id = $aryA[0];
$PSCBcallback_time = $aryA[1];
$PSCBlead_status = $aryA[2];
$PSCBlist_id = $aryA[3];
}
$sthA->finish();
### insert record in recent callbacks table
if ($sthArowsPSCB > 0)
{
$stmtA = "INSERT INTO vicidial_recent_ascb_calls SET call_date=NOW(),callback_date='$PSCBcallback_time',callback_id='$PSCBcallback_id',caller_code='$VqueryCID',lead_id='$lead_id',server_ip='$DB_camp_server_server_ip[$server_CIPct]',orig_status='$PSCBlead_status',reschedule='$DBIPscheduled_callbacks_auto_reschedule[$camp_CIPct]',list_id='$PSCBlist_id',rescheduled='U';";
$affected_rows = $dbhA->do($stmtA);
}
}
$stmtA = "DELETE FROM vicidial_hopper where lead_id='$lead_id';";
$affected_rows = $dbhA->do($stmtA);
@@ -876,7 +907,6 @@ while($one_day_interval > 0)
if ( (length($RECprefix)>0) && ($called_count < $RECcount) )
{$Local_out_prefix .= "$RECprefix";}
}
$PADlead_id = sprintf("%010s", $lead_id); while (length($PADlead_id) > 10) {chop($PADlead_id);}
if ($lists_update !~ /'$list_id'/) {$lists_update .= "'$list_id',"; $LUcount++;}
@@ -892,8 +922,6 @@ while($one_day_interval > 0)
if (length($ext_context) < 1) {$ext_context='default';}
### use manager middleware-app to connect the next call to the meetme room
# VmmddhhmmssLLLLLLLLL
$VqueryCID = "V$CIDdate$PADlead_id";
if ($CCID_on) {$CIDstring = "\"$VqueryCID\" <$CCID>";}
else {$CIDstring = "$VqueryCID";}