From bc7088728e4f41ddee0bb8402166bd1e8db8db22 Mon Sep 17 00:00:00 2001 From: mattf Date: Tue, 30 Apr 2024 12:48:41 +0000 Subject: [PATCH] Added option to not update vicidial_list in cm_dnc.agi git-svn-id: svn://192.168.202.10@3834 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/agi/cm_dnc.agi | 40 +++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/agc_2-X/trunk/agi/cm_dnc.agi b/agc_2-X/trunk/agi/cm_dnc.agi index c791815c..2b554a34 100644 --- a/agc_2-X/trunk/agi/cm_dnc.agi +++ b/agc_2-X/trunk/agi/cm_dnc.agi @@ -12,12 +12,12 @@ # 2- default to insert into the vicidial_dnc table for DNC selections (Default=YES) # 3- campaign to take dnc settings from(overrides option 2) # 4- call menu option to send the call to after executing (Default=B) -# 5- if option 3 is used, search for lead in campaign lists or whole system(CAMP or SYS) (Default=SYS) +# 5- if option 3 is used, search for lead in campaign lists, whole system or no lead update(CAMP, SYS, NONE) (Default=SYS) # # example of what to put in the AGI entry for a Call Menu AGI route: # cm_dnc.agi,DNC---YES---TESTCAMP---B---CAMP # -# Copyright (C) 2020 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # changes: # 121109-1623 - First draft @@ -26,6 +26,7 @@ # 150928-1822 - Added dnc logging # 170313-1610 - Fixed issue with DNC not logging if no campaign defined # 171010-1228 - Added ability to recognize existing Vicidial calls +# 240430-0821 - Added option to not update vicidial_list # $script = 'cm_dnc.agi'; @@ -237,6 +238,10 @@ foreach $i (sort keys %AGI) if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|"; &agi_output;} +if ($camp_sys =~ /NONE/) + { + if ($AGILOG) {$agi_string = "No Lead Updates, only DNC inserts |$unique_id|$channel|$extension|$type|$callerid|"; &agi_output;} + } # if campaign is used and selected for search, find the lists in the campaign $listSQL=''; @@ -266,7 +271,7 @@ if ( (length($campaign_id) > 0) && ($camp_sys =~ /CAMP/) ) ### Gather the lead IDs of the leads with this phone number ### -if ( (length($call_type) < 1) || ($lead_id < 1) ) +if ( ( (length($call_type) < 1) || ($lead_id < 1) ) && ($camp_sys !~ /NONE/) ) { $stmtA= "SELECT lead_id from vicidial_list where phone_number='$phone_number' $listSQL;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; @@ -284,19 +289,22 @@ if ( (length($call_type) < 1) || ($lead_id < 1) ) } else { - $stmtA= "SELECT phone_number from vicidial_list where lead_id='$lead_id';"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - if ($AGILOG) {$agi_string = "$sthArows|$stmtA|"; &agi_output;} - $g=0; - while ($sthArows > $g) + if ($lead_id > 0) { - @aryA = $sthA->fetchrow_array; - $phone_number = $aryA[0]; - $g++; + $stmtA= "SELECT phone_number from vicidial_list where lead_id='$lead_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($AGILOG) {$agi_string = "$sthArows|$stmtA|"; &agi_output;} + $g=0; + while ($sthArows > $g) + { + @aryA = $sthA->fetchrow_array; + $phone_number = $aryA[0]; + $g++; + } + $sthA->finish(); } - $sthA->finish(); } chop($SleadsSQL); @@ -304,7 +312,7 @@ chop($SleadsSQL); ### process for NI path if ($new_status =~ /NI/) # set the phone_number to NI { - if ($g > 0) + if ( ($g > 0) && ($camp_sys !~ /NONE/) ) { ### update all records for the phone_number in vicidial_list to NI (Not Interested) $stmtA = "UPDATE vicidial_list SET status='NI' where lead_id IN($SleadsSQL);"; @@ -316,7 +324,7 @@ if ($new_status =~ /NI/) # set the phone_number to NI ### process for DNC path if ($new_status =~ /DNC/) # set the phone_number to DNC { - if ($g > 0) + if ( ($g > 0) && ($camp_sys !~ /NONE/) ) { ### update all records for the phone_number in vicidial_list to NI (Not Interested) $stmtA = "UPDATE vicidial_list SET status='DNC' where lead_id IN($SleadsSQL);";