diff --git a/agc_2-X/trunk/bin/AST_VDauto_dial.pl b/agc_2-X/trunk/bin/AST_VDauto_dial.pl
index 7e2398db..a71d4dc3 100644
--- a/agc_2-X/trunk/bin/AST_VDauto_dial.pl
+++ b/agc_2-X/trunk/bin/AST_VDauto_dial.pl
@@ -141,9 +141,10 @@
# 210606-1006 - Added TILTX features for pre-carrier call filtering
# 210713-1322 - Added call_limit_24hour feature support
# 210718-0359 - Fixes for 24-Hour Call Count Limits with standard Auto-Alt-Dialing
+# 210719-1520 - Added additional state override methods for call_limit_24hour
#
-$build='210718-0359';
+$build='210719-1520';
$script='AST_VDauto_dial';
### begin parsing run-time options ###
if (length($ARGV[0])>1)
@@ -2928,7 +2929,7 @@ while($one_day_interval > 0)
$VD_phone_code='';
$temp_24hour_phone='';
$temp_24hour_phone_code='';
- $stmtA="SELECT alt_phone,gmt_offset_now,state,list_id,phone_code FROM vicidial_list where lead_id='$CLlead_id';";
+ $stmtA="SELECT alt_phone,gmt_offset_now,state,list_id,phone_code,postal_code FROM vicidial_list where lead_id='$CLlead_id';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -2941,6 +2942,7 @@ while($one_day_interval > 0)
$VD_state = $aryA[2];
$VD_list_id = $aryA[3];
$VD_phone_code = $aryA[4];
+ $VD_postal_code = $aryA[5];
}
$sthA->finish();
$event_string = "|$stmtA|$VD_alt_phone|"; &event_logger;
@@ -2996,8 +2998,10 @@ while($one_day_interval > 0)
$passed_24hour_call_count=1;
if ( ($SScall_limit_24hour > 0) && ($VD_call_limit_24hour_method =~ /PHONE_NUMBER|LEAD/) )
{
- $temp_24hour_phone = $VD_alt_phone;
- $temp_24hour_phone_code = $VD_phone_code;
+ $temp_24hour_phone = $VD_alt_phone;
+ $temp_24hour_phone_code = $VD_phone_code;
+ $temp_24hour_state = $VD_state;
+ $temp_24hour_postal_code = $VD_postal_code;
if ($DB > 0) {print "24-Hour Call Count Check: $SScall_limit_24hour|$VD_call_limit_24hour_method|$CLlead_id|\n";}
&check_24hour_call_count;
}
@@ -3026,7 +3030,7 @@ while($one_day_interval > 0)
{
$addr3_dial_skip=0;
$VD_address3='';
- $stmtA="SELECT address3,gmt_offset_now,state,list_id,phone_code FROM vicidial_list where lead_id='$CLlead_id';";
+ $stmtA="SELECT address3,gmt_offset_now,state,list_id,phone_code,postal_code FROM vicidial_list where lead_id='$CLlead_id';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -3039,6 +3043,7 @@ while($one_day_interval > 0)
$VD_state = $aryA[2];
$VD_list_id = $aryA[3];
$VD_phone_code = $aryA[4];
+ $VD_postal_code = $aryA[5];
}
$sthA->finish();
$event_string = "|$stmtA|$VD_address3|"; &event_logger;
@@ -3094,8 +3099,10 @@ while($one_day_interval > 0)
$passed_24hour_call_count=1;
if ( ($SScall_limit_24hour > 0) && ($VD_call_limit_24hour_method =~ /PHONE_NUMBER|LEAD/) )
{
- $temp_24hour_phone = $VD_address3;
- $temp_24hour_phone_code = $VD_phone_code;
+ $temp_24hour_phone = $VD_address3;
+ $temp_24hour_phone_code = $VD_phone_code;
+ $temp_24hour_state = $VD_state;
+ $temp_24hour_postal_code = $VD_postal_code;
if ($DB > 0) {print "24-Hour Call Count Check: $SScall_limit_24hour|$VD_call_limit_24hour_method|$CLlead_id|\n";}
&check_24hour_call_count;
}
@@ -3129,7 +3136,7 @@ while($one_day_interval > 0)
if (length($Xlast)<1)
{$Xlast=0;}
$VD_altdialx='';
- $stmtA="SELECT gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$CLlead_id';";
+ $stmtA="SELECT gmt_offset_now,state,list_id,postal_code FROM vicidial_list where lead_id='$CLlead_id';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -3139,6 +3146,7 @@ while($one_day_interval > 0)
$VD_gmt_offset_now = $aryA[0];
$VD_state = $aryA[1];
$VD_list_id = $aryA[2];
+ $VD_postal_code = $aryA[3];
}
$sthA->finish();
@@ -3233,8 +3241,10 @@ while($one_day_interval > 0)
$passed_24hour_call_count=1;
if ( ($SScall_limit_24hour > 0) && ($VD_call_limit_24hour_method =~ /PHONE_NUMBER|LEAD/) )
{
- $temp_24hour_phone = $VD_altdial_phone;
- $temp_24hour_phone_code = $VD_phone_code;
+ $temp_24hour_phone = $VD_altdial_phone;
+ $temp_24hour_phone_code = $VD_phone_code;
+ $temp_24hour_state = $VD_state;
+ $temp_24hour_postal_code = $VD_postal_code;
if ($DB > 0) {print "24-Hour Call Count Check: $SScall_limit_24hour|$VD_call_limit_24hour_method|$CLlead_id|\n";}
&check_24hour_call_count;
}
@@ -5360,7 +5370,7 @@ sub check_24hour_call_count
{
$stmtA="SELECT count(*) FROM vicidial_lead_24hour_calls where lead_id='$CLlead_id' and (call_date >= NOW() - INTERVAL 1 DAY) $limit_scopeSQL;";
}
- if ($DB) {print " Doing 24-Hour Call Count Check: $CLlead_id|$temp_24hour_phone_code|$temp_24hour_phone - $VD_call_limit_24hour_method|$VD_call_limit_24hour_scope\n";}
+ if ($DB) {print " Doing 24-Hour Call Count Check: $CLlead_id|$temp_24hour_phone_code|$temp_24hour_phone|$temp_24hour_state|$temp_24hour_postal_code - $VD_call_limit_24hour_method|$VD_call_limit_24hour_scope|$VD_call_limit_24hour\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -5393,6 +5403,9 @@ sub check_24hour_call_count
$TEMP_TFhour_OR_entry='';
$TFH_OR_method='state_areacode';
+ $TFH_OR_postcode_field_match=0;
+ $TFH_OR_state_field_match=0;
+ $TFH_OR_postcode_state='';
$stmtA = "SELECT container_entry FROM vicidial_settings_containers where container_id='$VD_call_limit_24hour_override';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -5418,8 +5431,37 @@ sub check_24hour_call_count
# define core settings
if ($container_lines[$c] =~ /^method/i)
{
- $container_lines[$c] =~ s/method=>//gi;
+ #$container_lines[$c] =~ s/method=>//gi;
$TFH_OR_method = $container_lines[$c];
+ if ( ($TFH_OR_method =~ /state$/) && ($TFhourSTATE ne $temp_24hour_state) )
+ {
+ $TFH_OR_state_field_match=1;
+ }
+ if ( ($TFH_OR_method =~ /postcode/) && (length($temp_24hour_postal_code) > 0) )
+ {
+ if ($TFhourCOUNTRY == 'USA')
+ {
+ $temp_24hour_postal_code =~ s/\D//gi;
+ $temp_24hour_postal_code = substr($temp_24hour_postal_code,0,5);
+ }
+ if ($TFhourCOUNTRY == 'CAN')
+ {
+ $temp_24hour_postal_code =~ s/[^a-zA-Z0-9]//gi;
+ $temp_24hour_postal_code = substr($temp_24hour_postal_code,0,6);
+ }
+ $stmtA = "SELECT state FROM vicidial_postal_codes where postal_code='$temp_24hour_postal_code';";
+ $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
+ $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
+ $sthArows=$sthA->rows;
+ if ($DBX) {print "$sthArows|$stmtA\n";}
+ if ($sthArows > 0)
+ {
+ @aryA = $sthA->fetchrow_array;
+ $TFH_OR_postcode_state = $aryA[0];
+ $TFH_OR_postcode_field_match=1;
+ }
+ $sthA->finish();
+ }
}
else
{
@@ -5436,6 +5478,24 @@ sub check_24hour_call_count
if ($DB) {print " 24-Hour Call Count State Override Triggered: $TEMPcall_limit_24hour|$container_lines[$c]\n";}
$TEMPcall_limit_24hour = $TEMP_state_ARY[2];
}
+ if ( ($TFH_OR_postcode_state eq $TEMP_state_ARY[1]) && (length($TEMP_state_ARY[2]) > 0) && ($TFH_OR_postcode_field_match > 0) )
+ {
+ if ($DBX) {print " 24-Hour Call Count State Override Match(postcode $TFH_OR_postcode_state): $TEMPcall_limit_24hour|$container_lines[$c]\n";}
+ if ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)
+ {
+ if ($DBX) {print " POSTCODE field override of override triggered: ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)\n";}
+ $TEMPcall_limit_24hour = $TEMP_state_ARY[2];
+ }
+ }
+ if ( ($temp_24hour_state eq $TEMP_state_ARY[1]) && (length($TEMP_state_ARY[2]) > 0) && ($TFH_OR_state_field_match > 0) )
+ {
+ if ($DBX) {print " 24-Hour Call Count State Override Match(state $temp_24hour_state): $TEMPcall_limit_24hour|$container_lines[$c]\n";}
+ if ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)
+ {
+ if ($DBX) {print " STATE field override of override triggered: ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)\n";}
+ $TEMPcall_limit_24hour = $TEMP_state_ARY[2];
+ }
+ }
}
}
}
diff --git a/agc_2-X/trunk/bin/AST_VDhopper.pl b/agc_2-X/trunk/bin/AST_VDhopper.pl
index 19e94b80..b47b886c 100644
--- a/agc_2-X/trunk/bin/AST_VDhopper.pl
+++ b/agc_2-X/trunk/bin/AST_VDhopper.pl
@@ -104,10 +104,11 @@
# 210407-1704 - Modified the Hopper Drop-Run process to modify the priority and source of DROPs already in the hopper
# 210713-1317 - Added call_limit_24hour feature support
# 210718-0343 - Fixes for 24-Hour Call Count Limits with standard Auto-Alt-Dialing
+# 210719-1519 - Added additional state override methods for call_limit_24hour
#
# constants
-$build = '210718-0343';
+$build = '210719-1519';
$script='AST_VDhopper';
$DB=0; # Debug flag, set to 0 for no debug messages. Can be overriden with CLI --debug flag
$US='__';
@@ -555,11 +556,11 @@ if ($CBHOLD_count > 0)
$cba=0;
if (length($CLIcampaign)>0)
{
- $stmtA = "SELECT vicidial_callbacks.lead_id,recipient,campaign_id,vicidial_callbacks.list_id,gmt_offset_now,state,vicidial_callbacks.lead_status,vendor_lead_code,phone_number,phone_code FROM vicidial_callbacks,vicidial_list where callback_time <= '$now_date' and vicidial_callbacks.status IN('ACTIVE','TFHCCL') and vicidial_callbacks.lead_id=vicidial_list.lead_id and vicidial_callbacks.campaign_id IN('$CLIcampaign') $vlNOanyone_callback_inactive_listsSQL;";
+ $stmtA = "SELECT vicidial_callbacks.lead_id,recipient,campaign_id,vicidial_callbacks.list_id,gmt_offset_now,state,vicidial_callbacks.lead_status,vendor_lead_code,phone_number,phone_code,postal_code FROM vicidial_callbacks,vicidial_list where callback_time <= '$now_date' and vicidial_callbacks.status IN('ACTIVE','TFHCCL') and vicidial_callbacks.lead_id=vicidial_list.lead_id and vicidial_callbacks.campaign_id IN('$CLIcampaign') $vlNOanyone_callback_inactive_listsSQL;";
}
else
{
- $stmtA = "SELECT vicidial_callbacks.lead_id,recipient,campaign_id,vicidial_callbacks.list_id,gmt_offset_now,state,vicidial_callbacks.lead_status,vendor_lead_code,phone_number,phone_code FROM vicidial_callbacks,vicidial_list where callback_time <= '$now_date' and vicidial_callbacks.status IN('ACTIVE','TFHCCL') and vicidial_callbacks.lead_id=vicidial_list.lead_id $vlNOanyone_callback_inactive_listsSQL;";
+ $stmtA = "SELECT vicidial_callbacks.lead_id,recipient,campaign_id,vicidial_callbacks.list_id,gmt_offset_now,state,vicidial_callbacks.lead_status,vendor_lead_code,phone_number,phone_code,postal_code FROM vicidial_callbacks,vicidial_list where callback_time <= '$now_date' and vicidial_callbacks.status IN('ACTIVE','TFHCCL') and vicidial_callbacks.lead_id=vicidial_list.lead_id $vlNOanyone_callback_inactive_listsSQL;";
}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -581,6 +582,7 @@ if ($CBHOLD_count > 0)
$CA_vendor_lead_code[$cba] = $aryA[7];
$CA_phone_number[$cba] = $aryA[8];
$CA_phone_code[$cba] = $aryA[9];
+ $CA_postal_code[$cba] = $aryA[10];
$cba++;
}
$cbc++;
@@ -708,6 +710,8 @@ if ($CBHOLD_count > 0)
{
$temp_24hour_phone = $CA_phone_number[$CAu];
$temp_24hour_phone_code = $CA_phone_code[$CAu];
+ $temp_24hour_state = $CA_state[$CAu];
+ $temp_24hour_postal_code = $CA_postal_code[$CAu];
$TEMPlead_id = $CA_lead_id[$CAu];
$TEMPcampaign_id = $CA_campaign_id[$CAu];
$TEMPcall_limit_24hour_method = $VD_call_limit_24hour_method;
@@ -834,7 +838,7 @@ if ($hopper_dnc_count > 0)
{
$alt_dial_skip=0;
$VD_alt_phone='';
- $stmtA="SELECT alt_phone,gmt_offset_now,state,list_id,phone_code FROM vicidial_list where lead_id='$AAD_lead_id[$aad]';";
+ $stmtA="SELECT alt_phone,gmt_offset_now,state,list_id,phone_code,postal_code 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;
@@ -848,6 +852,7 @@ if ($hopper_dnc_count > 0)
$VD_state = $aryA[2];
$VD_list_id = $aryA[3];
$VD_phone_code = $aryA[4];
+ $VD_postal_code = $aryA[5];
}
$sthA->finish();
if (length($VD_alt_phone)>5)
@@ -904,6 +909,8 @@ if ($hopper_dnc_count > 0)
{
$temp_24hour_phone = $VD_alt_phone;
$temp_24hour_phone_code = $VD_phone_code;
+ $temp_24hour_state = $VD_state;
+ $temp_24hour_postal_code = $VD_postal_code;
$TEMPlead_id = $AAD_lead_id[$aad];
$TEMPcampaign_id = $AAD_campaign_id[$aad];
$TEMPcall_limit_24hour_method = $VD_call_limit_24hour_method;
@@ -939,7 +946,7 @@ if ($hopper_dnc_count > 0)
{
$addr3_dial_skip=0;
$VD_address3='';
- $stmtA="SELECT address3,gmt_offset_now,state,list_id,phone_code FROM vicidial_list where lead_id='$AAD_lead_id[$aad]';";
+ $stmtA="SELECT address3,gmt_offset_now,state,list_id,phone_code,postal_code 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;
@@ -953,6 +960,7 @@ if ($hopper_dnc_count > 0)
$VD_state = $aryA[2];
$VD_list_id = $aryA[3];
$VD_phone_code = $aryA[4];
+ $VD_postal_code = $aryA[5];
}
$sthA->finish();
if (length($VD_address3)>5)
@@ -1009,6 +1017,8 @@ if ($hopper_dnc_count > 0)
{
$temp_24hour_phone = $VD_address3;
$temp_24hour_phone_code = $VD_phone_code;
+ $temp_24hour_state = $VD_state;
+ $temp_24hour_postal_code = $VD_postal_code;
$TEMPlead_id = $AAD_lead_id[$aad];
$TEMPcampaign_id = $VD_campaign_id;
$TEMPcall_limit_24hour_method = $VD_call_limit_24hour_method;
@@ -1049,7 +1059,7 @@ if ($hopper_dnc_count > 0)
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';";
+ $stmtA="SELECT gmt_offset_now,state,list_id,postal_code 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;
@@ -1060,6 +1070,7 @@ if ($hopper_dnc_count > 0)
$VD_gmt_offset_now = $aryA[0];
$VD_state = $aryA[1];
$VD_list_id = $aryA[2];
+ $VD_postal_code = $aryA[3];
}
$sthA->finish();
$alt_dial_phones_count=0;
@@ -1158,6 +1169,8 @@ if ($hopper_dnc_count > 0)
{
$temp_24hour_phone = $VD_altdial_phone;
$temp_24hour_phone_code = $VD_altdial_phone_code;
+ $temp_24hour_state = $VD_state;
+ $temp_24hour_postal_code = $VD_postal_code;
$TEMPlead_id = $AAD_lead_id[$aad];
$TEMPcampaign_id = $VD_campaign_id;
$TEMPcall_limit_24hour_method = $VD_call_limit_24hour_method;
@@ -3045,6 +3058,7 @@ foreach(@campaign_id)
@REC_lists_to_hopper=@MT;
@REC_phone_to_hopper=@MT;
@REC_phone_code_to_hopper=@MT;
+ @REC_postal_code_to_hopper=@MT;
@REC_gmt_to_hopper=@MT;
@REC_state_to_hopper=@MT;
@REC_status_to_hopper=@MT;
@@ -3059,7 +3073,7 @@ foreach(@campaign_id)
if ($hopper_vlc_dup_check[$i] =~ /Y/)
{$vlc_dup_check_SQL = "and vendor_lead_code NOT IN($live_vlc$vlc_lists)";}
- $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user,vendor_lead_code,phone_code FROM vicidial_list $VLforce_index where $recycle_SQL[$i] and ($list_id_sql[$i]) and lead_id NOT IN($lead_id_lists) $vlc_dup_check_SQL and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $CCLsql[$i] $DLTsql[$i] $dnc_blocked_lists_SQL $order_stmt limit $hopper_level[$i];";
+ $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user,vendor_lead_code,phone_code,postal_code FROM vicidial_list $VLforce_index where $recycle_SQL[$i] and ($list_id_sql[$i]) and lead_id NOT IN($lead_id_lists) $vlc_dup_check_SQL and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $CCLsql[$i] $DLTsql[$i] $dnc_blocked_lists_SQL $order_stmt limit $hopper_level[$i];";
if ($DBX) {print " |$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -3079,6 +3093,7 @@ foreach(@campaign_id)
$REC_user_to_hopper[$REC_rec_countLEADS] = $aryA[7];
$REC_vlc_to_hopper[$REC_rec_countLEADS] = $aryA[8];
$REC_phone_code_to_hopper[$REC_rec_countLEADS] =$aryA[9];
+ $REC_postal_code_to_hopper[$REC_rec_countLEADS] =$aryA[10];
$REC_source_to_hopper[$REC_rec_countLEADS] = 'R';
if ($DB_show_offset) {print "LEAD_ADD: $aryA[2] $aryA[3] $aryA[4]\n";}
$REC_rec_countLEADS++;
@@ -3102,6 +3117,7 @@ foreach(@campaign_id)
@NEW_lists_to_hopper=@MT;
@NEW_phone_to_hopper=@MT;
@NEW_phone_code_to_hopper=@MT;
+ @NEW_postal_code_to_hopper=@MT;
@NEW_gmt_to_hopper=@MT;
@NEW_state_to_hopper=@MT;
@NEW_status_to_hopper=@MT;
@@ -3118,7 +3134,7 @@ foreach(@campaign_id)
if ($hopper_vlc_dup_check[$i] =~ /Y/)
{$vlc_dup_check_SQL = "and vendor_lead_code NOT IN($live_vlc$vlc_lists)";}
- $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user,vendor_lead_code,phone_code FROM vicidial_list $VLforce_index where $cslrSQL status IN('NEW') and ($list_id_sql[$i]) and lead_id NOT IN($lead_id_lists) $vlc_dup_check_SQL and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $CCLsql[$i] $DLTsql[$i] $dnc_blocked_lists_SQL $order_stmt limit $NEW_level;";
+ $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user,vendor_lead_code,phone_code,postal_code FROM vicidial_list $VLforce_index where $cslrSQL status IN('NEW') and ($list_id_sql[$i]) and lead_id NOT IN($lead_id_lists) $vlc_dup_check_SQL and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $CCLsql[$i] $DLTsql[$i] $dnc_blocked_lists_SQL $order_stmt limit $NEW_level;";
if ($DBX) {print " |$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -3136,6 +3152,7 @@ foreach(@campaign_id)
$NEW_user_to_hopper[$NEW_rec_countLEADS] = $aryA[7];
$NEW_vlc_to_hopper[$NEW_rec_countLEADS] = $aryA[8];
$NEW_phone_code_to_hopper[$NEW_rec_countLEADS] =$aryA[9];
+ $NEW_postal_code_to_hopper[$NEW_rec_countLEADS] =$aryA[10];
$NEW_source_to_hopper[$NEW_rec_countLEADS] = 'N';
if ($DB_show_offset) {print "LEAD_ADD: $aryA[2] $aryA[3] $aryA[4]\n";}
$NEW_rec_countLEADS++;
@@ -3161,6 +3178,7 @@ foreach(@campaign_id)
@state_to_hopper=@MT;
@phone_to_hopper=@MT;
@phone_code_to_hopper=@MT;
+ @postal_code_to_hopper=@MT;
@status_to_hopper=@MT;
@modify_to_hopper=@MT;
@user_to_hopper=@MT;
@@ -3175,7 +3193,7 @@ foreach(@campaign_id)
if ($list_order_mix[$i] =~ /DISABLED/)
{
- $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user,vendor_lead_code,phone_code FROM vicidial_list $VLforce_index where $cslrSQL status IN($STATUSsql[$i]) and ($list_id_sql[$i]) and lead_id NOT IN($lead_id_lists) $vlc_dup_check_SQL and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $CCLsql[$i] $DLTsql[$i] $dnc_blocked_lists_SQL $order_stmt limit $OTHER_level;";
+ $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user,vendor_lead_code,phone_code,postal_code FROM vicidial_list $VLforce_index where $cslrSQL status IN($STATUSsql[$i]) and ($list_id_sql[$i]) and lead_id NOT IN($lead_id_lists) $vlc_dup_check_SQL and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $CCLsql[$i] $DLTsql[$i] $dnc_blocked_lists_SQL $order_stmt limit $OTHER_level;";
if ($DBX) {print " |$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -3198,6 +3216,7 @@ foreach(@campaign_id)
$state_to_hopper[$rec_countLEADS] = $NEW_state_to_hopper[$NEW_in];
$phone_to_hopper[$rec_countLEADS] = $NEW_phone_to_hopper[$NEW_in];
$phone_code_to_hopper[$rec_countLEADS] =$NEW_phone_code_to_hopper[$NEW_in];
+ $postal_code_to_hopper[$rec_countLEADS] =$NEW_postal_code_to_hopper[$NEW_in];
$status_to_hopper[$rec_countLEADS] = $NEW_status_to_hopper[$NEW_in];
$modify_to_hopper[$rec_countLEADS] = $NEW_modify_to_hopper[$NEW_in];
$user_to_hopper[$rec_countLEADS] = $NEW_user_to_hopper[$NEW_in];
@@ -3217,6 +3236,7 @@ foreach(@campaign_id)
$state_to_hopper[$rec_countLEADS] = $REC_state_to_hopper[$REC_insert_count];
$phone_to_hopper[$rec_countLEADS] = $REC_phone_to_hopper[$REC_insert_count];
$phone_code_to_hopper[$rec_countLEADS] =$REC_phone_code_to_hopper[$REC_insert_count];
+ $postal_code_to_hopper[$rec_countLEADS] =$REC_postal_code_to_hopper[$REC_insert_count];
$status_to_hopper[$rec_countLEADS] = $REC_status_to_hopper[$REC_insert_count];
$modify_to_hopper[$rec_countLEADS] = $REC_modify_to_hopper[$REC_insert_count];
$user_to_hopper[$rec_countLEADS] = $REC_user_to_hopper[$REC_insert_count];
@@ -3235,6 +3255,7 @@ foreach(@campaign_id)
$user_to_hopper[$rec_countLEADS] = $aryA[7];
$vlc_to_hopper[$rec_countLEADS] = $aryA[8];
$phone_code_to_hopper[$rec_countLEADS] =$aryA[9];
+ $postal_code_to_hopper[$rec_countLEADS] =$aryA[10];
$source_to_hopper[$rec_countLEADS] = $hopperSOURCE;
if ($DB_show_offset) {print "LEAD_ADD: $aryA[2] $aryA[3] $aryA[4]\n";}
$rec_countLEADS++;
@@ -3281,7 +3302,7 @@ foreach(@campaign_id)
if ($hopper_vlc_dup_check[$i] =~ /Y/)
{$vlc_dup_check_SQL = "and vendor_lead_code NOT IN($live_vlc$vlc_lists)";}
- $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user,vendor_lead_code,phone_code FROM vicidial_list $VLforce_index where $cslrSQL ($list_mix_dialableSQL) and lead_id NOT IN($lead_id_lists) $vlc_dup_check_SQL and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $CCLsql[$i] $DLTsql[$i] $dnc_blocked_lists_SQL $order_stmt limit $LM_step_goal[$x];";
+ $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user,vendor_lead_code,phone_code,postal_code FROM vicidial_list $VLforce_index where $cslrSQL ($list_mix_dialableSQL) and lead_id NOT IN($lead_id_lists) $vlc_dup_check_SQL and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $CCLsql[$i] $DLTsql[$i] $dnc_blocked_lists_SQL $order_stmt limit $LM_step_goal[$x];";
if ($DBX) {print " |$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -3304,7 +3325,7 @@ foreach(@campaign_id)
$order = ( ($x * 1000000) + $rec_count);
}
}
- $LM_results[$z] = "$order$USX$aryA[0]$USX$aryA[1]$USX$aryA[2]$USX$aryA[3]$USX$aryA[4]$USX$aryA[5]$USX$aryA[6]$USX$aryA[7]$USX$aryA[8]$USX$aryA[9]";
+ $LM_results[$z] = "$order$USX$aryA[0]$USX$aryA[1]$USX$aryA[2]$USX$aryA[3]$USX$aryA[4]$USX$aryA[5]$USX$aryA[6]$USX$aryA[7]$USX$aryA[8]$USX$aryA[9]$USX$aryA[10]";
# if ($DBX) {print " $z|$LM_results[$z]\n";}
$rec_count++;
@@ -3329,6 +3350,7 @@ foreach(@campaign_id)
$state_to_hopper[$rec_countLEADS] = $REC_state_to_hopper[$REC_insert_count];
$phone_to_hopper[$rec_countLEADS] = $REC_phone_to_hopper[$REC_insert_count];
$phone_code_to_hopper[$rec_countLEADS] =$REC_phone_code_to_hopper[$REC_insert_count];
+ $postal_code_to_hopper[$rec_countLEADS] =$REC_postal_code_to_hopper[$REC_insert_count];
$status_to_hopper[$rec_countLEADS] = $REC_status_to_hopper[$REC_insert_count];
$modify_to_hopper[$rec_countLEADS] = $REC_modify_to_hopper[$REC_insert_count];
$user_to_hopper[$rec_countLEADS] = $REC_user_to_hopper[$REC_insert_count];
@@ -3347,6 +3369,7 @@ foreach(@campaign_id)
$user_to_hopper[$rec_countLEADS] = $aryA[8];
$vlc_to_hopper[$rec_countLEADS] = $aryA[9];
$phone_code_to_hopper[$rec_countLEADS] =$aryA[10];
+ $postal_code_to_hopper[$rec_countLEADS] =$aryA[11];
$source_to_hopper[$rec_countLEADS] = $hopperSOURCE;
if ($DB_show_offset) {print "LEAD_ADD: $aryA[3] $aryA[4] $aryA[5]\n";}
if ($DBX) {print " $w|$LM_results[$w]\n";}
@@ -3367,6 +3390,7 @@ foreach(@campaign_id)
$state_to_hopper[$rec_countLEADS] = $REC_state_to_hopper[$REC_insert_count];
$phone_to_hopper[$rec_countLEADS] = $REC_phone_to_hopper[$REC_insert_count];
$phone_code_to_hopper[$rec_countLEADS] =$REC_phone_code_to_hopper[$REC_insert_count];
+ $postal_code_to_hopper[$rec_countLEADS] =$REC_postal_code_to_hopper[$REC_insert_count];
$status_to_hopper[$rec_countLEADS] = $REC_status_to_hopper[$REC_insert_count];
$modify_to_hopper[$rec_countLEADS] = $REC_modify_to_hopper[$REC_insert_count];
$user_to_hopper[$rec_countLEADS] = $REC_user_to_hopper[$REC_insert_count];
@@ -3492,6 +3516,8 @@ foreach(@campaign_id)
{
$temp_24hour_phone = $phone_to_hopper[$h];
$temp_24hour_phone_code = $phone_code_to_hopper[$h];
+ $temp_24hour_state = $state_to_hopper[$h];
+ $temp_24hour_postal_code = $postal_code_to_hopper[$h];
$TEMPlead_id = $leads_to_hopper[$h];
$TEMPcampaign_id = $campaign_id[$i];
$TEMPcall_limit_24hour_method = $call_limit_24hour_method[$i];
@@ -3545,14 +3571,14 @@ foreach(@campaign_id)
if ( ($VAC_exist > 0) || ($VLA_exist > 0) )
{
- $detail_string = "LIVE CALL SKIPPING |$VAC_exist|$VLA_exist| |$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|$vlc_to_hopper[$h]|$phone_code_to_hopper[$h]|";
+ $detail_string = "LIVE CALL SKIPPING |$VAC_exist|$VLA_exist| |$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|$vlc_to_hopper[$h]|$phone_code_to_hopper[$h]|$postal_code_to_hopper[$h]|";
&detail_logger;
}
else
{
if ( ($VLC_exist > 0) && ($hopper_vlc_dup_check[$i] =~ /Y/) )
{
- $detail_string = "VLC CALL SKIPPING |$VLC_exist|$hopper_vlc_dup_check[$i]| |$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|$vlc_to_hopper[$h]|$phone_code_to_hopper[$h]|";
+ $detail_string = "VLC CALL SKIPPING |$VLC_exist|$hopper_vlc_dup_check[$i]| |$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|$vlc_to_hopper[$h]|$phone_code_to_hopper[$h]|$postal_code_to_hopper[$h]|";
&detail_logger;
$vlc_dup_check_SKIP_COUNT++;
}
@@ -3568,7 +3594,7 @@ foreach(@campaign_id)
if ($DBX) {print "LEAD INSERTED: $affected_rows|$leads_to_hopper[$h]|\n";}
if ($DB_detail)
{
- $detail_string = "|$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|$vlc_to_hopper[$h]|$source_to_hopper[$h]|$phone_code_to_hopper[$h]|";
+ $detail_string = "|$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|$vlc_to_hopper[$h]|$source_to_hopper[$h]|$phone_code_to_hopper[$h]|$postal_code_to_hopper[$h]|";
&detail_logger;
}
}
@@ -3576,7 +3602,7 @@ foreach(@campaign_id)
{
if ($DCCLlead > 0) {$DCCLskip++;}
if ($TFHCCLlead > 0) {$TFHCCLskip++;}
- $detail_string = "DAILY/24-HOUR CALL COUNT LIMIT SKIPPING |$DCCLlead|$TFHCCLlead|($TFhourCOUNT >= $TEMPcall_limit_24hour)| |$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|$vlc_to_hopper[$h]|$source_to_hopper[$h]|$phone_code_to_hopper[$h]|";
+ $detail_string = "DAILY/24-HOUR CALL COUNT LIMIT SKIPPING |$DCCLlead|$TFHCCLlead|($TFhourCOUNT >= $TEMPcall_limit_24hour)| |$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|$vlc_to_hopper[$h]|$source_to_hopper[$h]|$phone_code_to_hopper[$h]|$postal_code_to_hopper[$h]|";
&detail_logger;
}
}
@@ -3591,7 +3617,7 @@ foreach(@campaign_id)
if ($DBX) {print "LEAD INSERTED AS DNC: $affected_rows|$leads_to_hopper[$h]|\n";}
if ($DB_detail)
{
- $detail_string = "|$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|$vlc_to_hopper[$h]|$source_to_hopper[$h]|$phone_code_to_hopper[$h]|";
+ $detail_string = "|$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|$vlc_to_hopper[$h]|$source_to_hopper[$h]|$phone_code_to_hopper[$h]|$postal_code_to_hopper[$h]|";
&detail_logger;
}
}
@@ -3680,7 +3706,7 @@ sub check_24hour_call_count
{
$stmtA="SELECT count(*) FROM vicidial_lead_24hour_calls where lead_id='$TEMPlead_id' and (call_date >= NOW() - INTERVAL 1 DAY) $limit_scopeSQL;";
}
- if ($DB) {print " Doing 24-Hour Call Count Check: $TEMPlead_id|$temp_24hour_phone_code|$temp_24hour_phone - $TEMPcall_limit_24hour_method|$TEMPcall_limit_24hour_scope\n";}
+ if ($DB) {print " Doing 24-Hour Call Count Check: $TEMPlead_id|$temp_24hour_phone_code|$temp_24hour_phone|$temp_24hour_state|$temp_24hour_postal_code - $TEMPcall_limit_24hour_method - $TEMPcall_limit_24hour_scope - $TEMPcall_limit_24hour|$TEMPcall_limit_24hour_scope\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -3693,7 +3719,7 @@ sub check_24hour_call_count
$TFhourCOUNT = ($TFhourCOUNT + $aryA[0]);
}
$sthA->finish();
- $TEMPcall_limit_24hour = $TEMPcall_limit_24hour;
+
if ($DBX) {print " 24-Hour Call Limit Count DEBUG: $TFhourCOUNT|$stmtA|\n";}
if ( ($TEMPcall_limit_24hour_override !~ /^DISABLED$/) && (length($TEMPcall_limit_24hour_override) > 0) )
@@ -3713,6 +3739,9 @@ sub check_24hour_call_count
$TEMP_TFhour_OR_entry='';
$TFH_OR_method='state_areacode';
+ $TFH_OR_postcode_field_match=0;
+ $TFH_OR_state_field_match=0;
+ $TFH_OR_postcode_state='';
$stmtA = "SELECT container_entry FROM vicidial_settings_containers where container_id='$TEMPcall_limit_24hour_override';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -3738,8 +3767,38 @@ sub check_24hour_call_count
# define core settings
if ($container_lines[$c] =~ /^method/i)
{
- $container_lines[$c] =~ s/method=>//gi;
+ #$container_lines[$c] =~ s/method=>//gi;
$TFH_OR_method = $container_lines[$c];
+
+ if ( ($TFH_OR_method =~ /state$/) && ($TFhourSTATE ne $temp_24hour_state) )
+ {
+ $TFH_OR_state_field_match=1;
+ }
+ if ( ($TFH_OR_method =~ /postcode/) && (length($temp_24hour_postal_code) > 0) )
+ {
+ if ($TFhourCOUNTRY == 'USA')
+ {
+ $temp_24hour_postal_code =~ s/\D//gi;
+ $temp_24hour_postal_code = substr($temp_24hour_postal_code,0,5);
+ }
+ if ($TFhourCOUNTRY == 'CAN')
+ {
+ $temp_24hour_postal_code =~ s/[^a-zA-Z0-9]//gi;
+ $temp_24hour_postal_code = substr($temp_24hour_postal_code,0,6);
+ }
+ $stmtA = "SELECT state FROM vicidial_postal_codes where postal_code='$temp_24hour_postal_code';";
+ $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
+ $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
+ $sthArows=$sthA->rows;
+ if ($DBX) {print "$sthArows|$stmtA\n";}
+ if ($sthArows > 0)
+ {
+ @aryA = $sthA->fetchrow_array;
+ $TFH_OR_postcode_state = $aryA[0];
+ $TFH_OR_postcode_field_match=1;
+ }
+ $sthA->finish();
+ }
}
else
{
@@ -3756,6 +3815,24 @@ sub check_24hour_call_count
if ($DB) {print " 24-Hour Call Count State Override Triggered: $TEMPcall_limit_24hour|$container_lines[$c]\n";}
$TEMPcall_limit_24hour = $TEMP_state_ARY[2];
}
+ if ( ($TFH_OR_postcode_state eq $TEMP_state_ARY[1]) && (length($TEMP_state_ARY[2]) > 0) && ($TFH_OR_postcode_field_match > 0) )
+ {
+ if ($DBX) {print " 24-Hour Call Count State Override Match(postcode $TFH_OR_postcode_state): $TEMPcall_limit_24hour|$container_lines[$c]\n";}
+ if ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)
+ {
+ if ($DBX) {print " POSTCODE field override of override triggered: ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)\n";}
+ $TEMPcall_limit_24hour = $TEMP_state_ARY[2];
+ }
+ }
+ if ( ($temp_24hour_state eq $TEMP_state_ARY[1]) && (length($TEMP_state_ARY[2]) > 0) && ($TFH_OR_state_field_match > 0) )
+ {
+ if ($DBX) {print " 24-Hour Call Count State Override Match(state $temp_24hour_state): $TEMPcall_limit_24hour|$container_lines[$c]\n";}
+ if ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)
+ {
+ if ($DBX) {print " STATE field override of override triggered: ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)\n";}
+ $TEMPcall_limit_24hour = $TEMP_state_ARY[2];
+ }
+ }
}
}
}
diff --git a/agc_2-X/trunk/bin/FastAGI_log.pl b/agc_2-X/trunk/bin/FastAGI_log.pl
index 6afd0f5a..0191d928 100644
--- a/agc_2-X/trunk/bin/FastAGI_log.pl
+++ b/agc_2-X/trunk/bin/FastAGI_log.pl
@@ -89,6 +89,7 @@
# 210314-1015 - Added enhanced_disconnect_logging=2 option
# 210606-1007 - Added TILTX features for pre-carrier call filtering
# 210718-0358 - Fixes for 24-Hour Call Count Limits with standard Auto-Alt-Dialing
+# 210719-1521 - Added additional state override methods for call_limit_24hour
#
# defaults for PreFork
@@ -1781,7 +1782,7 @@ sub process_request
{
$alt_dial_skip=0;
$VD_alt_phone='';
- $stmtA="SELECT alt_phone,gmt_offset_now,state,list_id,phone_code FROM vicidial_list where lead_id='$VD_lead_id';";
+ $stmtA="SELECT alt_phone,gmt_offset_now,state,list_id,phone_code,postal_code FROM vicidial_list where lead_id='$VD_lead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1796,6 +1797,7 @@ sub process_request
$VD_state = $aryA[2];
$VD_list_id = $aryA[3];
$VD_phone_code = $aryA[4];
+ $VD_postal_code = $aryA[5];
$epc_countCAMPDATA++;
}
$sthA->finish();
@@ -1851,8 +1853,10 @@ sub process_request
$passed_24hour_call_count=1;
if ( ($SScall_limit_24hour > 0) && ($VD_call_limit_24hour_method =~ /PHONE_NUMBER|LEAD/) )
{
- $temp_24hour_phone = $VD_alt_phone;
- $temp_24hour_phone_code = $VD_phone_code;
+ $temp_24hour_phone = $VD_alt_phone;
+ $temp_24hour_phone_code = $VD_phone_code;
+ $temp_24hour_state = $VD_state;
+ $temp_24hour_postal_code = $VD_postal_code;
if ($DB > 0) {print "24-Hour Call Count Check: $SScall_limit_24hour|$VD_call_limit_24hour_method|$VD_lead_id|\n";}
&check_24hour_call_count;
}
@@ -1881,7 +1885,7 @@ sub process_request
{
$addr3_dial_skip=0;
$VD_address3='';
- $stmtA="SELECT address3,gmt_offset_now,state,list_id,phone_code FROM vicidial_list where lead_id='$VD_lead_id';";
+ $stmtA="SELECT address3,gmt_offset_now,state,list_id,phone_code,postal_code FROM vicidial_list where lead_id='$VD_lead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1896,6 +1900,7 @@ sub process_request
$VD_state = $aryA[2];
$VD_list_id = $aryA[3];
$VD_phone_code = $aryA[4];
+ $VD_postal_code = $aryA[5];
$epc_countCAMPDATA++;
}
$sthA->finish();
@@ -1951,8 +1956,10 @@ sub process_request
$passed_24hour_call_count=1;
if ( ($SScall_limit_24hour > 0) && ($VD_call_limit_24hour_method =~ /PHONE_NUMBER|LEAD/) )
{
- $temp_24hour_phone = $VD_address3;
- $temp_24hour_phone_code = $VD_phone_code;
+ $temp_24hour_phone = $VD_address3;
+ $temp_24hour_phone_code = $VD_phone_code;
+ $temp_24hour_state = $VD_state;
+ $temp_24hour_postal_code = $VD_postal_code;
if ($DB > 0) {print "24-Hour Call Count Check: $SScall_limit_24hour|$VD_call_limit_24hour_method|$VD_lead_id|\n";}
&check_24hour_call_count;
}
@@ -1986,7 +1993,7 @@ sub process_request
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';";
+ $stmtA="SELECT gmt_offset_now,state,list_id,postal_code FROM vicidial_list where lead_id='$VD_lead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1998,6 +2005,7 @@ sub process_request
$VD_gmt_offset_now = $aryA[0];
$VD_state = $aryA[1];
$VD_list_id = $aryA[2];
+ $VD_postal_code = $aryA[3];
$epc_countCAMPDATA++;
}
$sthA->finish();
@@ -2092,8 +2100,10 @@ sub process_request
$passed_24hour_call_count=1;
if ( ($SScall_limit_24hour > 0) && ($VD_call_limit_24hour_method =~ /PHONE_NUMBER|LEAD/) )
{
- $temp_24hour_phone = $VD_altdial_phone;
- $temp_24hour_phone_code = $VD_altdial_phone_code;
+ $temp_24hour_phone = $VD_altdial_phone;
+ $temp_24hour_phone_code = $VD_altdial_phone_code;
+ $temp_24hour_state = $VD_state;
+ $temp_24hour_postal_code = $VD_postal_code;
if ($DB > 0) {print "24-Hour Call Count Check: $SScall_limit_24hour|$VD_call_limit_24hour_method|$VD_lead_id|\n";}
&check_24hour_call_count;
}
@@ -2527,7 +2537,7 @@ sub check_24hour_call_count
{
$stmtA="SELECT count(*) FROM vicidial_lead_24hour_calls where lead_id='$VD_lead_id' and (call_date >= NOW() - INTERVAL 1 DAY) $limit_scopeSQL;";
}
- if ($DB) {print " Doing 24-Hour Call Count Check: $VD_lead_id|$temp_24hour_phone_code|$temp_24hour_phone - $VD_call_limit_24hour_method|$VD_call_limit_24hour_scope\n";}
+ if ($DB) {print " Doing 24-Hour Call Count Check: $VD_lead_id|$temp_24hour_phone_code|$temp_24hour_phone|$temp_24hour_state|$temp_24hour_postal_code - $VD_call_limit_24hour_method|$VD_call_limit_24hour_scope|$VD_call_limit_24hour\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -2560,6 +2570,9 @@ sub check_24hour_call_count
$TEMP_TFhour_OR_entry='';
$TFH_OR_method='state_areacode';
+ $TFH_OR_postcode_field_match=0;
+ $TFH_OR_state_field_match=0;
+ $TFH_OR_postcode_state='';
$stmtA = "SELECT container_entry FROM vicidial_settings_containers where container_id='$VD_call_limit_24hour_override';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -2585,8 +2598,37 @@ sub check_24hour_call_count
# define core settings
if ($container_lines[$c] =~ /^method/i)
{
- $container_lines[$c] =~ s/method=>//gi;
+ #$container_lines[$c] =~ s/method=>//gi;
$TFH_OR_method = $container_lines[$c];
+ if ( ($TFH_OR_method =~ /state$/) && ($TFhourSTATE ne $temp_24hour_state) )
+ {
+ $TFH_OR_state_field_match=1;
+ }
+ if ( ($TFH_OR_method =~ /postcode/) && (length($temp_24hour_postal_code) > 0) )
+ {
+ if ($TFhourCOUNTRY == 'USA')
+ {
+ $temp_24hour_postal_code =~ s/\D//gi;
+ $temp_24hour_postal_code = substr($temp_24hour_postal_code,0,5);
+ }
+ if ($TFhourCOUNTRY == 'CAN')
+ {
+ $temp_24hour_postal_code =~ s/[^a-zA-Z0-9]//gi;
+ $temp_24hour_postal_code = substr($temp_24hour_postal_code,0,6);
+ }
+ $stmtA = "SELECT state FROM vicidial_postal_codes where postal_code='$temp_24hour_postal_code';";
+ $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
+ $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
+ $sthArows=$sthA->rows;
+ if ($DBX) {print "$sthArows|$stmtA\n";}
+ if ($sthArows > 0)
+ {
+ @aryA = $sthA->fetchrow_array;
+ $TFH_OR_postcode_state = $aryA[0];
+ $TFH_OR_postcode_field_match=1;
+ }
+ $sthA->finish();
+ }
}
else
{
@@ -2603,6 +2645,24 @@ sub check_24hour_call_count
if ($DB) {print " 24-Hour Call Count State Override Triggered: $TEMPcall_limit_24hour|$container_lines[$c]\n";}
$TEMPcall_limit_24hour = $TEMP_state_ARY[2];
}
+ if ( ($TFH_OR_postcode_state eq $TEMP_state_ARY[1]) && (length($TEMP_state_ARY[2]) > 0) && ($TFH_OR_postcode_field_match > 0) )
+ {
+ if ($DBX) {print " 24-Hour Call Count State Override Match(postcode $TFH_OR_postcode_state): $TEMPcall_limit_24hour|$container_lines[$c]\n";}
+ if ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)
+ {
+ if ($DBX) {print " POSTCODE field override of override triggered: ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)\n";}
+ $TEMPcall_limit_24hour = $TEMP_state_ARY[2];
+ }
+ }
+ if ( ($temp_24hour_state eq $TEMP_state_ARY[1]) && (length($TEMP_state_ARY[2]) > 0) && ($TFH_OR_state_field_match > 0) )
+ {
+ if ($DBX) {print " 24-Hour Call Count State Override Match(state $temp_24hour_state): $TEMPcall_limit_24hour|$container_lines[$c]\n";}
+ if ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)
+ {
+ if ($DBX) {print " STATE field override of override triggered: ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)\n";}
+ $TEMPcall_limit_24hour = $TEMP_state_ARY[2];
+ }
+ }
}
}
}
diff --git a/agc_2-X/trunk/docs/CALL_COUNT_LIMITS.txt b/agc_2-X/trunk/docs/CALL_COUNT_LIMITS.txt
index 8a5e7fde..50967601 100644
--- a/agc_2-X/trunk/docs/CALL_COUNT_LIMITS.txt
+++ b/agc_2-X/trunk/docs/CALL_COUNT_LIMITS.txt
@@ -1,4 +1,4 @@
-CALL COUNT LIMITS Started: 2020-11-22 Updated: 2021-07-18
+CALL COUNT LIMITS Started: 2020-11-22 Updated: 2021-07-19
@@ -50,7 +50,13 @@ Another setting on the campaign detail page related to this 24-Hour Call Count L
The last setting on the campaign detail page related to this 24-Hour Call Count Limits is "24-Hour Called Count Limit Override", where you can create a Settings Container of the "CALL_LIMITS_OVERRIDE" container type that will allow you to override the 24-Hour Called Count Limit for calls to specific states, based upon the area-code of the phone number being dialed. The area-code-to-state relationship is defined in the internal database which you can access by going to "Admin => System Settings => Phone Codes => Phone Codes". Default for this setting is DISABLED.
Here is an example CALL_LIMITS_OVERRIDE Container Entry that will work with this setting:
-; The only allowed method currently is state_areacode
+; Select one of the three methods below for how the state is determined:
+; 'state_areacode' will look only at the phone_code(country code) and the area-code of the phone number to determine the state
+; 'state_areacode_postcode' will do the same as above, but it will also check to see if the postal code mathes this state
+; 'state_areacode_postcode_state' will do the same as above, but it will also check to see if the lead's "state" field mathes this state
+; 'state_areacode_state' will do the same as the first option, but it will also check to see if the lead's "state" field mathes this state
+; NOTE: for the last three options, if ANY of the selected criteria matches a state defined below, it will use that 24-hour call count limit.
+; If more than one entry matches, the lowest call count limit of the matching entries will be used.
method => state_areacode
; One line per state, with fields separated by commas: the country abbreviation, state abbreviation and the 24-hour call limit for that state
state => USA,FL,3
diff --git a/agc_2-X/trunk/www/agc/vdc_db_query.php b/agc_2-X/trunk/www/agc/vdc_db_query.php
index 788b19aa..c8d281a2 100644
--- a/agc_2-X/trunk/www/agc/vdc_db_query.php
+++ b/agc_2-X/trunk/www/agc/vdc_db_query.php
@@ -514,13 +514,14 @@
# 210705-1046 - Added User override for campaign manual_dial_filter setting
# 210713-1344 - Added call_limit_24hour feature support
# 210718-0936 - Fixes for 24-Hour Call Count Limits with standard Auto-Alt-Dialing
+# 210719-1120 - Added new state override options for 24-Hour Call Count Limits
#
-$version = '2.14-407';
-$build = '210718-0936';
+$version = '2.14-408';
+$build = '210719-1120';
$php_script = 'vdc_db_query.php';
$mel=1; # Mysql Error Log enabled = 1
-$mysql_log_count=863;
+$mysql_log_count=865;
$one_mysql_log=0;
$DB=0;
$VD_login=0;
@@ -4238,7 +4239,7 @@ if ($ACTION == 'manDiaLnextCaLL')
}
### 24-Hour call count limit check ###
- manual_tfhccl_check($lead_id, $agent_dialed_number, $phone_code, 0);
+ manual_tfhccl_check($lead_id, $agent_dialed_number, $phone_code, 0, $postal_code, $state, 'manDiaLnextCaLL');
}
#### END check for 24-hour call count limit ####
@@ -5929,7 +5930,7 @@ if ($ACTION == 'manDiaLonly')
}
### 24-Hour call count limit check ###
- manual_tfhccl_check($lead_id, $phone_number, $phone_code, 0);
+ manual_tfhccl_check($lead_id, $phone_number, $phone_code, 0, $postal_code, $state, 'manDiaLonly');
}
#### END check for 24-hour call count limit ####
@@ -7881,7 +7882,7 @@ if ($stage == "end")
if ( (preg_match("/(NONE|MAIN)/i",$alt_dial)) and (preg_match("/(ALT_ONLY|ALT_AND_ADDR3|ALT_AND_EXTENDED)/i",$auto_alt_dial)) )
{
$alt_dial_skip=0;
- $stmt="SELECT alt_phone,gmt_offset_now,state,vendor_lead_code,phone_code FROM vicidial_list where lead_id='$lead_id';";
+ $stmt="SELECT alt_phone,gmt_offset_now,state,vendor_lead_code,phone_code,postal_code,state FROM vicidial_list where lead_id='$lead_id';";
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00065',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -7895,6 +7896,8 @@ if ($stage == "end")
$state = $row[2];
$vendor_lead_code = $row[3];
$phone_code = $row[4];
+ $postal_code = $row[5];
+ $state = $row[6];
}
else {$alt_phone = '';}
if (strlen($alt_phone)>5)
@@ -7945,7 +7948,7 @@ if ($stage == "end")
if ($VD_alt_dnc_count < 1)
{
### 24-Hour call count limit check ###
- $passed_24hour_call_count = manual_tfhccl_check($lead_id, $alt_phone, $phone_code, 1);
+ $passed_24hour_call_count = manual_tfhccl_check($lead_id, $alt_phone, $phone_code, 1, $postal_code, $state, 'manDiaLlogCaLL_end_ALT');
if ($passed_24hour_call_count > 0)
{
@@ -8038,7 +8041,7 @@ if ($stage == "end")
if ($VD_alt_dnc_count < 1)
{
### 24-Hour call count limit check ###
- $passed_24hour_call_count = manual_tfhccl_check($lead_id, $address3, $phone_code, 1);
+ $passed_24hour_call_count = manual_tfhccl_check($lead_id, $address3, $phone_code, 1, $postal_code, $state, 'manDiaLlogCaLL_end_ADDR3');
if ($passed_24hour_call_count > 0)
{
@@ -8171,7 +8174,7 @@ if ($stage == "end")
if ($alt_dial_phones_count == $Xlast)
{$Xlast = 'LAST';}
### 24-Hour call count limit check ###
- $passed_24hour_call_count = manual_tfhccl_check($lead_id, $VD_altdial_phone, $VD_altdial_phone_code, 1);
+ $passed_24hour_call_count = manual_tfhccl_check($lead_id, $VD_altdial_phone, $VD_altdial_phone_code, 1, $postal_code, $state, 'manDiaLlogCaLL_end_X');
if ($passed_24hour_call_count > 0)
{
@@ -20394,7 +20397,7 @@ function manual_dccl_check($temp_lead_id, $temp_no_hopper, $temp_dial_only)
##### 24-Hour call count limit check #####
-function manual_tfhccl_check($temp_lead_id, $temp_phone_number, $temp_phone_code, $temp_TFHCCLalt)
+function manual_tfhccl_check($temp_lead_id, $temp_phone_number, $temp_phone_code, $temp_TFHCCLalt, $temp_postcode, $temp_state, $temp_function)
{
global $SScall_limit_24hour, $call_limit_24hour_method, $call_limit_24hour_scope, $call_limit_24hour, $call_limit_24hour_override, $campaign, $user, $link, $NOW_TIME, $mel, $server_ip, $session_name, $one_mysql_log, $SSagent_debug_logging, $startMS, $ACTION, $php_script, $stage, $lead_id, $TFhourSTATE, $TFhourCOUNTRY;
@@ -20437,7 +20440,7 @@ function manual_tfhccl_check($temp_lead_id, $temp_phone_number, $temp_phone_code
{
$stmt="SELECT count(*) FROM vicidial_lead_24hour_calls where lead_id='$temp_lead_id' and (call_date >= NOW() - INTERVAL 1 DAY) $limit_scopeSQL;";
}
- if ($DB) {echo " Doing 24-Hour Call Count Check: $temp_lead_id|$agent_dialed_number - $call_limit_24hour_method |$stmt|\n";}
+ if ($DB) {echo " Doing 24-Hour Call Count Check: $temp_lead_id|$agent_dialed_number - $call_limit_24hour_method |$temp_function|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00862',$user,$server_ip,$session_name,$one_mysql_log);}
$vlcamp_ct = mysqli_num_rows($rslt);
@@ -20448,11 +20451,15 @@ function manual_tfhccl_check($temp_lead_id, $temp_phone_number, $temp_phone_code
$TFhourCOUNT = $row[0];
}
$TEMPcall_limit_24hour = $call_limit_24hour;
+ tfh_log("Starting 24-Hour Call Count Check: $temp_lead_id|$agent_dialed_number($TFhourCOUNTRY,$TFhourSTATE,$TFhourCOUNT) - $call_limit_24hour_method - $call_limit_24hour_scope - $call_limit_24hour |$temp_TFHCCLalt|$temp_postcode|$temp_state|$temp_function|$stmt|");
if ( (!preg_match("/^DISABLED$/",$call_limit_24hour_override)) && (strlen($call_limit_24hour_override) > 0) )
{
$TEMP_TFhour_OR_entry='';
$TFH_OR_method='state_areacode';
+ $TFH_OR_postcode_field_match=0;
+ $TFH_OR_state_field_match=0;
+ $TFH_OR_postcode_state='';
$stmt = "SELECT container_entry FROM vicidial_settings_containers where container_id='$call_limit_24hour_override';";
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00863',$user,$server_ip,$session_name,$one_mysql_log);}
@@ -20478,8 +20485,38 @@ function manual_tfhccl_check($temp_lead_id, $temp_phone_number, $temp_phone_code
# define core settings
if (preg_match("/^method/i",$container_lines[$c]))
{
- $container_lines[$c] = preg_replace("/method=>/i;",'',$container_lines[$c]);
+ #$container_lines[$c] = preg_replace("/method=>/i",'',$container_lines[$c]);
$TFH_OR_method = $container_lines[$c];
+ tfh_log("METHOD defined: $TFH_OR_method");
+ if ( (preg_match("/state$/",$TFH_OR_method)) and ($TFhourSTATE != $temp_state) )
+ {
+ $TFH_OR_state_field_match=1;
+ }
+ if ( (preg_match("/postcode/",$TFH_OR_method)) and (strlen($temp_postcode) > 0) )
+ {
+ if ($TFhourCOUNTRY == 'USA')
+ {
+ $temp_postcode = preg_replace("/\D/",'',$temp_postcode);
+ $temp_postcode = substr($temp_postcode,0,5);
+ }
+ if ($TFhourCOUNTRY == 'CAN')
+ {
+ $temp_postcode = preg_replace("/[^a-zA-Z0-9]/",'',$temp_postcode);
+ $temp_postcode = substr($temp_postcode,0,6);
+ }
+ $stmt = "SELECT state FROM vicidial_postal_codes where postal_code='$temp_postcode';";
+ $rslt=mysql_to_mysqli($stmt, $link);
+ if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00864',$user,$server_ip,$session_name,$one_mysql_log);}
+ if ($DB) {echo "$stmt\n";}
+ $vpc_ct = mysqli_num_rows($rslt);
+ if ($vpc_ct > 0)
+ {
+ $row=mysqli_fetch_row($rslt);
+ $TFH_OR_postcode_state = $row[0];
+ $TFH_OR_postcode_field_match=1;
+ tfh_log("POSTCODE field state lookup: $temp_postcode|$TFH_OR_postcode_state");
+ }
+ }
}
else
{
@@ -20491,16 +20528,38 @@ function manual_tfhccl_check($temp_lead_id, $temp_phone_number, $temp_phone_code
if ($TFhourCOUNTRY == $TEMP_state_ARY[0])
{
$TEMP_state_ARY[2] = preg_replace("/\D/",'',$TEMP_state_ARY[2]);
- if ( ($TFhourSTATE == $TEMP_state_ARY[1]) && (strlen($TEMP_state_ARY[2]) > 0) )
+ if ( ($TFhourSTATE == $TEMP_state_ARY[1]) and (strlen($TEMP_state_ARY[2]) > 0) )
{
if ($DB) {echo " 24-Hour Call Count State Override Triggered: $TEMPcall_limit_24hour|$container_lines[$c]\n";}
+ tfh_log("24-Hour Call Count State Override Triggered: $TEMPcall_limit_24hour|$container_lines[$c]");
$TEMPcall_limit_24hour = $TEMP_state_ARY[2];
}
+ if ( ($TFH_OR_postcode_state == $TEMP_state_ARY[1]) and (strlen($TEMP_state_ARY[2]) > 0) and ($TFH_OR_postcode_field_match > 0) )
+ {
+ if ($DB) {echo " 24-Hour Call Count State Override Triggered(postcode $TFH_OR_postcode_state): $TEMPcall_limit_24hour|$container_lines[$c]\n";}
+ if ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)
+ {
+ if ($DB) {echo " POSTCODE field override of override triggered: ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)\n";}
+ tfh_log("POSTCODE field override of override triggered: ($TEMPcall_limit_24hour < $TEMP_state_ARY[2])|");
+ $TEMPcall_limit_24hour = $TEMP_state_ARY[2];
+ }
+ }
+ if ( ($temp_state == $TEMP_state_ARY[1]) and (strlen($TEMP_state_ARY[2]) > 0) and ($TFH_OR_state_field_match > 0) )
+ {
+ if ($DB) {echo " 24-Hour Call Count State Override Triggered(state $temp_state): $TEMPcall_limit_24hour|$container_lines[$c]\n";}
+ if ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)
+ {
+ if ($DB) {echo " STATE field override of override triggered: ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)\n";}
+ tfh_log("STATE field override of override triggered: ($TEMPcall_limit_24hour < $TEMP_state_ARY[2])|");
+ $TEMPcall_limit_24hour = $TEMP_state_ARY[2];
+ }
+ }
}
}
}
}
if ($DBX) {echo " 24-Hour Call Count State Override DEBUG: |$container_lines[$c]|\n";}
+ tfh_log(" 24-Hour Call Count State Override DEBUG: |$container_lines[$c]");
$c++;
}
}
@@ -20508,14 +20567,23 @@ function manual_tfhccl_check($temp_lead_id, $temp_phone_number, $temp_phone_code
if ( ($TFhourCOUNT > 0) && ($TFhourCOUNT >= $TEMPcall_limit_24hour) )
{
+ tfh_log("24-Hour Call Count Over Limit: $temp_lead_id ($TFhourCOUNT >= $TEMPcall_limit_24hour)");
$passed_24hour_call_count=0;
if ($temp_TFHCCLalt < 1)
{
- $stmt = "UPDATE vicidial_list SET called_since_last_reset='D' where lead_id='$temp_lead_id';";
+ $stmt = "UPDATE vicidial_list SET called_since_last_reset='D',user='$user' where lead_id='$temp_lead_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00847',$user,$server_ip,$session_name,$one_mysql_log);}
$VLAEDaffected_rows = mysqli_affected_rows($link);
+ tfh_log("24-Hour Call Count Over Limit Lead Modify: $VLAEDaffected_rows|$stmt");
+
+ $stmt = "DELETE FROM vicidial_hopper WHERE lead_id='$temp_lead_id' and status='QUEUE' and user='$user';";
+ if ($DB) {echo "$stmt\n";}
+ $rslt=mysql_to_mysqli($stmt, $link);
+ if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00865',$user,$server_ip,$session_name,$one_mysql_log);}
+ $VHaffected_rows = mysqli_affected_rows($link);
+ tfh_log("24-Hour Call Count Over Limit Hopper Delete: $VHaffected_rows|$stmt");
echo "NUMBER OVER 24-HOUR CALL LIMIT, TRY AGAIN\n";
$stage .= "|24HRLIMIT|$agent_dialed_number|$temp_lead_id|$TFhourCOUNT|$TEMPcall_limit_24hour|";
@@ -20530,7 +20598,7 @@ function manual_tfhccl_check($temp_lead_id, $temp_phone_number, $temp_phone_code
return $passed_24hour_call_count;
}
-##### 24-Hour call count limit check #####
+##### Auto-Alt-Dialing debug log function #####
function aad_log($aad_string)
{
global $NOW_TIME;
@@ -20538,4 +20606,14 @@ function aad_log($aad_string)
#fwrite ($aad_fp, "$NOW_TIME|$aad_string|\n");
#fclose($aad_fp);
}
+
+##### 24-Hour call count limit check log function #####
+function tfh_log($tfh_string)
+ {
+ global $NOW_TIME;
+ #$aad_fp = fopen ("./24hour-call-count_log.txt", "a");
+ #fwrite ($aad_fp, "$NOW_TIME|$tfh_string|\n");
+ #fclose($aad_fp);
+ }
+
?>
diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php
index 6f20b664..5b926c35 100644
--- a/agc_2-X/trunk/www/agc/vicidial.php
+++ b/agc_2-X/trunk/www/agc/vicidial.php
@@ -678,10 +678,11 @@
# 210705-1626 - Added user_pass_webform and phone_login_webform options.php settings
# 210706-0114 - Added display of Call Time Holidays to the Scheduled Callbacks calendar
# 210715-1215 - Added 24-Hour Call Count Limit features
+# 210719-0907 - Added new state override options for 24-Hour Call Count Limits
#
-$version = '2.14-646c';
-$build = '210715-1215';
+$version = '2.14-647c';
+$build = '210719-0907';
$php_script = 'vicidial.php';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=98;
@@ -10633,133 +10634,133 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
// document.getElementById("debugbottomspan").innerHTML = manDiaLnext_query + "\n\n" + xmlhttp.responseText;
MDnextResponse = xmlhttp.responseText;
- if (active_ingroup_dial.length > 0)
- {
- AutoDial_ReSume_PauSe("VDADready",'','','NO_STATUS_CHANGE');
- AutoDialWaiting=1;
- }
- else
- {
- var MDnextResponse_array=MDnextResponse.split("\n");
- MDnextCID = MDnextResponse_array[0];
- LastCallCID = MDnextResponse_array[0];
+ var MDnextResponse_array=MDnextResponse.split("\n");
+ MDnextCID = MDnextResponse_array[0];
+ LastCallCID = MDnextResponse_array[0];
- var regMNCvar = new RegExp("HOPPER EMPTY","ig");
- var regMDFvarDNC = new RegExp("DNC","ig");
- var regMDFvarDCCL = new RegExp("DAILY CALL LIMIT","ig");
- var regMNHDNCvar = new RegExp("NO-HOPPER DNC","ig");
- var regMNHDCCLvar = new RegExp("NO-HOPPER DAILY CALL LIMIT","ig");
- var regMDFvarCAMP = new RegExp("CAMPLISTS","ig");
- var regMDFvarSYS = new RegExp("SYSTEM","ig");
- var regMDFvarCB = new RegExp("CALLBACK","ig");
- var regMDFvarTIME = new RegExp("OUTSIDE","ig");
- var regMDFvarTFH = new RegExp("24-HOUR CALL LIMIT","ig");
- if ( (MDnextCID.match(regMNCvar)) || (MDnextCID.match(regMDFvarDNC)) || (MDnextCID.match(regMDFvarDCCL)) || (MDnextCID.match(regMDFvarCAMP)) || (MDnextCID.match(regMDFvarSYS)) ||(MDnextCID.match(regMDFvarCB)) || (MDnextCID.match(regMDFvarTIME)) || (MDnextCID.match(regMDFvarTFH)) )
+ var regMNCvar = new RegExp("HOPPER EMPTY","ig");
+ var regMDFvarDNC = new RegExp("DNC","ig");
+ var regMDFvarDCCL = new RegExp("DAILY CALL LIMIT","ig");
+ var regMNHDNCvar = new RegExp("NO-HOPPER DNC","ig");
+ var regMNHDCCLvar = new RegExp("NO-HOPPER DAILY CALL LIMIT","ig");
+ var regMDFvarCAMP = new RegExp("CAMPLISTS","ig");
+ var regMDFvarSYS = new RegExp("SYSTEM","ig");
+ var regMDFvarCB = new RegExp("CALLBACK","ig");
+ var regMDFvarTIME = new RegExp("OUTSIDE","ig");
+ var regMDFvarTFH = new RegExp("24-HOUR CALL LIMIT","ig");
+ if ( (MDnextCID.match(regMNCvar)) || (MDnextCID.match(regMDFvarDNC)) || (MDnextCID.match(regMDFvarDCCL)) || (MDnextCID.match(regMDFvarCAMP)) || (MDnextCID.match(regMDFvarSYS)) ||(MDnextCID.match(regMDFvarCB)) || (MDnextCID.match(regMDFvarTIME)) || (MDnextCID.match(regMDFvarTFH)) )
+ {
+ button_click_log = button_click_log + "" + SQLdate + "-----DialNextFailed---" + MDnextCID + " " + "|";
+
+ dial_next_failed=1;
+ var alert_displayed=0;
+ trigger_ready=1;
+ alt_phone_dialing=starting_alt_phone_dialing;
+ auto_dial_level=starting_dial_level;
+ MainPanelToFront();
+ CalLBacKsCounTCheck();
+ InternalChatsCheck();
+
+ if (MDnextCID.match(regMNCvar))
{
- button_click_log = button_click_log + "" + SQLdate + "-----DialNextFailed---" + MDnextCID + " " + "|";
+ alert_box("\n" + campaign);
+ alert_displayed=1;
+ in_lead_preview_state=0; // JCJ - This needs to be reset here otherwise the variable stays at 1 and thus manual dials can't be made even if the agent is paused.
+ }
+ if (MDnextCID.match(regMDFvarDNC))
+ {
+ alert_box("\n" + mdnPhonENumbeR);
+ alert_displayed=1;
+ in_lead_preview_state=0;
+ }
+ if (MDnextCID.match(regMDFvarDCCL))
+ {
+ alert_box("\n" + mdnPhonENumbeR);
+ alert_displayed=1;
+ in_lead_preview_state=0;
+ }
+ if (MDnextCID.match(regMDFvarCAMP))
+ {
+ alert_box("\n" + mdnPhonENumbeR);
+ alert_displayed=1;
+ in_lead_preview_state=0;
+ }
+ if (MDnextCID.match(regMDFvarSYS))
+ {
+ alert_box("\n" + mdnPhonENumbeR);
+ alert_displayed=1;
+ in_lead_preview_state=0;
+ }
+ if (MDnextCID.match(regMDFvarCB))
+ {
+ alert_box("\n" + mdnPhonENumbeR);
+ alert_displayed=1;
+ in_lead_preview_state=0;
+ }
+ if (MDnextCID.match(regMDFvarTIME))
+ {
+ alert_box("\n" + mdnPhonENumbeR);
+ alert_displayed=1;
+ in_lead_preview_state=0;
+ }
+ if (MDnextCID.match(regMDFvarTFH))
+ {
+ alert_box("\n" + mdnPhonENumbeR);
+ alert_displayed=1;
+ in_lead_preview_state=0;
+ }
- dial_next_failed=1;
- var alert_displayed=0;
- trigger_ready=1;
- alt_phone_dialing=starting_alt_phone_dialing;
- auto_dial_level=starting_dial_level;
- MainPanelToFront();
- CalLBacKsCounTCheck();
- InternalChatsCheck();
+ if (MDnextCID.match(regMNHDNCvar))
+ {
+ alert_box("\n" + mdnPhonENumbeR);
+ alert_displayed=1;
+ in_lead_preview_state=0;
+ }
+ if (MDnextCID.match(regMNHDCCLvar))
+ {
+ alert_box("\n" + mdnPhonENumbeR);
+ alert_displayed=1;
+ in_lead_preview_state=0;
+ }
- if (MDnextCID.match(regMNCvar))
- {
- alert_box("\n" + campaign);
- alert_displayed=1;
- in_lead_preview_state=0; // JCJ - This needs to be reset here otherwise the variable stays at 1 and thus manual dials can't be made even if the agent is paused.
- }
- if (MDnextCID.match(regMDFvarDNC))
- {
- alert_box("\n" + mdnPhonENumbeR);
- alert_displayed=1;
- in_lead_preview_state=0;
- }
- if (MDnextCID.match(regMDFvarDCCL))
- {
- alert_box("\n" + mdnPhonENumbeR);
- alert_displayed=1;
- in_lead_preview_state=0;
- }
- if (MDnextCID.match(regMDFvarCAMP))
- {
- alert_box("\n" + mdnPhonENumbeR);
- alert_displayed=1;
- in_lead_preview_state=0;
- }
- if (MDnextCID.match(regMDFvarSYS))
- {
- alert_box("\n" + mdnPhonENumbeR);
- alert_displayed=1;
- in_lead_preview_state=0;
- }
- if (MDnextCID.match(regMDFvarCB))
- {
- alert_box("\n" + mdnPhonENumbeR);
- alert_displayed=1;
- in_lead_preview_state=0;
- }
- if (MDnextCID.match(regMDFvarTIME))
- {
- alert_box("\n" + mdnPhonENumbeR);
- alert_displayed=1;
- in_lead_preview_state=0;
- }
- if (MDnextCID.match(regMDFvarTFH))
- {
- alert_box("\n" + mdnPhonENumbeR);
- alert_displayed=1;
- in_lead_preview_state=0;
- }
+ if (alert_displayed==0)
+ {alert_box("\n" + mdnPhonENumbeR + "|" + MDnextCID); alert_displayed=1;}
- if (MDnextCID.match(regMNHDNCvar))
+ if (starting_dial_level == 0)
+ {
+ document.getElementById("DiaLControl").innerHTML = "
\" border=\"0\" alt=\"Dial Next Number\" />";
+ }
+ else
+ {
+ if (dial_method == "INBOUND_MAN")
{
- alert_box("\n" + mdnPhonENumbeR);
- alert_displayed=1;
- in_lead_preview_state=0;
- }
- if (MDnextCID.match(regMNHDCCLvar))
- {
- alert_box("\n" + mdnPhonENumbeR);
- alert_displayed=1;
- in_lead_preview_state=0;
- }
+ auto_dial_level=starting_dial_level;
- if (alert_displayed==0)
- {alert_box("\n" + mdnPhonENumbeR + "|" + MDnextCID); alert_displayed=1;}
-
- if (starting_dial_level == 0)
- {
- document.getElementById("DiaLControl").innerHTML = "
\" border=\"0\" alt=\"Dial Next Number\" />";
- }
- else
- {
- if (dial_method == "INBOUND_MAN")
+ if ( (in_man_dial_next_ready_seconds > 0) && (in_man_dial_next_ready_count < in_man_dial_next_ready_seconds) )
{
- auto_dial_level=starting_dial_level;
-
- if ( (in_man_dial_next_ready_seconds > 0) && (in_man_dial_next_ready_count < in_man_dial_next_ready_seconds) )
- {
- in_man_dial_next_ready_trigger = 0;
- in_man_dial_next_ready_count = 0;
- document.getElementById("DiaLControl").innerHTML = "
\" border=\"0\" alt=\"You are paused\" />
\" border=\"0\" alt=\"Dial Next Number\" />";
- }
- else
- {
- document.getElementById("DiaLControl").innerHTML = "
\" border=\"0\" alt=\"You are paused\" />
\" border=\"0\" alt=\"Dial Next Number\" />";
- }
+ in_man_dial_next_ready_trigger = 0;
+ in_man_dial_next_ready_count = 0;
+ document.getElementById("DiaLControl").innerHTML = "
\" border=\"0\" alt=\"You are paused\" />
\" border=\"0\" alt=\"Dial Next Number\" />";
}
else
{
- document.getElementById("DiaLControl").innerHTML = DiaLControl_auto_HTML;
+ document.getElementById("DiaLControl").innerHTML = "
\" border=\"0\" alt=\"You are paused\" />
\" border=\"0\" alt=\"Dial Next Number\" />";
}
- document.getElementById("MainStatuSSpan").style.background = panel_bgcolor;
- reselect_alt_dial = 0;
}
+ else
+ {
+ document.getElementById("DiaLControl").innerHTML = DiaLControl_auto_HTML;
+ }
+ document.getElementById("MainStatuSSpan").style.background = panel_bgcolor;
+ reselect_alt_dial = 0;
+ }
+ }
+ else
+ {
+ if (active_ingroup_dial.length > 0)
+ {
+ AutoDial_ReSume_PauSe("VDADready",'','','NO_STATUS_CHANGE');
+ AutoDialWaiting=1;
}
else
{
@@ -11649,7 +11650,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
if ( (script_recording_delay < 1) && (routing_initiated_recording == 'Y') && ( (LIVE_campaign_recording == 'ALLCALLS') || (LIVE_campaign_recording == 'ALLFORCE') ) )
{temp_rir='Y';}
- manDiaLonly_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLonly&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&lead_id=" + document.vicidial_form.lead_id.value + "&phone_number=" + manDiaLonly_num + "&phone_code=" + document.vicidial_form.phone_code.value + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + manual_dial_timeout + "&dial_prefix=" + call_prefix + "&campaign_cid=" + call_cid + "&omit_phone_code=" + omit_phone_code + "&usegroupalias=" + usegroupalias + "&account=" + active_group_alias + "&agent_dialed_number=" + dialed_number + "&agent_dialed_type=" + dialed_label + "&dial_method=" + dial_method + "&agent_log_id=" + agent_log_id + "&security=" + document.vicidial_form.security_phrase.value + "&qm_extension=" + qm_extension + "&old_CID=" + LastCallCID + "&cid_lock=" + cid_lock + "&routing_initiated_recording=" + temp_rir + "&exten=" + recording_exten + "&recording_filename=" + LIVE_campaign_rec_filename + "&channel=" + channelrec + "&vendor_lead_code=" + document.vicidial_form.search_vendor_lead_code.value + "&phone_login=" + phone_login + "&state=" + encodeURIComponent(document.vicidial_form.state.value);
+ manDiaLonly_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLonly&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&lead_id=" + document.vicidial_form.lead_id.value + "&phone_number=" + manDiaLonly_num + "&phone_code=" + document.vicidial_form.phone_code.value + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + manual_dial_timeout + "&dial_prefix=" + call_prefix + "&campaign_cid=" + call_cid + "&omit_phone_code=" + omit_phone_code + "&usegroupalias=" + usegroupalias + "&account=" + active_group_alias + "&agent_dialed_number=" + dialed_number + "&agent_dialed_type=" + dialed_label + "&dial_method=" + dial_method + "&agent_log_id=" + agent_log_id + "&security=" + document.vicidial_form.security_phrase.value + "&qm_extension=" + qm_extension + "&old_CID=" + LastCallCID + "&cid_lock=" + cid_lock + "&routing_initiated_recording=" + temp_rir + "&exten=" + recording_exten + "&recording_filename=" + LIVE_campaign_rec_filename + "&channel=" + channelrec + "&vendor_lead_code=" + document.vicidial_form.search_vendor_lead_code.value + "&phone_login=" + phone_login + "&state=" + encodeURIComponent(document.vicidial_form.state.value) + "&postal_code=" + encodeURIComponent(document.vicidial_form.search_postal_code.value);
xmlhttp.open('POST', 'vdc_db_query.php');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send(manDiaLonly_query);
diff --git a/agc_2-X/trunk/www/vicidial/help_documentation.txt b/agc_2-X/trunk/www/vicidial/help_documentation.txt
index 4abb88a9..7d826d95 100644
--- a/agc_2-X/trunk/www/vicidial/help_documentation.txt
+++ b/agc_2-X/trunk/www/vicidial/help_documentation.txt
@@ -1,4 +1,4 @@
-# version: 20210712215601
+# version: 20210719084501
users-user User ID This field is where you put the users ID number, can be up to 8 digits in length, Must be at least 2 characters in length.
users-pass Password This field is where you put the users password. Must be at least 2 characters in length. Only letters and numbers are allowed in user passwords. A medium strength user password will be at least 10 characters in length, and a strong user password will be at least 20 characters in length and have letters as well as at least one number. It is recommended that you use a longer password if possible, stringing together several unrelated words with no spaces, and a number somewhere in the string. The maximum size of a password is 100 characters.
users-force_change_password Force Change Password If this option is set to Y then the user will be prompted to change their password the next time they log in to the administration webpage or the agent screen. Default is N.
@@ -150,7 +150,7 @@ settings-daily_limit_manual Daily Call Limit Manual If the Daily Call Count
campaigns-call_limit_24hour_method 24-Hour Called Count Limit Method This feature will limit the number of calls that can be placed to a lead or phone number over a consecutive 24 hour time period. This setting will determine if the called count limit is based upon a lead or a phone number. Default is DISABLED.
campaigns-call_limit_24hour 24-Hour Called Count Limit If the 24-Hour Called Count Limit Method setting is not disabled, this setting determines the number of calls that can be placed within 24 hours. For example, if this option is set to -1- and a call is placed to a lead at 11:01, then the next time that lead could be called is after 11:01 the next day. There is no manual dial override for this feature, it will affect all normal customer calls placed within this campaign. If you use this feature with Lead Recycling enabled and the 24-Hour call limit is reached for a recycled lead, the recycling count for that lead will reset to 0 after the 24-Hour call count limit time expires. Default is 0.
campaigns-call_limit_24hour_scope 24-Hour Called Count Limit Scope If the 24-Hour Called Count Limit feature is enabled, this setting will determine if the called count limit is counted using system-wide call counts or only the called counts within the lists for this campaign. Default is SYSTEM_WIDE.
-campaigns-call_limit_24hour_override 24-Hour Called Count Limit Override If the 24-Hour Called Count Limit feature is enabled, you can create a Settings Container of the CALL_LIMITS_OVERRIDE container type that will allow you to override the 24-Hour Called Count Limit for calls to specific states, based upon the area-code of the phone number being dialed. The area-code to state relationship is defined in the internal database which you can access by going to Admin, System Settings, Phone Codes. Default is DISABLED.
Example CALL_LIMITS_OVERRIDE Container Entry:
; The only allowed method currently is state_areacode
method => state_areacode
; One line per state, with fields separated by commas: the country abbreviation, state abbreviation and the 24-hour call limit for that state
state => USA,FL,3
state => USA,GA,4
+campaigns-call_limit_24hour_override 24-Hour Called Count Limit Override If the 24-Hour Called Count Limit feature is enabled, you can create a Settings Container of the CALL_LIMITS_OVERRIDE container type that will allow you to override the 24-Hour Called Count Limit for calls to specific states, based upon the area-code of the phone number being dialed. The area-code to state relationship is defined in the internal database which you can access by going to Admin, System Settings, Phone Codes. Default is DISABLED.
Example CALL_LIMITS_OVERRIDE Container Entry:
; The allowed methods are: state_areacode, state_areacode_postcode, state_areacode_postcode_state, state_areacode_state
method => state_areacode
; One line per state, with fields separated by commas: the country abbreviation, state abbreviation and the 24-hour call limit for that state
state => USA,FL,3
state => USA,GA,4
For more detailed information on how this works, read the CALL_COUNT_LIMITS.txt document.
campaigns-hopper_drop_run_trigger Hopper Drop-Run Trigger This setting, if activated, will ignore all hopper loading criteria for a single hopper run for this campaign and it will only load the DROP status leads from the active lists for the campaign into the hopper at the highest hopper priority, and once this single hopper run has happened, this setting will reset to N for this campaign and the hopper loading will go back to normal for the next minute when it runs. This process will also update any DROPs already in the hopper to the highest hopper priority if they are not already there. If the -All Drops- checkbox is checked, then any status with -DROP- in the status or status name will be selected, including all system statuses and campaign statuses whether they are for outbound or inbound calls. WARNING, when this runs it will not check to see if the lists have been reset, so you may be calling back DROP leads that were recently called. However, if the Drop Lockout Time has been enabled, that setting will be honored. Default is N, unselected, for inactive.
campaigns-drop_lockout_time Drop Lockout Time This is a number of hours that DROP abandon calls will be prevented from being dialed, to disable set to 0. This setting is very useful in countries like the UK where there are regulations preventing the attempted calling of customers within 72 hours of an Abandon, or DROP. Default is 0.
campaigns-force_reset_hopper Force Reset of Hopper This allows you to wipe out the hopper contents upon form submission. It should be filled again when the VDhopper script runs.