Added ability to use Remote Agents with all inbound next-agent-call settings

Added ability to use DNCC and DNCL as Auto-Alt-Dial statuses
Fixed DNC scrubbing under some auto-alt-dial circumstances
Other small bug fixes

git-svn-id: svn://192.168.202.10@1245 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2009-10-20 10:03:39 +00:00
parent 97afec9c6c
commit 36da02751c
8 changed files with 899 additions and 425 deletions
+5
View File
@@ -259,6 +259,11 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom
- Must have User "Agent Choose Territories" enabled
- Leads must have the owner field set to desired territory
63. Added ability to use Remote Agents with all inbound next-agent-call settings
64. Added ability to use DNCC and DNCL as Auto-Alt-Dial statuses
+1 -1
View File
@@ -553,7 +553,7 @@ if ($affected_rows > 0)
$TTS_text[$s] =~ s/--A--last_local_call_time--B--/$TTS_last_local_call_time/gi;
$TTS_text[$s] =~ s/--A--rank--B--/$TTS_rank/gi;
$TTS_text[$s] =~ s/--A--owner--B--/$TTS_owner/gi;
$TTS_text[$s] =~ s/[^,\.\<\>\'\/\=\_ 0-9a-zA-Z]//gi;
$TTS_text[$s] =~ s/[^,\.\<\>\'\/\=\_\-\: 0-9a-zA-Z]//gi;
$TTS_textRAW[$s] = $TTS_text[$s];
$TTS_text[$s] =~ s/ /\\ /gi;
$TTS_text[$s] =~ s/\./\\./gi;
+365 -24
View File
@@ -59,6 +59,7 @@
# 90809-0347 - Quick fix for null list_id loading when no active campaign lists
# 90904-1612 - Added timezone ordering
# 90907-2132 - Fixed order issues
# 91020-0054 - Fixed Auto-alt-dial DNC issues
#
# constants
@@ -336,6 +337,7 @@ if ($inactive_lists_count > 0)
}
}
### BEGIN Change CBHOLD status leads to CALLBK if their vicidial_callbacks time has passed
$stmtA = "SELECT count(*) FROM vicidial_callbacks where callback_time <= '$now_date' and status='ACTIVE';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
@@ -362,11 +364,11 @@ if ($CBHOLD_count > 0)
$update_leads .= "'$lead_ids[$cbc]',";
if ($recipient =~ /ANYONE/)
{
$CA_lead_id[$cba] = $aryA[0];
$CA_campaign_id[$cba] = $aryA[2];
$CA_list_id[$cba] = $aryA[3];
$CA_gmt_offset_now[$cba] = $aryA[4];
$CA_state[$cba] = $aryA[5];
$CA_lead_id[$cba] = $aryA[0];
$CA_campaign_id[$cba] = $aryA[2];
$CA_list_id[$cba] = $aryA[3];
$CA_gmt_offset_now[$cba] = $aryA[4];
$CA_state[$cba] = $aryA[5];
$cba++;
}
$cbc++;
@@ -407,15 +409,344 @@ if ($CBHOLD_count > 0)
### END Change CBHOLD status leads to CALLBK if their vicidial_callbacks time has passed
### BEGIN Auto-Alt-Dial DNC check and update or delete
### Find out how many leads in the hopper are set to DNC status
$hopper_dnc_count=0;
$stmtA = "SELECT count(*) from $vicidial_hopper where status='DNC';";
$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;
$hopper_dnc_count = $aryA[0];
if ($DB) {print " hopper DNC count: $hopper_dnc_count\n";}
if ($DBX) {print " |$stmtA|\n";}
}
$sthA->finish();
if ($hopper_dnc_count > 0)
{
$event_string = "|hopper DNC count: $hopper_dnc_count||";
&event_logger;
### Gather all DNC statused vicidial_hopper entries
$stmtA = "SELECT hopper_id,lead_id,alt_dial,campaign_id FROM $vicidial_hopper where status='DNC';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$aad=0;
while ($sthArows > $aad)
{
@aryA = $sthA->fetchrow_array;
$AAD_hopper_id[$aad] = $aryA[0];
$AAD_lead_id[$aad] = $aryA[1];
$AAD_alt_dial[$aad] = $aryA[2];
$AAD_campaign_id[$aad] = $aryA[3];
$aad++;
}
$sthA->finish();
### Go through all DNC statused vicidial_hopper entries and look for next number. If found, set the next phone number, alt dial and change status to READY
$aad=0;
while ($sthArows > $aad)
{
$auto_alt_dial='';
$VD_alt_dial = $AAD_alt_dial[$aad];
$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 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;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$VD_auto_alt_dial = $aryA[0];
}
$sthA->finish();
$event_string = "|DNC record: $AAD_lead_id[$aad]|$AAD_campaign_id[$aad]|$VD_auto_alt_dial|$AAD_alt_dial[$aad]";
&event_logger;
if ( ($VD_auto_alt_dial =~ /(ALT_ONLY|ALT_AND_ADDR3|ALT_AND_EXTENDED)/) && ($VD_alt_dial =~ /NONE|MAIN/) )
{
$alt_dial_skip=0;
$VD_alt_phone='';
$stmtA="SELECT alt_phone,gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$AAD_lead_id[$aad]';";
if ($DB) {$event_string = "|$stmtA|"; &event_logger;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$epc_countCAMPDATA=0;
while ($sthArows > $epc_countCAMPDATA)
{
@aryA = $sthA->fetchrow_array;
$VD_alt_phone = $aryA[0];
$VD_alt_phone =~ s/\D//gi;
$VD_gmt_offset_now = $aryA[1];
$VD_state = $aryA[2];
$VD_list_id = $aryA[3];
$epc_countCAMPDATA++;
}
$sthA->finish();
if (length($VD_alt_phone)>5)
{
if ($VD_use_internal_dnc =~ /Y/)
{
$stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$VD_alt_phone';";
if ($DB) {$event_string = "|$stmtA|"; &event_logger;}
$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;
$VD_alt_dnc_count = $aryA[0];
}
$sthA->finish();
}
else {$VD_alt_dnc_count=0;}
if ($VD_use_campaign_dnc =~ /Y/)
{
$stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$VD_alt_phone' and campaign_id='$VD_campaign_id';";
if ($DB) {$event_string = "|$stmtA|"; &event_logger;}
$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;
$VD_alt_dnc_count = ($VD_alt_dnc_count + $aryA[0]);
}
$sthA->finish();
}
if ($VD_alt_dnc_count < 1)
{
$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]';";
$affected_rows = $dbhA->do($stmtA);
if ($DB) {$event_string = "-- VDH record updated: |$affected_rows| |$stmtA|"; &event_logger;}
}
else
{$alt_dial_skip=1;}
}
else
{$alt_dial_skip=1;}
if ($alt_dial_skip > 0)
{$VD_alt_dial='ALT';}
}
if ( ( ($VD_auto_alt_dial =~ /(ADDR3_ONLY)/) && ($VD_alt_dial =~ /NONE|MAIN/) ) || ( ($VD_auto_alt_dial =~ /(ALT_AND_ADDR3)/) && ($VD_alt_dial =~ /ALT/) ) )
{
$addr3_dial_skip=0;
$VD_address3='';
$stmtA="SELECT address3,gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$AAD_lead_id[$aad]';";
if ($DB) {$event_string = "|$stmtA|"; &event_logger;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$epc_countCAMPDATA=0;
while ($sthArows > $epc_countCAMPDATA)
{
@aryA = $sthA->fetchrow_array;
$VD_address3 = $aryA[0];
$VD_address3 =~ s/\D//gi;
$VD_gmt_offset_now = $aryA[1];
$VD_state = $aryA[2];
$VD_list_id = $aryA[3];
$epc_countCAMPDATA++;
}
$sthA->finish();
if (length($VD_address3)>5)
{
if ($VD_use_internal_dnc =~ /Y/)
{
$stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$VD_address3';";
if ($DB) {$event_string = "|$stmtA|"; &event_logger;}
$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;
$VD_alt_dnc_count = $aryA[0];
}
$sthA->finish();
}
else {$VD_alt_dnc_count=0;}
if ($VD_use_campaign_dnc =~ /Y/)
{
$stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$VD_address3' and campaign_id='$VD_campaign_id';";
if ($DB) {$event_string = "|$stmtA|"; &event_logger;}
$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;
$VD_alt_dnc_count = ($VD_alt_dnc_count + $aryA[0]);
}
$sthA->finish();
}
if ($VD_alt_dnc_count < 1)
{
$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='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;}
}
else
{$addr3_dial_skip=1;}
}
else
{$addr3_dial_skip=1;}
if ($addr3_dial_skip > 0)
{$VD_alt_dial='ADDR3';}
}
if ( ( ($VD_auto_alt_dial =~ /(EXTENDED_ONLY)/) && ($VD_alt_dial =~ /NONE|MAIN/) ) || ( ($VD_auto_alt_dial =~ /(ALT_AND_EXTENDED)/) && ($VD_alt_dial =~ /ALT/) ) || ( ($VD_auto_alt_dial =~ /ADDR3_AND_EXTENDED|ALT_AND_ADDR3_AND_EXTENDED/) && ($VD_alt_dial =~ /ADDR3/) ) || ( ($VD_auto_alt_dial =~ /(EXTENDED)/) && ($VD_alt_dial =~ /X/) && ($VD_alt_dial !~ /XLAST/) ) )
{
if ($VD_alt_dial =~ /ADDR3/) {$Xlast=0;}
else
{$Xlast = $VD_alt_dial;}
$Xlast =~ s/\D//gi;
if (length($Xlast)<1)
{$Xlast=0;}
$VD_altdialx='';
$stmtA="SELECT gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$VD_lead_id';";
if ($DB) {$event_string = "|$stmtA|"; &event_logger;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$epc_countCAMPDATA=0;
while ($sthArows > $epc_countCAMPDATA)
{
@aryA = $sthA->fetchrow_array;
$VD_gmt_offset_now = $aryA[0];
$VD_state = $aryA[1];
$VD_list_id = $aryA[2];
$epc_countCAMPDATA++;
}
$sthA->finish();
$alt_dial_phones_count=0;
$stmtA="SELECT count(*) FROM vicidial_list_alt_phones where lead_id='$AAD_lead_id[$aad]';";
if ($DB) {$event_string = "|$stmtA|"; &event_logger;}
$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;
$alt_dial_phones_count = $aryA[0];
}
$sthA->finish();
if ($alt_dial_phones_count <= $Xlast)
{
$stmtA = "DELETE FROM vicidial_hopper where hopper_id='$AAD_hopper_id[$aad]';";
$affected_rows = $dbhA->do($stmtA);
if ($DB) {$event_string = "-- VDH record DNC deleted: |$affected_rows| |$stmtA|X$Xlast|$VD_altdial_id|"; &event_logger;}
}
while ( ($alt_dial_phones_count > 0) && ($alt_dial_phones_count > $Xlast) )
{
$Xlast++;
$stmtA="SELECT alt_phone_id,phone_number,active FROM vicidial_list_alt_phones where lead_id='$VD_lead_id' and alt_phone_count='$Xlast';";
if ($DB) {$event_string = "|$stmtA|"; &event_logger;}
$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;
$VD_altdial_id = $aryA[0];
$VD_altdial_phone = $aryA[1];
$VD_altdial_active = $aryA[2];
}
else
{$Xlast=9999999999;}
$sthA->finish();
if ($VD_altdial_active =~ /Y/)
{
if ($VD_use_internal_dnc =~ /Y/)
{
$stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$VD_altdial_phone';";
if ($DB) {$event_string = "|$stmtA|"; &event_logger;}
$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;
$VD_alt_dnc_count = $aryA[0];
}
$sthA->finish();
}
else {$VD_alt_dnc_count=0;}
if ($VD_use_campaign_dnc =~ /Y/)
{
$stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$VD_altdial_phone' and campaign_id='$VD_campaign_id';";
if ($DB) {$event_string = "|$stmtA|"; &event_logger;}
$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;
$VD_alt_dnc_count = ($VD_alt_dnc_count + $aryA[0]);
}
$sthA->finish();
}
if ($VD_alt_dnc_count < 1)
{
if ($alt_dial_phones_count eq '$Xlast')
{$Xlast = 'LAST';}
$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='25' 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;}
$Xlast=9999999999;
}
else
{
if ($alt_dial_phones_count eq '$Xlast')
{$Xlast = 'LAST';}
$stmtA = "UPDATE vicidial_hopper SET status='DNC',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 DNC updated: |$affected_rows| |$stmtA|X$Xlast|$VD_altdial_id|"; &event_logger;}
$Xlast=9999999999;
if ($DB) {$event_string = "-- VDH alt dial is DNC|X$Xlast|$VD_altdial_phone|"; &event_logger;}
}
}
}
}
if ($VD_alt_dial =~ /XLAST/)
{
$stmtA = "DELETE FROM vicidial_hopper where hopper_id='$AAD_hopper_id[$aad]';";
$affected_rows = $dbhA->do($stmtA);
if ($DB) {$event_string = "-- VDH record DNC deleted: |$affected_rows| |$stmtA|X$Xlast|$VD_altdial_id|"; &event_logger;}
}
$aad++;
}
}
### END Auto-Alt-Dial DNC check and update or delete
@campaign_id=@MT;
if ($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 from vicidial_campaigns where campaign_id='$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 from vicidial_campaigns where campaign_id='$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 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 from vicidial_campaigns where active='Y';";
}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -443,6 +774,7 @@ while ($sthArows > $rec_count)
$use_campaign_dnc[$rec_count] = $aryA[13];
$drop_lockout_time[$rec_count] = $aryA[14];
$no_hopper_dialing[$rec_count] = $aryA[15];
$auto_alt_dial_statuses[$rec_count] = $aryA[16];
$rec_count++;
}
@@ -708,7 +1040,7 @@ foreach(@campaign_id)
{
if (length($state_rules[$b])>1)
{
$stmtA = "SELECT * from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';";
$stmtA = "SELECT state_call_time_id,state_call_time_state,state_call_time_name,state_call_time_comments,sct_default_start,sct_default_stop,sct_sunday_start,sct_sunday_stop,sct_monday_start,sct_monday_stop,sct_tuesday_start,sct_tuesday_stop,sct_wednesday_start,sct_wednesday_stop,sct_thursday_start,sct_thursday_stop,sct_friday_start,sct_friday_stop,sct_saturday_start,sct_saturday_stop from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';";
if ($DBX) {print " |$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1022,7 +1354,7 @@ foreach(@campaign_id)
##### BEGIN lead recycling parsing and prep ###
$stmtA = "SELECT * from vicidial_lead_recycle where campaign_id='$campaign_id[$i]' and active='Y';";
$stmtA = "SELECT recycle_id,campaign_id,status,attempt_delay,attempt_maximum,active from vicidial_lead_recycle where campaign_id='$campaign_id[$i]' and active='Y';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -1131,14 +1463,12 @@ foreach(@campaign_id)
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
while ($sthArows > $rec_count)
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$hopper_ready_count = $aryA[0];
if ($DB) {print " hopper READY count: $hopper_ready_count\n";}
if ($DBX) {print " |$stmtA|\n";}
$rec_count++;
}
$sthA->finish();
$event_string = "|$campaign_id[$i]|$hopper_level[$i]|$hopper_ready_count|$local_call_time[$i]||";
@@ -1262,14 +1592,12 @@ foreach(@campaign_id)
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
while ($sthArows > $rec_count)
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$campaign_leads_to_call[$i] = "$aryA[0]";
if ($DB) {print " leads to call count: $campaign_leads_to_call[$i]\n";}
if ($DBX) {print " |$stmtA|\n";}
$rec_count++;
}
$sthA->finish();
@@ -1279,14 +1607,12 @@ foreach(@campaign_id)
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
while ($sthArows > $rec_count)
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$NEW_campaign_leads_to_call[$i] = "$aryA[0]";
if ($DB) {print " NEW leads to call count: $NEW_campaign_leads_to_call[$i]\n";}
if ($DBX) {print " |$stmtA|\n";}
$rec_count++;
}
$sthA->finish();
}
@@ -1645,6 +1971,8 @@ foreach(@campaign_id)
if ($leads_to_hopper[$h] != '0')
{
$DNClead=0;
$DNCC=0;
$DNCL=0;
if ($use_internal_dnc[$i] =~ /Y/)
{
if ($DB) {print " Doing DNC Check: $phone_to_hopper[$h] - $use_internal_dnc[$i]\n";}
@@ -1652,16 +1980,15 @@ foreach(@campaign_id)
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
while ($sthArows > $rec_count)
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$DNClead = "$aryA[0]";
$rec_count++;
}
$sthA->finish();
if ($DNClead != '0')
{
$DNCL++;
$stmtA = "UPDATE vicidial_list SET status='DNCL' where lead_id='$leads_to_hopper[$h]';";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print "Flagging DNC lead: $affected_rows $phone_to_hopper[$h]\n";}
@@ -1674,16 +2001,15 @@ foreach(@campaign_id)
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
while ($sthArows > $rec_count)
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$DNClead = "$aryA[0]";
$rec_count++;
}
$sthA->finish();
if ($DNClead != '0')
{
$DNCC++;
$stmtA = "UPDATE vicidial_list SET status='DNCC' where lead_id='$leads_to_hopper[$h]';";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print "Flagging DNC lead: $affected_rows $phone_to_hopper[$h] $campaign_id[$i]\n";}
@@ -1700,6 +2026,21 @@ foreach(@campaign_id)
&detail_logger;
}
}
else
{
##### Auto-Alt-Dial if DNCC or DNCL are set to campaign auto-alt-dial statuses, insert lead into hopper as DNC status
if ( ( ($auto_alt_dial_statuses =~ / DNCC /) && ($DNCC > 0) ) || ( ($auto_alt_dial_statuses =~ / DNCC /) && ($DNCL > 0) ) )
{
$stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority) values('$leads_to_hopper[$h]','$campaign_id[$i]','DNC','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]','$state_to_hopper[$h]','0');";
$affected_rows = $dbhA->do($stmtA);
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]|";
&detail_logger;
}
}
}
}
$h++;
}
File diff suppressed because it is too large Load Diff
+29 -22
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# FastAGI_log.pl version 2.0.5 *DBI-version*
# FastAGI_log.pl version 2.2.0 *DBI-version*
#
# Experimental Deamon using perl Net::Server that runs as FastAGI to reduce load
# replaces the following AGI scripts:
@@ -49,6 +49,7 @@
# 90630-2253 - Added Sangoma CDP pre-Answer call processing
# 90814-0810 - Added extra logging for vicidial_log in some cases
# 90815-0750 - Fixed extra vicidial_log logging
# 91020-0055 - Fixed several bugs with auto-alt-dial, DNC and extended alt number dialing
#
@@ -1023,10 +1024,10 @@ sub process_request
while ($sthArows > $epc_countCAMPDATA)
{
@aryA = $sthA->fetchrow_array;
$VD_auto_alt_dial = "$aryA[0]";
$VD_auto_alt_dial_statuses = "$aryA[1]";
$VD_use_internal_dnc = "$aryA[2]";
$VD_use_campaign_dnc = "$aryA[3]";
$VD_auto_alt_dial = $aryA[0];
$VD_auto_alt_dial_statuses = $aryA[1];
$VD_use_internal_dnc = $aryA[2];
$VD_use_campaign_dnc = $aryA[3];
$epc_countCAMPDATA++;
}
$sthA->finish();
@@ -1045,11 +1046,11 @@ sub process_request
while ($sthArows > $epc_countCAMPDATA)
{
@aryA = $sthA->fetchrow_array;
$VD_alt_phone = "$aryA[0]";
$VD_alt_phone = $aryA[0];
$VD_alt_phone =~ s/\D//gi;
$VD_gmt_offset_now = "$aryA[1]";
$VD_state = "$aryA[2]";
$VD_list_id = "$aryA[3]";
$VD_gmt_offset_now = $aryA[1];
$VD_state = $aryA[2];
$VD_list_id = $aryA[3];
$epc_countCAMPDATA++;
}
$sthA->finish();
@@ -1065,7 +1066,7 @@ sub process_request
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$VD_alt_dnc_count = "$aryA[0]";
$VD_alt_dnc_count = $aryA[0];
}
$sthA->finish();
}
@@ -1111,11 +1112,11 @@ sub process_request
while ($sthArows > $epc_countCAMPDATA)
{
@aryA = $sthA->fetchrow_array;
$VD_address3 = "$aryA[0]";
$VD_address3 = $aryA[0];
$VD_address3 =~ s/\D//gi;
$VD_gmt_offset_now = "$aryA[1]";
$VD_state = "$aryA[2]";
$VD_list_id = "$aryA[3]";
$VD_gmt_offset_now = $aryA[1];
$VD_state = $aryA[2];
$VD_list_id = $aryA[3];
$epc_countCAMPDATA++;
}
$sthA->finish();
@@ -1131,7 +1132,7 @@ sub process_request
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$VD_alt_dnc_count = "$aryA[0]";
$VD_alt_dnc_count = $aryA[0];
}
$sthA->finish();
}
@@ -1182,9 +1183,9 @@ sub process_request
while ($sthArows > $epc_countCAMPDATA)
{
@aryA = $sthA->fetchrow_array;
$VD_gmt_offset_now = "$aryA[1]";
$VD_state = "$aryA[2]";
$VD_list_id = "$aryA[3]";
$VD_gmt_offset_now = $aryA[0];
$VD_state = $aryA[1];
$VD_list_id = $aryA[2];
$epc_countCAMPDATA++;
}
$sthA->finish();
@@ -1197,7 +1198,7 @@ sub process_request
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$alt_dial_phones_count = "$aryA[0]";
$alt_dial_phones_count = $aryA[0];
}
$sthA->finish();
@@ -1261,18 +1262,24 @@ sub process_request
$Xlast=9999999999;
}
else
{if ($AGILOG) {$agi_string = "-- VDH alt dial is DNC|X$Xlast|$VD_altdial_phone|"; &agi_output;}}
{
if ($alt_dial_phones_count eq '$Xlast')
{$Xlast = 'LAST';}
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='DNC',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15';";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDH record DNC inserted: |$affected_rows| |$stmtA|X$Xlast|$VD_altdial_id|"; &agi_output;}
$Xlast=9999999999;
if ($AGILOG) {$agi_string = "-- VDH alt dial is DNC|X$Xlast|$VD_altdial_phone|"; &agi_output;}
}
}
}
}
}
##### END AUTO ALT PHONE DIAL SECTION #####
}
}
}
$dbhA->disconnect();
}
}
###################################################################
@@ -314,7 +314,7 @@ CREATE TABLE vicidial_hopper (
hopper_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
lead_id INT(9) UNSIGNED NOT NULL,
campaign_id VARCHAR(8),
status ENUM('READY','QUEUE','INCALL','DONE','HOLD') default 'READY',
status ENUM('READY','QUEUE','INCALL','DONE','HOLD','DNC') default 'READY',
user VARCHAR(20),
list_id BIGINT(14) UNSIGNED NOT NULL,
gmt_offset_now DECIMAL(4,2) DEFAULT '0.00',
@@ -1252,7 +1252,8 @@ calls_today SMALLINT(5) UNSIGNED default '0',
last_call_time DATETIME,
last_call_finish DATETIME,
index (group_id),
index (group_weight)
index (group_weight),
unique index vlia_user_group_id (user, group_id)
);
CREATE TABLE vicidial_campaign_agents (
@@ -1947,7 +1948,7 @@ CREATE INDEX phone_number on vicidial_closer_log (phone_number);
CREATE INDEX date_user on vicidial_closer_log (call_date,user);
CREATE INDEX comment_a on live_inbound_log (comment_a);
UPDATE system_settings SET db_schema_version='1176',db_schema_update_date=NOW();
UPDATE system_settings SET db_schema_version='1177',db_schema_update_date=NOW();
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
+6
View File
@@ -585,3 +585,9 @@ index (event_date)
);
UPDATE system_settings SET db_schema_version='1176',db_schema_update_date=NOW();
CREATE UNIQUE INDEX vlia_user_group_id ON vicidial_live_inbound_agents (user, group_id);
ALTER TABLE vicidial_hopper MODIFY status ENUM('READY','QUEUE','INCALL','DONE','HOLD','DNC') default 'READY';
UPDATE system_settings SET db_schema_version='1177',db_schema_update_date=NOW();
+72 -13
View File
@@ -217,10 +217,11 @@
# 90924-1544 - Added List callerid override option
# 90930-1638 - Added agent_territories feature
# 91012-0535 - Fixed User territory no-hopper dial bug
# 91019-1224 - Fixed auto-alt-dial DNC issues
#
$version = '2.2.0-126';
$build = '91012-0535';
$version = '2.2.0-127';
$build = '91019-1224';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=256;
$one_mysql_log=0;
@@ -872,7 +873,7 @@ if ($users_to_parse > 0)
### place the call by inserting into vicidial_manager
################################################################################
if ($ACTION == 'manDiaLnextCaLL')
{
{
$MT[0]='';
$row=''; $rowx='';
$channel_live=1;
@@ -1824,14 +1825,13 @@ if ($ACTION == 'manDiaLnextCaLL')
$LeaD_InfO .= $owner . "\n";
echo $LeaD_InfO;
}
}
else
{
echo "HOPPER EMPTY\n";
{
echo "HOPPER EMPTY\n";
}
}
}
}
################################################################################
@@ -4350,12 +4350,15 @@ if ($ACTION == 'updateDISPO')
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00154',$user,$server_ip,$session_name,$one_mysql_log);}
}
$stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign';";
$stmt="SELECT auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc from vicidial_campaigns where campaign_id='$campaign';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00155',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$VC_auto_alt_dial_statuses = $row[0];
$use_internal_dnc = $row[1];
$use_campaign_dnc = $row[2];
if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$row[0])) )
if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$VC_auto_alt_dial_statuses)) )
{
$stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';";
if ($DB) {echo "$stmt\n";}
@@ -4365,10 +4368,66 @@ if ($ACTION == 'updateDISPO')
if ($row[0] > 0)
{
$stmt="UPDATE vicidial_hopper set status='READY' where lead_id='$lead_id' and status='HOLD' limit 1;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
##### Check for alt phone number in DNC list if applicable
$UD_DNC_campaign=0;
$UD_DNC_internal=0;
$vh_phone='';
$stmt="SELECT phone_number FROM vicidial_hopper where lead_id='$lead_id' and status='HOLD';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00157',$user,$server_ip,$session_name,$one_mysql_log);}
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$ud_record_ct = mysql_num_rows($rslt);
if ($ud_record_ct > 0)
{
$row=mysql_fetch_row($rslt);
$vh_phone = $row[0];
}
if (eregi('Y',$use_internal_dnc))
{
$stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$vh_phone';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$ud_record_ct = mysql_num_rows($rslt);
if ($ud_record_ct > 0)
{
$row=mysql_fetch_row($rslt);
$UD_DNC_internal = $row[0];
}
}
if (eregi('Y',$use_campaign_dnc))
{
$stmt="SELECT count(*) FROM vicidial_campaign_dnc where campaign_id='$campaign' and phone_number='$vh_phone';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$ud_record_ct = mysql_num_rows($rslt);
if ($ud_record_ct > 0)
{
$row=mysql_fetch_row($rslt);
$UD_DNC_campaign = $row[0];
}
}
if ( ($UD_DNC_campaign > 0) or ($UD_DNC_internal > 0) )
{
if ( ( (ereg(" DNCC ",$VC_auto_alt_dial_statuses)) and ($UD_DNC_campaign > 0) ) or ( (ereg(" DNCL ",$VC_auto_alt_dial_statuses)) and ($UD_DNC_internal > 0) ) )
{
$stmt="UPDATE vicidial_hopper set status='DNC' where lead_id='$lead_id' and status='HOLD' limit 1;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00157',$user,$server_ip,$session_name,$one_mysql_log);}
}
}
else
{
$stmt="UPDATE vicidial_hopper set status='READY' where lead_id='$lead_id' and status='HOLD' limit 1;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00157',$user,$server_ip,$session_name,$one_mysql_log);}
}
}
}
else