diff --git a/UPGRADE b/UPGRADE index a806ff3d..5aedeb02 100644 --- a/UPGRADE +++ b/UPGRADE @@ -163,6 +163,8 @@ OTHER CHANGES: 38. Added AST_DB_DNC_filter.pl script to allow filtering of existing DNC entries +39. Changed AC-CID to be able to use areacodes from 2 to 5 digits in length + diff --git a/bin/AST_VDauto_dial.pl b/bin/AST_VDauto_dial.pl index 578d6322..d39ba272 100644 --- a/bin/AST_VDauto_dial.pl +++ b/bin/AST_VDauto_dial.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# AST_VDauto_dial.pl version 2.10 +# AST_VDauto_dial.pl version 2.12 # # DESCRIPTION: # Places auto_dial calls on the VICIDIAL dialer system @@ -25,7 +25,7 @@ # It is good practice to keep this program running by placing the associated # KEEPALIVE script running every minute to ensure this program is always running # -# Copyright (C) 2014 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2015 Matt Florell LICENSE: AGPLv2 # # CHANGELOG: # 50125-1201 - Changed dial timeout to 120 seconds from 180 seconds @@ -119,9 +119,9 @@ # 140426-1941 - Added pause_type to vicidial_agent_log # 141113-1556 - Added concurrency check # 141211-2134 - Added na_call_url list_id override option +# 151006-0936 - Changed campaign_cid_areacodes to operate with 2-5 digit areacodes # - ### begin parsing run-time options ### if (length($ARGV[0])>1) { @@ -1208,17 +1208,26 @@ while($one_day_interval > 0) { $temp_CID=''; $temp_vcca=''; - $temp_ac = substr("$phone_number", 0, 3); - $stmtA = "SELECT outbound_cid FROM vicidial_campaign_cid_areacodes where campaign_id='$DBIPcampaign[$user_CIPct]' and areacode='$temp_ac' and active='Y' order by call_count_today limit 1;"; + $temp_ac=''; + $temp_ac_two = substr("$phone_number", 0, 2); + $temp_ac_three = substr("$phone_number", 0, 3); + $temp_ac_four = substr("$phone_number", 0, 4); + $temp_ac_five = substr("$phone_number", 0, 5); + $stmtA = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='$DBIPcampaign[$user_CIPct]' and areacode IN('$temp_ac_two','$temp_ac_three','$temp_ac_four','$temp_ac_five') and active='Y' order by CAST(areacode as SIGNED INTEGER) asc, call_count_today desc limit 100000;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; - if ($sthArows > 0) + $act=0; + while ($sthArows > $act) { @aryA = $sthA->fetchrow_array; - $temp_vcca = $aryA[0]; + $temp_vcca = $aryA[0]; + $temp_ac = $aryA[1]; + $act++; + } + if ($act > 0) + { $sthA->finish(); - $stmtA="UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='$DBIPcampaign[$user_CIPct]' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; $affected_rows = $dbhA->do($stmtA); } diff --git a/bin/AST_VDauto_dial_FILL.pl b/bin/AST_VDauto_dial_FILL.pl index b257e572..71b70464 100644 --- a/bin/AST_VDauto_dial_FILL.pl +++ b/bin/AST_VDauto_dial_FILL.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# AST_VDauto_dial_FILL.pl version 2.8 +# AST_VDauto_dial_FILL.pl version 2.12 # # DESCRIPTION: # Places auto_dial calls on the VICIDIAL dialer system across all servers only @@ -12,7 +12,7 @@ # # Should only be run on one server in a multi-server Asterisk/VICIDIAL cluster # -# Copyright (C) 2013 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2015 Matt Florell LICENSE: AGPLv2 # # CHANGELOG: # 61115-1246 - First build, framework setup, non-functional @@ -37,6 +37,7 @@ # 130706-2024 - Added disable_auto_dial system option # 131016-0658 - Fix for disable_auto_dial system option # 131122-1237 - Formatting fixes and missing sthA->finish +# 151006-0937 - Changed campaign_cid_areacodes to operate with 2-5 digit areacodes # ### begin parsing run-time options ### @@ -773,17 +774,26 @@ while($one_day_interval > 0) { $temp_CID=''; $temp_vcca=''; - $temp_ac = substr("$phone_number", 0, 3); - $stmtA = "SELECT outbound_cid FROM vicidial_campaign_cid_areacodes where campaign_id='$DBfill_campaign[$camp_CIPct]' and areacode='$temp_ac' and active='Y' order by call_count_today limit 1;"; + $temp_ac=''; + $temp_ac_two = substr("$phone_number", 0, 2); + $temp_ac_three = substr("$phone_number", 0, 3); + $temp_ac_four = substr("$phone_number", 0, 4); + $temp_ac_five = substr("$phone_number", 0, 5); + $stmtA = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='$DBfill_campaign[$camp_CIPct]' and areacode IN('$temp_ac_two','$temp_ac_three','$temp_ac_four','$temp_ac_five') and active='Y' order by CAST(areacode as SIGNED INTEGER) asc, call_count_today desc limit 100000;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; - if ($sthArows > 0) + $act=0; + while ($sthArows > $act) { @aryA = $sthA->fetchrow_array; - $temp_vcca = $aryA[0]; + $temp_vcca = $aryA[0]; + $temp_ac = $aryA[1]; + $act++; + } + if ($act > 0) + { $sthA->finish(); - $stmtA="UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='$DBfill_campaign[$camp_CIPct]' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; $affected_rows = $dbhA->do($stmtA); } diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index 276e40d5..94b1c880 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -390,10 +390,11 @@ # 150814-1057 - Added compatibility for custom fields data option # 150923-2013 - Added DID custom variables to call data transmission # 150928-1818 - Added dnc logging +# 151006-0939 - Changed campaign_cid_areacodes to operate with 2-5 digit areacodes # -$version = '2.12-285'; -$build = '150928-1818'; +$version = '2.12-286'; +$build = '151006-0939'; $php_script = 'vdc_db_query.php'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=635; @@ -3694,22 +3695,33 @@ if ($ACTION == 'manDiaLnextCaLL') $use_custom_cid = $row[0]; if ( ($use_custom_cid == 'AREACODE') and ($cid_lock < 1) ) { - $temp_ac = substr("$agent_dialed_number", 0, 3); - $stmt = "SELECT outbound_cid FROM vicidial_campaign_cid_areacodes where campaign_id='$campaign' and areacode='$temp_ac' and active='Y' order by call_count_today limit 1;"; + $temp_vcca=''; + $temp_ac=''; + $temp_ac_two = substr("$agent_dialed_number", 0, 2); + $temp_ac_three = substr("$agent_dialed_number", 0, 3); + $temp_ac_four = substr("$agent_dialed_number", 0, 4); + $temp_ac_five = substr("$agent_dialed_number", 0, 5); + $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='$campaign' and areacode IN('$temp_ac_two','$temp_ac_three','$temp_ac_four','$temp_ac_five') and active='Y' order by CAST(areacode as SIGNED INTEGER) asc, call_count_today desc limit 100000;"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00426',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $vcca_ct = mysqli_num_rows($rslt); - if ($vcca_ct > 0) + $act=0; + while ($vcca_ct > $act) { $row=mysqli_fetch_row($rslt); $temp_vcca = $row[0]; - + $temp_ac = $row[1]; + $act++; + } + if ($act > 0) + { $stmt="UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='$campaign' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00427',$user,$server_ip,$session_name,$one_mysql_log);} } + $temp_CID = preg_replace("/\D/",'',$temp_vcca); } if ($use_custom_cid == 'Y') @@ -4584,22 +4596,33 @@ if ($ACTION == 'manDiaLonly') $use_custom_cid = $row[0]; if ( ($use_custom_cid == 'AREACODE') and ($cid_lock < 1) ) { - $temp_ac = substr("$phone_number", 0, 3); - $stmt = "SELECT outbound_cid FROM vicidial_campaign_cid_areacodes where campaign_id='$campaign' and areacode='$temp_ac' and active='Y' order by call_count_today limit 1;"; + $temp_vcca=''; + $temp_ac=''; + $temp_ac_two = substr("$phone_number", 0, 2); + $temp_ac_three = substr("$phone_number", 0, 3); + $temp_ac_four = substr("$phone_number", 0, 4); + $temp_ac_five = substr("$phone_number", 0, 5); + $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='$campaign' and areacode IN('$temp_ac_two','$temp_ac_three','$temp_ac_four','$temp_ac_five') and active='Y' order by CAST(areacode as SIGNED INTEGER) asc, call_count_today desc limit 100000;"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00429',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $vcca_ct = mysqli_num_rows($rslt); - if ($vcca_ct > 0) + $act=0; + while ($vcca_ct > $act) { $row=mysqli_fetch_row($rslt); $temp_vcca = $row[0]; - + $temp_ac = $row[1]; + $act++; + } + if ($act > 0) + { $stmt="UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='$campaign' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00430',$user,$server_ip,$session_name,$one_mysql_log);} } + $temp_CID = preg_replace("/\D/",'',$temp_vcca); } if ($use_custom_cid == 'Y') diff --git a/www/vicidial/help.php b/www/vicidial/help.php index 19681653..3ae4e98e 100644 --- a/www/vicidial/help.php +++ b/www/vicidial/help.php @@ -62,6 +62,8 @@ # 150903-1458 - Added compatibility for custom fields data options # 150925-2235 - Added user_hide_realtime and user lead filter options # 150926-1058 - Added did_carrier_description +# 151006-0935 - Updated campaign_cid_areacodes entry +# require("dbconnect_mysqli.php"); require("functions.php"); @@ -3238,7 +3240,7 @@ if ($SSoutbound_autodial_active > 0) CAMPAIGN CID AREACODES


- +