Call Quota Lead Ranking feature-set production tested and ready to use. Updated log auditing related to this as well as documentation.
git-svn-id: svn://192.168.202.10@3125 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -420,6 +420,10 @@ OTHER CHANGES:
|
||||
116. Added new Non-Agent API 'custom_fields_copy' option to the 'add_list'
|
||||
function
|
||||
|
||||
117. Added new Call Quota Lead Ranking recycling feature-set. A new and
|
||||
completely different way to do lead recycling for outbound campaigns.
|
||||
See the CALL_QUOTA_LEAD_RANKING.txt document for more info
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+103
-86
@@ -50,6 +50,7 @@
|
||||
# 180519-2303 - Added Waiting Call On/Off URL feature for in-groups
|
||||
# 190216-0809 - Fix for user-group, in-group and campaign allowed/permissions matching issues
|
||||
# 190720-2122 - Added audit and fixing of missing outbound auto-dial logs if Call Quotas is enabled
|
||||
# 190722-1004 - Added more logging and log-audit portions to Call Quotas log audit code
|
||||
#
|
||||
|
||||
|
||||
@@ -1759,6 +1760,8 @@ while ($master_loop < $CLIloops)
|
||||
if ( ( ($stat_count =~ /30$|80$/) || ($stat_count==1) ) && ($SScall_quota_lead_ranking > 0) )
|
||||
{
|
||||
$audit_inserts=0;
|
||||
$updated_dial_log_no_uid=0;
|
||||
$count_dial_log_no_uid=0;
|
||||
|
||||
$now_epoch = time();
|
||||
$NBtarget = ($now_epoch - 420);
|
||||
@@ -1783,7 +1786,7 @@ while ($master_loop < $CLIloops)
|
||||
if ($Nsec < 10) {$Nsec = "0$Nsec";}
|
||||
$NEtsSQLdate = "$Nyear-$Nmon-$Nmday $Nhour:$Nmin:$Nsec";
|
||||
|
||||
$stmtA = "SELECT caller_code,lead_id,server_ip,call_date,uniqueid from vicidial_dial_log where call_date > \"$NBtsSQLdate\" and call_date < \"$NEtsSQLdate\" and uniqueid!='';";
|
||||
$stmtA = "SELECT caller_code,lead_id,server_ip,call_date,uniqueid from vicidial_dial_log where call_date > \"$NBtsSQLdate\" and call_date < \"$NEtsSQLdate\";";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsMVL=$sthA->rows;
|
||||
@@ -1808,139 +1811,153 @@ while ($master_loop < $CLIloops)
|
||||
while ($sthArowsMVL > $mvl)
|
||||
{
|
||||
### see if call was logged properly to vicidial_log_extended
|
||||
$VLEcount=0;
|
||||
$stmtA = "SELECT count(*) from vicidial_log_extended where caller_code='$Mcaller_code[$mvl]';";
|
||||
$VLEuniqueid='';
|
||||
$stmtA = "SELECT uniqueid from vicidial_log_extended where caller_code='$Mcaller_code[$mvl]' and lead_id='$Mlead_id[$mvl]';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsVLEc=$sthA->rows;
|
||||
if ($sthArowsVLEc > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VLEcount = $aryA[0];
|
||||
$VLEuniqueid = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
if ( (length($Muniqueid[$mvl]) < 9) && (length($VLEuniqueid) >= 9) )
|
||||
{
|
||||
$Muniqueid[$mvl] = $VLEuniqueid;
|
||||
# Update dial log record with correct uniqueid
|
||||
$stmtA = "UPDATE vicidial_dial_log SET uniqueid='$VLEuniqueid' where caller_code='$Mcaller_code[$mvl]' and lead_id='$Mlead_id[$mvl]' limit 1;";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if ($DBX) {print "vicidial_dial_log UPDATED: $affected_rows|$stmtA|\n";}
|
||||
$updated_dial_log_no_uid = ($updated_dial_log_no_uid + $affected_rows);
|
||||
}
|
||||
|
||||
if ($VLEcount > 0)
|
||||
if ($sthArowsVLEc > 0)
|
||||
{$do_nothing=1;}
|
||||
else
|
||||
{
|
||||
### see if call was logged properly to vicidial_log
|
||||
$VLcount=0;
|
||||
$temp_uniquiid = $Muniqueid[$mvl];
|
||||
$temp_uniquiid =~ s/\..*//gi;
|
||||
$stmtA = "SELECT count(*) from vicidial_log where uniqueid LIKE \"$temp_uniquiid%\" and lead_id='$Mlead_id[$mvl]';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsVLc=$sthA->rows;
|
||||
if ($sthArowsVLc > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VLcount = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
if ($VLcount > 0)
|
||||
{$do_nothing=1;}
|
||||
if (length($Muniqueid[$mvl]) < 9)
|
||||
{$count_dial_log_no_uid++;}
|
||||
else
|
||||
{
|
||||
# no vicidial_log entry found, look for call_log entry
|
||||
### see if call was logged properly to vicidial_log
|
||||
$VLcount=0;
|
||||
$stmtA = "SELECT number_dialed,length_in_sec,end_time,end_epoch from call_log where uniqueid='$Muniqueid[$mvl]' limit 1;";
|
||||
$temp_uniquiid = $Muniqueid[$mvl];
|
||||
$temp_uniquiid =~ s/\..*//gi;
|
||||
$stmtA = "SELECT count(*) from vicidial_log where uniqueid LIKE \"$temp_uniquiid%\" and lead_id='$Mlead_id[$mvl]';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsCLc=$sthA->rows;
|
||||
if ($sthArowsCLc > 0)
|
||||
$sthArowsVLc=$sthA->rows;
|
||||
if ($sthArowsVLc > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$Mnumber_dialed[$mvl] = $aryA[0];
|
||||
$Mlength_in_sec[$mvl] = $aryA[1];
|
||||
$Mend_time[$mvl] = $aryA[2];
|
||||
$Mend_epoch[$mvl] = $aryA[3];
|
||||
$VLcount = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
if ($sthArowsCLc > 0)
|
||||
if ($VLcount > 0)
|
||||
{$do_nothing=1;}
|
||||
else
|
||||
{
|
||||
# call_log entry found, look for lead details in vicidial_list
|
||||
$stmtA = "SELECT list_id,status,phone_code,phone_number,alt_phone,address3,called_count from vicidial_list where lead_id='$Mlead_id[$mvl]' limit 1;";
|
||||
# no vicidial_log entry found, look for call_log entry
|
||||
$VLcount=0;
|
||||
$stmtA = "SELECT number_dialed,length_in_sec,end_time,end_epoch from call_log where uniqueid='$Muniqueid[$mvl]' limit 1;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsLEADc=$sthA->rows;
|
||||
if ($sthArowsLEADc > 0)
|
||||
$sthArowsCLc=$sthA->rows;
|
||||
if ($sthArowsCLc > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$Llist_id = $aryA[0];
|
||||
$Lstatus = $aryA[1];
|
||||
$Lphone_code = $aryA[2];
|
||||
$Lphone_number = $aryA[3];
|
||||
$Lalt_phone = $aryA[4];
|
||||
$Laddress3 = $aryA[5];
|
||||
$Lcalled_count = $aryA[6];
|
||||
$Mnumber_dialed[$mvl] = $aryA[0];
|
||||
$Mlength_in_sec[$mvl] = $aryA[1];
|
||||
$Mend_time[$mvl] = $aryA[2];
|
||||
$Mend_epoch[$mvl] = $aryA[3];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
if ($sthArowsLEADc < 1)
|
||||
{$no_lead_found=1;}
|
||||
else
|
||||
if ($sthArowsCLc > 0)
|
||||
{
|
||||
# vicidial_list entry found, look for list details in vicidial_lists
|
||||
$stmtA = "SELECT campaign_id from vicidial_lists where list_id='$Llist_id' limit 1;";
|
||||
# call_log entry found, look for lead details in vicidial_list
|
||||
$stmtA = "SELECT list_id,status,phone_code,phone_number,alt_phone,address3,called_count from vicidial_list where lead_id='$Mlead_id[$mvl]' limit 1;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsLEADc=$sthA->rows;
|
||||
if ($sthArowsLEADc > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$Lcampaign_id = $aryA[0];
|
||||
$Llist_id = $aryA[0];
|
||||
$Lstatus = $aryA[1];
|
||||
$Lphone_code = $aryA[2];
|
||||
$Lphone_number = $aryA[3];
|
||||
$Lalt_phone = $aryA[4];
|
||||
$Laddress3 = $aryA[5];
|
||||
$Lcalled_count = $aryA[6];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
$Lalt='MAIN';
|
||||
if ( ($Mnumber_dialed[$mvl] =~ /$Lphone_number$/) && (length($Lphone_number) >= 6) ) {$Lalt='MAIN';}
|
||||
if ($sthArowsLEADc < 1)
|
||||
{$no_lead_found=1;}
|
||||
else
|
||||
{
|
||||
if ( ($Mnumber_dialed[$mvl] =~ /$Lalt_phone$/) && (length($Lalt_phone) >= 6) ) {$Lalt='ALT';}
|
||||
else
|
||||
{
|
||||
if ( ($Mnumber_dialed[$mvl] =~ /$Laddress3$/) && (length($Laddress3) >= 6) ) {$Lalt='ADDR3';}
|
||||
}
|
||||
}
|
||||
|
||||
$stmtVL = "INSERT INTO vicidial_log SET uniqueid='$Muniqueid[$mvl]',lead_id='$Mlead_id[$mvl]',campaign_id='$Lcampaign_id',call_date='$Mend_time[$mvl]',start_epoch='$Mend_epoch[$mvl]',status='NA',phone_code='$Lphone_code',phone_number='$Lphone_number',user='VDAD',processed='N',length_in_sec=0,end_epoch='$Mend_epoch[$mvl]',alt_dial='$Lalt',list_id='$Llist_id',called_count='$Lcalled_count',comments='AUTONA',term_reason='NONE';";
|
||||
$affected_rowsVL = $dbhA->do($stmtVL);
|
||||
if($DBX){print "$mvl|$affected_rowsVL|$stmtVL|\n";}
|
||||
$audit_inserts = ($audit_inserts + $affected_rowsVL);
|
||||
|
||||
$stmtVLE = "INSERT INTO vicidial_log_extended set uniqueid='$Muniqueid[$mvl]',server_ip='$Mserver_ip[$mvl]',call_date='$Mend_time[$mvl]',lead_id = '$Mlead_id[$mvl]',caller_code='$Mcaller_code[$mvl]',custom_call_id='';";
|
||||
$affected_rowsVLE = $dbhA->do($stmtVLE);
|
||||
if($DBX){print "$mvl|$affected_rowsVLE|$stmtVLE|\n";}
|
||||
|
||||
if ($Lstatus ne 'NA')
|
||||
{
|
||||
$stmtLEAD = "UPDATE vicidial_list set status='NA where lead_id='$Mlead_id[$mvl]';";
|
||||
$affected_rowsLEAD = $dbhA->do($stmtLEAD);
|
||||
if($DBX){print "$mvl|$affected_rowsLEAD|$stmtLEAD|\n";}
|
||||
}
|
||||
if ($SScall_quota_lead_ranking > 0)
|
||||
{
|
||||
$VD_call_quota_lead_ranking='DISABLED';
|
||||
# find call quota setting for campaign, to see if call quota logging is enabled
|
||||
$stmtA = "SELECT call_quota_lead_ranking from vicidial_campaigns where campaign_id='$Lcampaign_id' limit 1;";
|
||||
# vicidial_list entry found, look for list details in vicidial_lists
|
||||
$stmtA = "SELECT campaign_id from vicidial_lists where list_id='$Llist_id' limit 1;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsCAMPc=$sthA->rows;
|
||||
if ($sthArowsCAMPc > 0)
|
||||
$sthArowsLEADc=$sthA->rows;
|
||||
if ($sthArowsLEADc > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VD_call_quota_lead_ranking = $aryA[0];
|
||||
$Lcampaign_id = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
if ($VD_call_quota_lead_ranking !~ /^DISABLED$/i)
|
||||
$Lalt='MAIN';
|
||||
if ( ($Mnumber_dialed[$mvl] =~ /$Lphone_number$/) && (length($Lphone_number) >= 6) ) {$Lalt='MAIN';}
|
||||
else
|
||||
{
|
||||
$CIDlead_id = $Mlead_id[$mvl];
|
||||
$temp_status = 'NA';
|
||||
&call_quota_logging;
|
||||
if ( ($Mnumber_dialed[$mvl] =~ /$Lalt_phone$/) && (length($Lalt_phone) >= 6) ) {$Lalt='ALT';}
|
||||
else
|
||||
{
|
||||
if ( ($Mnumber_dialed[$mvl] =~ /$Laddress3$/) && (length($Laddress3) >= 6) ) {$Lalt='ADDR3';}
|
||||
}
|
||||
}
|
||||
|
||||
$stmtVL = "INSERT INTO vicidial_log SET uniqueid='$Muniqueid[$mvl]',lead_id='$Mlead_id[$mvl]',campaign_id='$Lcampaign_id',call_date='$Mend_time[$mvl]',start_epoch='$Mend_epoch[$mvl]',status='NA',phone_code='$Lphone_code',phone_number='$Lphone_number',user='VDAD',processed='N',length_in_sec=0,end_epoch='$Mend_epoch[$mvl]',alt_dial='$Lalt',list_id='$Llist_id',called_count='$Lcalled_count',comments='AUTONA',term_reason='NONE';";
|
||||
$affected_rowsVL = $dbhA->do($stmtVL);
|
||||
if($DBX){print "$mvl|$affected_rowsVL|$stmtVL|\n";}
|
||||
$audit_inserts = ($audit_inserts + $affected_rowsVL);
|
||||
|
||||
$stmtVLE = "INSERT INTO vicidial_log_extended set uniqueid='$Muniqueid[$mvl]',server_ip='$Mserver_ip[$mvl]',call_date='$Mend_time[$mvl]',lead_id = '$Mlead_id[$mvl]',caller_code='$Mcaller_code[$mvl]',custom_call_id='';";
|
||||
$affected_rowsVLE = $dbhA->do($stmtVLE);
|
||||
if($DBX){print "$mvl|$affected_rowsVLE|$stmtVLE|\n";}
|
||||
|
||||
if ($Lstatus ne 'NA')
|
||||
{
|
||||
$stmtLEAD = "UPDATE vicidial_list set status='NA' where lead_id='$Mlead_id[$mvl]';";
|
||||
$affected_rowsLEAD = $dbhA->do($stmtLEAD);
|
||||
if($DBX){print "$mvl|$affected_rowsLEAD|$stmtLEAD|\n";}
|
||||
}
|
||||
if ($SScall_quota_lead_ranking > 0)
|
||||
{
|
||||
$VD_call_quota_lead_ranking='DISABLED';
|
||||
# find call quota setting for campaign, to see if call quota logging is enabled
|
||||
$stmtA = "SELECT call_quota_lead_ranking from vicidial_campaigns where campaign_id='$Lcampaign_id' limit 1;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsCAMPc=$sthA->rows;
|
||||
if ($sthArowsCAMPc > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VD_call_quota_lead_ranking = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
if ($VD_call_quota_lead_ranking !~ /^DISABLED$/i)
|
||||
{
|
||||
$CIDlead_id = $Mlead_id[$mvl];
|
||||
$temp_status = 'NA';
|
||||
&call_quota_logging;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1961,12 +1978,12 @@ while ($master_loop < $CLIloops)
|
||||
if ($mvl =~ /90$/i) {print STDERR "0 $mvl / $sthArowsMVL \r";}
|
||||
if ($mvl =~ /00$/i)
|
||||
{
|
||||
print "$mvl / $sthArowsMVL ($log_updated|$log_inserted| |$LEADlist_id[$mvl]|$LEADINFOrank| \n";
|
||||
print "$mvl / $sthArowsMVL ($log_updated|$log_inserted|$count_dial_log_no_uid|$updated_dial_log_no_uid| |$LEADlist_id[$mvl]|$LEADINFOrank| \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($DB) {print "Outbound call log audit - calls: $mvl inserts: $audit_inserts \n";}
|
||||
if ($DB) {print "Outbound call log audit - calls: $mvl inserts: $audit_inserts ($count_dial_log_no_uid|$updated_dial_log_no_uid) \n";}
|
||||
}
|
||||
##########################################################
|
||||
##### END check for stuck SENDING inbound callback queue records #####
|
||||
|
||||
+104
-63
@@ -13,6 +13,7 @@
|
||||
#
|
||||
# CHANGELOG
|
||||
# 190705-1353 - First build
|
||||
# 190722-1005 - Added more log-audit code and log-fixing
|
||||
#
|
||||
|
||||
# constants
|
||||
@@ -307,6 +308,8 @@ if ($populate_call_quota_logs > 0)
|
||||
$update_status_ct=0;
|
||||
$update_session_ct=0;
|
||||
$update_day_ct=0;
|
||||
$skip_dial_log_no_uid=0;
|
||||
$updated_dial_log_no_uid=0;
|
||||
|
||||
# Gather a list of all lists within a campaign
|
||||
$stmtA = "SELECT list_id from vicidial_lists where campaign_id IN('$CLIcampaign');";
|
||||
@@ -378,7 +381,7 @@ if ($populate_call_quota_logs > 0)
|
||||
$lead_ct=0;
|
||||
while ($sthArowsLEADS > $lead_ct)
|
||||
{
|
||||
$stmtA = "SELECT call_date,UNIX_TIMESTAMP(call_date) from vicidial_dial_log where lead_id='$LEADlead_id[$lead_ct]' and call_date >= \"$SVSQLdate\" and uniqueid !='' order by call_date limit 1000;";
|
||||
$stmtA = "SELECT call_date,UNIX_TIMESTAMP(call_date),uniqueid,caller_code from vicidial_dial_log where lead_id='$LEADlead_id[$lead_ct]' and call_date >= \"$SVSQLdate\" order by call_date limit 1000;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsCALLS=$sthA->rows;
|
||||
@@ -389,9 +392,42 @@ if ($populate_call_quota_logs > 0)
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$LEADcall_date[$call_ct] = $aryA[0];
|
||||
$LEADcall_epoch[$call_ct] = $aryA[1];
|
||||
$LEADuniqueid[$call_ct] = $aryA[2];
|
||||
$LEADcaller_code[$call_ct] = $aryA[3];
|
||||
$call_ct++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
$call_ct=0;
|
||||
while ($sthArowsCALLS > $call_ct)
|
||||
{
|
||||
if (length($LEADuniqueid[$call_ct]) < 9)
|
||||
{
|
||||
# Look for extended log from dial log entry with no uniqueid
|
||||
$stmtA = "SELECT uniqueid from vicidial_log_extended where caller_code='$LEADcaller_code[$call_ct]' and lead_id='$LEADlead_id[$lead_ct]';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsVLEUID=$sthA->rows;
|
||||
if ($DBX > 0) {print "$sthArowsVLEUID|$stmtA\n";}
|
||||
if ($sthArowsVLEUID > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$LEADuniqueid[$call_ct] = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
if ( ($sthArowsVLEUID > 0) && (length($LEADuniqueid[$call_ct]) >= 9) )
|
||||
{
|
||||
# Update list record with cache counts
|
||||
$stmtA = "UPDATE vicidial_dial_log SET uniqueid='$LEADuniqueid[$call_ct]' where caller_code='$LEADcaller_code[$call_ct]' and lead_id='$LEADlead_id[$lead_ct]' limit 1;";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if ($DBX) {print "vicidial_dial_log UPDATED: $affected_rows|$stmtA|\n";}
|
||||
$event_string = "-- vicidial_dial_log record updated: $affected_rows|$stmtA|$update_debug|"; &event_logger;
|
||||
$updated_dial_log_no_uid = ($updated_dial_log_no_uid + $affected_rows);
|
||||
}
|
||||
}
|
||||
$call_ct++;
|
||||
}
|
||||
|
||||
if ($call_ct < 1)
|
||||
{
|
||||
if ($DBX > 0) {print "NO CALLS FOUND IN THE LAST 7 DAYS ON THIS LEAD: $LEADlead_id[$lead_ct]|$LEADlist_id[$lead_ct]|$call_ct \n";}
|
||||
@@ -443,70 +479,75 @@ if ($populate_call_quota_logs > 0)
|
||||
$start_day=1;
|
||||
while ($sthArowsCALLS > $call_ct)
|
||||
{
|
||||
@VDLcall_datetimeARY = split(/ /,$LEADcall_date[$call_ct]);
|
||||
@VDLcall_timeARY = split(/:/,$VDLcall_datetimeARY[1]);
|
||||
$VDLcall_hourmin = "$VDLcall_timeARY[0]$VDLcall_timeARY[1]";
|
||||
|
||||
if ( ($session_one_start <= $VDLcall_hourmin) and ($session_one_end > $VDLcall_hourmin) ) {$session_one_calls++;}
|
||||
if ( ($session_two_start <= $VDLcall_hourmin) and ($session_two_end > $VDLcall_hourmin) ) {$session_two_calls++;}
|
||||
if ( ($session_three_start <= $VDLcall_hourmin) and ($session_three_end > $VDLcall_hourmin) ) {$session_three_calls++;}
|
||||
if ( ($session_four_start <= $VDLcall_hourmin) and ($session_four_end > $VDLcall_hourmin) ) {$session_four_calls++;}
|
||||
if ( ($session_five_start <= $VDLcall_hourmin) and ($session_five_end > $VDLcall_hourmin) ) {$session_five_calls++;}
|
||||
if ( ($session_six_start <= $VDLcall_hourmin) and ($session_six_end > $VDLcall_hourmin) ) {$session_six_calls++;}
|
||||
|
||||
$VLCQClast_call_epoch = $LEADcall_epoch[$call_ct]; $VLCQClast_call_date = $LEADcall_date[$call_ct];
|
||||
if ($call_ct < 1)
|
||||
if (length($LEADuniqueid[$call_ct]) >= 9)
|
||||
{
|
||||
$VLCQCfirst_call_epoch = $LEADcall_epoch[$call_ct];
|
||||
$VLCQCfirst_call_date = $LEADcall_date[$call_ct];
|
||||
|
||||
if ($VLCQCfirst_call_epoch >= $today_start_epoch)
|
||||
{$start_day_epoch=$today_start_epoch; $start_day=1;}
|
||||
if ( ($VLCQCfirst_call_epoch >= $day_two_start_epoch) and ($VLCQCfirst_call_epoch < $today_start_epoch) )
|
||||
{$start_day_epoch=$day_two_start_epoch; $start_day=2;}
|
||||
if ( ($VLCQCfirst_call_epoch >= $day_three_start_epoch) and ($VLCQCfirst_call_epoch < $day_two_start_epoch) )
|
||||
{$start_day_epoch=$day_three_start_epoch; $start_day=3;}
|
||||
if ( ($VLCQCfirst_call_epoch >= $day_four_start_epoch) and ($VLCQCfirst_call_epoch < $day_three_start_epoch) )
|
||||
{$start_day_epoch=$day_four_start_epoch; $start_day=4;}
|
||||
if ( ($VLCQCfirst_call_epoch >= $day_five_start_epoch) and ($VLCQCfirst_call_epoch < $day_four_start_epoch) )
|
||||
{$start_day_epoch=$day_five_start_epoch; $start_day=5;}
|
||||
if ( ($VLCQCfirst_call_epoch >= $day_six_start_epoch) and ($VLCQCfirst_call_epoch < $day_five_start_epoch) )
|
||||
{$start_day_epoch=$day_six_start_epoch; $start_day=6;}
|
||||
if ( ($VLCQCfirst_call_epoch >= $day_seven_start_epoch) and ($VLCQCfirst_call_epoch < $day_six_start_epoch) )
|
||||
{$start_day_epoch=$day_seven_start_epoch; $start_day=7;}
|
||||
|
||||
$day_one_calls++;
|
||||
@VDLcall_datetimeARY = split(/ /,$LEADcall_date[$call_ct]);
|
||||
@VDLcall_timeARY = split(/:/,$VDLcall_datetimeARY[1]);
|
||||
$VDLcall_hourmin = "$VDLcall_timeARY[0]$VDLcall_timeARY[1]";
|
||||
|
||||
# calculate back to day 7 starting with day 1 = $start_day_epoch
|
||||
$Sday_two_start_epoch = ($start_day_epoch + (86400 * 1));
|
||||
$Sday_three_start_epoch = ($start_day_epoch + (86400 * 2));
|
||||
$Sday_four_start_epoch = ($start_day_epoch + (86400 * 3));
|
||||
$Sday_five_start_epoch = ($start_day_epoch + (86400 * 4));
|
||||
$Sday_six_start_epoch = ($start_day_epoch + (86400 * 5));
|
||||
$Sday_seven_start_epoch = ($start_day_epoch + (86400 * 6));
|
||||
$Sday_seven_end_epoch = ($start_day_epoch + (86400 * 7));
|
||||
if ($DBX > 0) {print "CQ-Debug 0: $VLCQCfirst_call_date|$start_day|$VLCQCfirst_call_epoch|$start_day_epoch|$Sday_two_start_epoch|$Sday_three_start_epoch|$Sday_four_start_epoch|$Sday_five_start_epoch|$Sday_six_start_epoch|$Sday_seven_start_epoch|\n";}
|
||||
if ( ($session_one_start <= $VDLcall_hourmin) and ($session_one_end > $VDLcall_hourmin) ) {$session_one_calls++;}
|
||||
if ( ($session_two_start <= $VDLcall_hourmin) and ($session_two_end > $VDLcall_hourmin) ) {$session_two_calls++;}
|
||||
if ( ($session_three_start <= $VDLcall_hourmin) and ($session_three_end > $VDLcall_hourmin) ) {$session_three_calls++;}
|
||||
if ( ($session_four_start <= $VDLcall_hourmin) and ($session_four_end > $VDLcall_hourmin) ) {$session_four_calls++;}
|
||||
if ( ($session_five_start <= $VDLcall_hourmin) and ($session_five_end > $VDLcall_hourmin) ) {$session_five_calls++;}
|
||||
if ( ($session_six_start <= $VDLcall_hourmin) and ($session_six_end > $VDLcall_hourmin) ) {$session_six_calls++;}
|
||||
|
||||
$VLCQClast_call_epoch = $LEADcall_epoch[$call_ct]; $VLCQClast_call_date = $LEADcall_date[$call_ct];
|
||||
if ($call_ct < 1)
|
||||
{
|
||||
$VLCQCfirst_call_epoch = $LEADcall_epoch[$call_ct];
|
||||
$VLCQCfirst_call_date = $LEADcall_date[$call_ct];
|
||||
|
||||
if ($VLCQCfirst_call_epoch >= $today_start_epoch)
|
||||
{$start_day_epoch=$today_start_epoch; $start_day=1;}
|
||||
if ( ($VLCQCfirst_call_epoch >= $day_two_start_epoch) and ($VLCQCfirst_call_epoch < $today_start_epoch) )
|
||||
{$start_day_epoch=$day_two_start_epoch; $start_day=2;}
|
||||
if ( ($VLCQCfirst_call_epoch >= $day_three_start_epoch) and ($VLCQCfirst_call_epoch < $day_two_start_epoch) )
|
||||
{$start_day_epoch=$day_three_start_epoch; $start_day=3;}
|
||||
if ( ($VLCQCfirst_call_epoch >= $day_four_start_epoch) and ($VLCQCfirst_call_epoch < $day_three_start_epoch) )
|
||||
{$start_day_epoch=$day_four_start_epoch; $start_day=4;}
|
||||
if ( ($VLCQCfirst_call_epoch >= $day_five_start_epoch) and ($VLCQCfirst_call_epoch < $day_four_start_epoch) )
|
||||
{$start_day_epoch=$day_five_start_epoch; $start_day=5;}
|
||||
if ( ($VLCQCfirst_call_epoch >= $day_six_start_epoch) and ($VLCQCfirst_call_epoch < $day_five_start_epoch) )
|
||||
{$start_day_epoch=$day_six_start_epoch; $start_day=6;}
|
||||
if ( ($VLCQCfirst_call_epoch >= $day_seven_start_epoch) and ($VLCQCfirst_call_epoch < $day_six_start_epoch) )
|
||||
{$start_day_epoch=$day_seven_start_epoch; $start_day=7;}
|
||||
|
||||
$day_one_calls++;
|
||||
|
||||
# calculate back to day 7 starting with day 1 = $start_day_epoch
|
||||
$Sday_two_start_epoch = ($start_day_epoch + (86400 * 1));
|
||||
$Sday_three_start_epoch = ($start_day_epoch + (86400 * 2));
|
||||
$Sday_four_start_epoch = ($start_day_epoch + (86400 * 3));
|
||||
$Sday_five_start_epoch = ($start_day_epoch + (86400 * 4));
|
||||
$Sday_six_start_epoch = ($start_day_epoch + (86400 * 5));
|
||||
$Sday_seven_start_epoch = ($start_day_epoch + (86400 * 6));
|
||||
$Sday_seven_end_epoch = ($start_day_epoch + (86400 * 7));
|
||||
if ($DBX > 0) {print "CQ-Debug 0: $VLCQCfirst_call_date|$start_day|$VLCQCfirst_call_epoch|$start_day_epoch|$Sday_two_start_epoch|$Sday_three_start_epoch|$Sday_four_start_epoch|$Sday_five_start_epoch|$Sday_six_start_epoch|$Sday_seven_start_epoch|\n";}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($DBX > 0) {print "CQ-Debug 1: $call_ct|$VLCQCfirst_call_date|$start_day|$VLCQCfirst_call_epoch|$start_day_epoch(".($LEADcall_epoch[$call_ct]-$start_day_epoch).")|$Sday_two_start_epoch(".($LEADcall_epoch[$call_ct]-$Sday_two_start_epoch).")|$Sday_three_start_epoch(".($LEADcall_epoch[$call_ct]-$Sday_three_start_epoch).")|$Sday_four_start_epoch(".($LEADcall_epoch[$call_ct]-$Sday_four_start_epoch).")|$Sday_five_start_epoch(".($LEADcall_epoch[$call_ct]-$Sday_five_start_epoch).")|$Sday_six_start_epoch(".($LEADcall_epoch[$call_ct]-$Sday_six_start_epoch).")|$Sday_seven_start_epoch(".($LEADcall_epoch[$call_ct]-$Sday_seven_start_epoch).")|$Sday_seven_end_epoch(".($LEADcall_epoch[$call_ct]-$Sday_seven_end_epoch).")| |$LEADcall_epoch[$call_ct]|\n";}
|
||||
if ( ($LEADcall_epoch[$call_ct] >= $start_day_epoch) && ($LEADcall_epoch[$call_ct] < $Sday_two_start_epoch) ) {$day_one_calls++;}
|
||||
if ( ($LEADcall_epoch[$call_ct] >= $Sday_two_start_epoch) && ($LEADcall_epoch[$call_ct] < $Sday_three_start_epoch) ) {$day_two_calls++;}
|
||||
if ( ($LEADcall_epoch[$call_ct] >= $Sday_three_start_epoch) && ($LEADcall_epoch[$call_ct] < $Sday_four_start_epoch) ) {$day_three_calls++;}
|
||||
if ( ($LEADcall_epoch[$call_ct] >= $Sday_four_start_epoch) && ($LEADcall_epoch[$call_ct] < $Sday_five_start_epoch) ) {$day_four_calls++;}
|
||||
if ( ($LEADcall_epoch[$call_ct] >= $Sday_five_start_epoch) && ($LEADcall_epoch[$call_ct] < $Sday_six_start_epoch) ) {$day_five_calls++;}
|
||||
if ( ($LEADcall_epoch[$call_ct] >= $Sday_six_start_epoch) && ($LEADcall_epoch[$call_ct] < $Sday_seven_start_epoch) ) {$day_six_calls++;}
|
||||
if ( ($LEADcall_epoch[$call_ct] >= $Sday_seven_start_epoch) && ($LEADcall_epoch[$call_ct] < $Sday_seven_end_epoch) ) {$day_seven_calls++;}
|
||||
}
|
||||
if ($LEADcall_epoch[$call_ct] >= $today_start_epoch)
|
||||
{
|
||||
if ( ($session_one_start <= $VDLcall_hourmin) and ($session_one_end > $VDLcall_hourmin) ) {$session_one_today_calls++;}
|
||||
if ( ($session_two_start <= $VDLcall_hourmin) and ($session_two_end > $VDLcall_hourmin) ) {$session_two_today_calls++;}
|
||||
if ( ($session_three_start <= $VDLcall_hourmin) and ($session_three_end > $VDLcall_hourmin) ) {$session_three_today_calls++;}
|
||||
if ( ($session_four_start <= $VDLcall_hourmin) and ($session_four_end > $VDLcall_hourmin) ) {$session_four_today_calls++;}
|
||||
if ( ($session_five_start <= $VDLcall_hourmin) and ($session_five_end > $VDLcall_hourmin) ) {$session_five_today_calls++;}
|
||||
if ( ($session_six_start <= $VDLcall_hourmin) and ($session_six_end > $VDLcall_hourmin) ) {$session_six_today_calls++;}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($DBX > 0) {print "CQ-Debug 1: $call_ct|$VLCQCfirst_call_date|$start_day|$VLCQCfirst_call_epoch|$start_day_epoch(".($LEADcall_epoch[$call_ct]-$start_day_epoch).")|$Sday_two_start_epoch(".($LEADcall_epoch[$call_ct]-$Sday_two_start_epoch).")|$Sday_three_start_epoch(".($LEADcall_epoch[$call_ct]-$Sday_three_start_epoch).")|$Sday_four_start_epoch(".($LEADcall_epoch[$call_ct]-$Sday_four_start_epoch).")|$Sday_five_start_epoch(".($LEADcall_epoch[$call_ct]-$Sday_five_start_epoch).")|$Sday_six_start_epoch(".($LEADcall_epoch[$call_ct]-$Sday_six_start_epoch).")|$Sday_seven_start_epoch(".($LEADcall_epoch[$call_ct]-$Sday_seven_start_epoch).")|$Sday_seven_end_epoch(".($LEADcall_epoch[$call_ct]-$Sday_seven_end_epoch).")| |$LEADcall_epoch[$call_ct]|\n";}
|
||||
if ( ($LEADcall_epoch[$call_ct] >= $start_day_epoch) && ($LEADcall_epoch[$call_ct] < $Sday_two_start_epoch) ) {$day_one_calls++;}
|
||||
if ( ($LEADcall_epoch[$call_ct] >= $Sday_two_start_epoch) && ($LEADcall_epoch[$call_ct] < $Sday_three_start_epoch) ) {$day_two_calls++;}
|
||||
if ( ($LEADcall_epoch[$call_ct] >= $Sday_three_start_epoch) && ($LEADcall_epoch[$call_ct] < $Sday_four_start_epoch) ) {$day_three_calls++;}
|
||||
if ( ($LEADcall_epoch[$call_ct] >= $Sday_four_start_epoch) && ($LEADcall_epoch[$call_ct] < $Sday_five_start_epoch) ) {$day_four_calls++;}
|
||||
if ( ($LEADcall_epoch[$call_ct] >= $Sday_five_start_epoch) && ($LEADcall_epoch[$call_ct] < $Sday_six_start_epoch) ) {$day_five_calls++;}
|
||||
if ( ($LEADcall_epoch[$call_ct] >= $Sday_six_start_epoch) && ($LEADcall_epoch[$call_ct] < $Sday_seven_start_epoch) ) {$day_six_calls++;}
|
||||
if ( ($LEADcall_epoch[$call_ct] >= $Sday_seven_start_epoch) && ($LEADcall_epoch[$call_ct] < $Sday_seven_end_epoch) ) {$day_seven_calls++;}
|
||||
}
|
||||
if ($LEADcall_epoch[$call_ct] >= $today_start_epoch)
|
||||
{
|
||||
if ( ($session_one_start <= $VDLcall_hourmin) and ($session_one_end > $VDLcall_hourmin) ) {$session_one_today_calls++;}
|
||||
if ( ($session_two_start <= $VDLcall_hourmin) and ($session_two_end > $VDLcall_hourmin) ) {$session_two_today_calls++;}
|
||||
if ( ($session_three_start <= $VDLcall_hourmin) and ($session_three_end > $VDLcall_hourmin) ) {$session_three_today_calls++;}
|
||||
if ( ($session_four_start <= $VDLcall_hourmin) and ($session_four_end > $VDLcall_hourmin) ) {$session_four_today_calls++;}
|
||||
if ( ($session_five_start <= $VDLcall_hourmin) and ($session_five_end > $VDLcall_hourmin) ) {$session_five_today_calls++;}
|
||||
if ( ($session_six_start <= $VDLcall_hourmin) and ($session_six_end > $VDLcall_hourmin) ) {$session_six_today_calls++;}
|
||||
}
|
||||
{$skip_dial_log_no_uid++;}
|
||||
$call_ct++;
|
||||
$total_call_count++;
|
||||
}
|
||||
@@ -624,7 +665,7 @@ if ($populate_call_quota_logs > 0)
|
||||
if ($lead_ct =~ /900$/i) {print STDERR "0 $lead_ct / $sthArowsLEADS \r";}
|
||||
if ($lead_ct =~ /0000$/i)
|
||||
{
|
||||
print "$lead_ct / $sthArowsLEADS ($log_updated|$log_inserted| |$LEADlist_id[$lead_ct]|$LEADINFOrank| \n";
|
||||
print "$lead_ct / $sthArowsLEADS ($log_updated|$log_inserted|$total_call_count|$skip_dial_log_no_uid|$updated_dial_log_no_uid| |$LEADlist_id[$lead_ct]|$LEADINFOrank| \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -639,7 +680,7 @@ if ($populate_call_quota_logs > 0)
|
||||
if ($no_insert_call_quota_logs < 1) {print "Logs inserted: $log_inserted \n";}
|
||||
else {print "Logs were not inserted: $log_inserted \n";}
|
||||
print "Total leads: $lead_ct \n";
|
||||
print "Total call entries analyzed: $total_call_count \n";
|
||||
print "Total call entries analyzed: $total_call_count ($skip_dial_log_no_uid|$updated_dial_log_no_uid) \n";
|
||||
}
|
||||
### END Gather calls for each lead, analyze and update call_quota log record ###
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
CALL QUOTA LEAD RANKING Started: 2019-07-01 Updated: 2019-07-19
|
||||
CALL QUOTA LEAD RANKING Started: 2019-07-01 Updated: 2019-07-22
|
||||
|
||||
!!!! THIS IS AN EXPERIMENTAL FEATURE, PLEASE READ ALL IMPORTANT NOTES !!!!
|
||||
(If you plan on using this feature-set in production, you should read and understand everything in this document)
|
||||
@@ -92,19 +92,34 @@ session_five =>
|
||||
session_six =>
|
||||
|
||||
For the Call Quota Settings Container to be valid, the first 11 core settings listed above must be set to valid values, see below:
|
||||
|
||||
- redial_statuses: a comma-delimited list of the statuses that you want to recycle-dial
|
||||
- total_goal: must be set to a number from 1 to 100, goal total number of calls during min_consecutive_days
|
||||
- daily_goal: must be set to a number from 1 to 20, goal number of calls per day
|
||||
- daily_max: must be set to a number from 1 to 20, maximum number of calls per day
|
||||
NOTE: Make sure you have these statuses also set as campaign dial statuses
|
||||
|
||||
- total_goal: must be set to a number from 1 to 100, goal total number of calls during min_consecutive_days, since this is a "goal" the called count can go over this number
|
||||
|
||||
- daily_goal: must be set to a number from 1 to 20, goal number of calls per day, since this is a "goal" the called count can go over this number
|
||||
|
||||
- daily_max: must be set to a number from 1 to 20, maximum number of calls per day, leads that hit this count will have rank set < 0
|
||||
NOTE: See note in the "TIPS & SUGGESTIONS" section about adding a filter to prevent these leads from being dialed any more
|
||||
|
||||
- session_goal: must be set to a number from 1 to 20, goal number of calls during session, total across all days
|
||||
- session_day_max: must be set to a number from 1 to 20, maximum number of calls during each session for current day
|
||||
|
||||
- session_day_max: must be set to a number from 1 to 20, maximum number of calls during each session for current day, leads that hit this count will have rank set < 0
|
||||
NOTE: See note in the "TIPS & SUGGESTIONS" section about adding a filter to prevent these leads from being dialed any more
|
||||
|
||||
- new_shuffle: must be set to a number from 0 to 6, 0 is no NEW lead shuffle, '1' is assumed to be '2' for every-other lead
|
||||
|
||||
- min_consecutive_days: must be set to a number from 1 to 7, this is the number of days allowed to reach the "total_goal"
|
||||
|
||||
- active_days_of_week: must be from one to seven digits, one for each day of the week, Sunday=0, example: "0123456" for all 7 days of the week
|
||||
|
||||
- zero_rank_after_call: set to 0 or 1, if set to 1, the lead's rank will be set to 0 when the call is completed, if the lead's rank is above 0
|
||||
- call_quota_run_time: a comma-delimited list of the "minutes" of each hour when the call quota lead ranking process is to be run, we recommend 1-4 times an hour
|
||||
|
||||
- call_quota_run_time: a comma-delimited list of the "minutes" of each hour when the call quota lead ranking process is to be run, once an hour, "01", is usually fine.
|
||||
NOTE: If you are using Call Quotas on multiple campaigns, we recommend you schedule their run times to not overlap
|
||||
|
||||
|
||||
There are also up to 6 sessions that can be defined, they all follow the same format and must be put in chronological order.
|
||||
All times are based on server time, not the customer time.
|
||||
It is assumed that the session times will cover all possible dialing times for the campaign.
|
||||
@@ -116,12 +131,21 @@ Sessions are not designed to start earler than "0000", or go past "2400".
|
||||
|
||||
|
||||
TIPS & SUGGESTIONS:
|
||||
|
||||
- Set the campaign's hopper level to the number of leads your campaign dials in 1-3 minutes, so that the updated rankings will be most effective, especially at session time boundaries
|
||||
|
||||
- Deactivate lists after all leads have been called your desired amount of times. You can see that by looking at the data table on the List Modify page at the bottom
|
||||
- Set your call quota sessions to be equal lengths of time, and make sure all of your calling hours are covered by your sessions
|
||||
- Do not change your sessions after you have started calling on your campaign
|
||||
|
||||
- Set your call quota sessions to be similar lengths of time, and make sure all of your calling hours are covered by your sessions
|
||||
|
||||
- Do not change your "sessions" after you have activated Call Quotas on your campaign
|
||||
|
||||
- Keep less than 400,000 leads in the lists of a single campaign. Move your unused lists to an inactive campaign
|
||||
|
||||
- Since there can sometimes be rare inconsistencies in how the multiple call logging processes work, you may have a call-quota log entry for a lead that shows a status different from the lead's current status. For instance, one may show "AB" while the other may show "B" for a busy number. You should include all possible statuses you want to re-dial in your "redial_statuses" setting.
|
||||
|
||||
- When you start a brand-new campaign, you will have to dial only NEW leads, but after the first day, you should remove NEW from your campaign dialing statuses and use the Call Quota "new_shuffle" setting to shuffle in NEW leads instead. As your campaign progresses, you should be able to change new_shuffle from 2 down to 4, 5 or 6.
|
||||
|
||||
- To ensure that leads with a negative rank are not called, you may want to create a Filter in the system with a Filter SQL of "(rank > 0)" and enable it for your campaign. This will help to ensure that unranked leads are not dialed. If you insert NEW leads with no rank, you will want to change this to use "(rank >= 0)".
|
||||
|
||||
|
||||
@@ -135,8 +159,10 @@ Scripts modified/added:
|
||||
- bin/FastAGI_log.pl
|
||||
- bin/AST_VDauto_dial.pl
|
||||
- bin/AST_VDremote_agents.pl
|
||||
- bin/AST_VDadapt.pl
|
||||
- bin/ADMIN_keepalive_ALL.pl
|
||||
- agi/agi-VDAD_ALL_outbound.agi
|
||||
- agi/VD_amd.agi
|
||||
- www/agc/vdc_db_query.php
|
||||
- www/vicidial/campaign_debug.php
|
||||
|
||||
@@ -188,6 +214,9 @@ LIST CACHE STATS UPDATED: 999888999777 TOTAL: 0 NEW: 0 DIALABLE NEW: 0
|
||||
|
||||
|
||||
|
||||
A new outbound auto-dial log-auditing function has been added to the AST_VDadapt.pl script when Call Quotas is enabled. This function validates logs and fixes them if logging at the end of a call does not happen in the way it is supposed to, which can happen on overloaded systems.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user