diff --git a/bin/AST_VDhopper_MIXtest.pl b/bin/AST_VDhopper_MIXtest.pl index c6059bdf..91f7046c 100644 --- a/bin/AST_VDhopper_MIXtest.pl +++ b/bin/AST_VDhopper_MIXtest.pl @@ -923,25 +923,66 @@ foreach(@campaign_id) { if ($DB) {print " hopper too low ($hopper_ready_count|$hopper_level[$i]) starting hopper dump\n";} - ### Get list of the lists in the campaign ### - $stmtA = "SELECT list_id FROM vicidial_lists where campaign_id='$campaign_id[$i]' and active='Y';"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - $rec_countLISTS=0; - $camp_lists[$i] = ''; - while ($sthArows > $rec_countLISTS) + if ($list_order_mix[$i] =~ /DISABLED/) { - @aryA = $sthA->fetchrow_array; - $camp_lists[$i] .= "'$aryA[0]',"; - $rec_countLISTS++; - } - $sthA->finish(); - if (length($camp_lists[$i])<3) {$camp_lists[$i]="''";} - else {chop($camp_lists[$i]);} + ### Get list of the lists in the campaign ### + $stmtA = "SELECT list_id FROM vicidial_lists where campaign_id='$campaign_id[$i]' and active='Y';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_countLISTS=0; + $camp_lists[$i] = ''; + while ($sthArows > $rec_countLISTS) + { + @aryA = $sthA->fetchrow_array; + $camp_lists[$i] .= "'$aryA[0]',"; + $rec_countLISTS++; + } + $sthA->finish(); + if (length($camp_lists[$i])<3) {$camp_lists[$i]="''";} + else {chop($camp_lists[$i]);} - if ($DB) {print " campaign lists count: $rec_countLISTS | $camp_lists[$i]\n";} - if ($DBX) {print " |$stmtA|\n";} + if ($DB) {print " campaign lists count: $rec_countLISTS | $camp_lists[$i]\n";} + if ($DBX) {print " |$stmtA|\n";} + } + else + { + $hopper_level[$rec_count] + $stmtA = "SELECT vcl_id,vcl_name,list_mix_container,mix_method FROM vicidial_campaigns_list_mix where campaign_id='$campaign_id[$i]' and status='ACTIVE';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $vcl_id[$i] = "$aryA[0]"; + $vcl_name[$i] = "$aryA[1]"; + $list_mix_container[$i] = "$aryA[2]"; + $mix_method[$i] = "$aryA[3]"; + $rec_count++; + } + $sthA->finish(); + + @list_mixARY=@MT; + $list_mix_dialableSQL=''; + @list_mixARY = split(/:/,$list_mix_container[$i]); + $x=0; + foreach(@list_mixARY) + { + if ($x > 0) {$list_mix_dialableSQL .= " or ";} + @list_mix_stepARY=@MT; + @list_mix_stepARY = split(/|/,$list_mixARY[$x]); + $list_mix_stepARY[3] =~ s/ /','/gi; + $list_mix_stepARY[3] =~ s/^',|,'-//gi; + if ($DBX) {print " LM $x |$list_mix_stepARY[0]|$list_mix_stepARY[2]|$list_mix_stepARY[3]|\n";} + $list_mix_dialableSQL .= "(list_id='$list_mix_stepARY[0]' and status IN($list_mix_stepARY[3]))"; + + $x++; + } + + if ($DB) {print " campaign mix: $list_order_mix[$i] |$vcl_id[$i] - $vcl_name[$i]|$list_mix_container[$i]|$x|$mix_method[$i]|\n";} + } if ( ($lead_filter_id[$i] !~ /NONE/) && (length($lead_filter_id[$i])>0) ) { @@ -960,7 +1001,6 @@ foreach(@campaign_id) $sthA->finish(); $lead_filter_sql[$i] =~ s/^and|and$|^or|or$|^ and|and $|^ or|or $//gi; $lead_filter_sql[$i] = "and $lead_filter_sql[$i]"; - if ($DB) {print " campaign lists count: $rec_countLISTS | $camp_lists[$i]\n";} if ($DB) {print " lead filter $lead_filter_id[$i] defined for $campaign_id[$i]\n";} if ($DBX) {print " |$lead_filter_sql[$i]|\n";} } @@ -971,7 +1011,15 @@ foreach(@campaign_id) if ($DBX) {print " |$lead_filter_id[$i]|\n";} } - $stmtA = "SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN($STATUSsql[$i]) and list_id IN($camp_lists[$i]) and ($all_gmtSQL[$i]) $lead_filter_sql[$i];"; + ##### Get count of leads that are dialable ##### + if ($list_order_mix[$i] =~ /DISABLED/) + { + $stmtA = "SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN($STATUSsql[$i]) and list_id IN($camp_lists[$i]) and ($all_gmtSQL[$i]) $lead_filter_sql[$i];"; + } + else + { + $stmtA = "SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and ($list_mix_dialableSQL) and ($all_gmtSQL[$i]) $lead_filter_sql[$i];"; + } if ($DBX) {print " |$stmtA|\n";} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; diff --git a/docs/OUTBOUND_LIST_ORDERING.txt b/docs/OUTBOUND_LIST_ORDERING.txt index 6c01e69b..c46c5735 100644 --- a/docs/OUTBOUND_LIST_ORDERING.txt +++ b/docs/OUTBOUND_LIST_ORDERING.txt @@ -32,10 +32,16 @@ for example: 101|1|40| A B NA -|:102|2|25| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -| The percentages always have to add up to 100, and the lists all have to be active and set to the campaign for the order mix entry to be Activated. +campaign hopper_level must be at least 100 when in list-mix-mode + +No more than 10 lists can be in a single list mix record + + The Server Side: The AST_VDhopper.pl script will need to be changed to use the new order mix to grab and order the leads for a campaign. This will involve checking if the list_order_mix is set to DISABLED or not, and if it is then it will proceed as it currently does. If it does not, it will grab the vicidial_campaigns_list_mix record that matches the list_order_mix and parse through it's lists. Then it will do a SELECT for each of the lists and mix all of the leads together using the proper mix_method. + MORE TO COME... diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index c9cc32f4..052c4849 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -5370,6 +5370,9 @@ if ($ADD==41) } } } + if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) + {$hopper_level='100';} + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', $adlSQL next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='" . mysql_real_escape_string($web_form_address) . "', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',lead_filter_id='$lead_filter_id',alt_number_dialing='$alt_number_dialing',scheduled_callbacks='$scheduled_callbacks',safe_harbor_message='$safe_harbor_message',drop_call_seconds='$drop_call_seconds',safe_harbor_exten='$safe_harbor_exten',wrapup_seconds='$wrapup_seconds',wrapup_message='$wrapup_message',closer_campaigns='$groups_value',use_internal_dnc='$use_internal_dnc',allcalls_delay='$allcalls_delay',omit_phone_code='$omit_phone_code',dial_method='$dial_method',available_only_ratio_tally='$available_only_ratio_tally',adaptive_dropped_percentage='$adaptive_dropped_percentage',adaptive_maximum_level='$adaptive_maximum_level',adaptive_latest_server_time='$adaptive_latest_server_time',adaptive_intensity='$adaptive_intensity',adaptive_dl_diff_target='$adaptive_dl_diff_target',concurrent_transfers='$concurrent_transfers',auto_alt_dial='$auto_alt_dial',agent_pause_codes_active='$agent_pause_codes_active',campaign_description='$campaign_description',campaign_changedate='$SQLdate',campaign_stats_refresh='$campaign_stats_refresh',disable_alter_custdata='$disable_alter_custdata',no_hopper_leads_logins='$no_hopper_leads_logins',list_order_mix='$list_order_mix' where campaign_id='$campaign_id';"; $rslt=mysql_query($stmtA, $link); @@ -5548,6 +5551,9 @@ if ($ADD==44) } } } + if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) + {$hopper_level='100';} + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',hopper_level='$hopper_level', $adlSQL lead_filter_id='$lead_filter_id',dial_method='$dial_method',adaptive_intensity='$adaptive_intensity',campaign_changedate='$SQLdate',list_order_mix='$list_order_mix' where campaign_id='$campaign_id';"; $rslt=mysql_query($stmtA, $link); @@ -8310,7 +8316,7 @@ if ($ADD==31) echo "\n"; echo "$NWB#vicidial_campaigns-lead_filter_id$NWE\n"; - echo "Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE\n"; + echo "Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE\n"; echo "Force Reset of Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE\n"; @@ -9008,7 +9014,7 @@ if ($ADD==34) echo "\n"; echo "$NWB#vicidial_campaigns-lead_filter_id$NWE\n"; - echo "Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE\n"; + echo "Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE\n"; echo "Force Reset of Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE\n";