Changed campaign_cid_areacodes to operate with 2-5 digit areacodes

git-svn-id: svn://192.168.202.10@2393 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2015-10-06 14:17:42 +00:00
parent 850ad6d136
commit d107887816
5 changed files with 72 additions and 26 deletions
+2
View File
@@ -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
+17 -8
View File
@@ -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 <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2015 Matt Florell <vicidial@gmail.com> 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);
}
+17 -7
View File
@@ -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 <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2015 Matt Florell <vicidial@gmail.com> 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);
}
+33 -10
View File
@@ -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<!-- $stmt -->";}
$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<!-- $stmt -->";}
$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')
+3 -1
View File
@@ -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)
<B><FONT SIZE=3>CAMPAIGN CID AREACODES</FONT></B><BR><BR>
<A NAME="campaign_cid_areacodes">
<BR>
<B><?php echo _QXZ("If the System Setting for Areacode CIDs is enabled and the Campaign setting for Use Custom CallerID is set to AREACODE then you have the ability to define Areacode CIDs that will be used when outbound calling to leads in this specific campaign. You can add multiple callerIDs per areacode and you can activate and deactivate them each in real time. If more than one callerID is active for a specific areacode then the system will use the callerid that has been used the least number of times today. If no callerIDs are active for the areacode then the campaign CallerID or list override CallerID will be used."); ?></B>
<B><?php echo _QXZ("If the System Setting for Areacode CIDs is enabled and the Campaign setting for Use Custom CallerID is set to AREACODE then you have the ability to define Areacode CIDs that will be used when outbound calling to leads in this specific campaign. You can add multiple callerIDs per areacode and you can activate and deactivate them each in real time. If more than one callerID is active for a specific areacode then the system will use the callerid that has been used the least number of times today. If no callerIDs are active for the areacode then the campaign CallerID or list override CallerID will be used. An areacode in this section can be from 2 to 5 digits in length, and if a shorter defined areacode overlaps with a longer areacode then the longer areacode will be used. For example, if the areacodes 31 and 312 are both defined and active for a campaign, then areacode 312 would be used for phone number 3125551212."); ?></B>