diff --git a/agc_2-X/trunk/LANG_www/agc_es/live_exten_check.php b/agc_2-X/trunk/LANG_www/agc_es/live_exten_check.php index 789b6c22..817f49d1 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/live_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_es/live_exten_check.php @@ -28,6 +28,7 @@ # 60103-1541 - added favorite extens status display # 60421-1359 - check GET/POST vars lines with isset to not trigger PHP NOTICES # 60619-1203 - Added variable filters to close security holes for login form +# 60825-1029 - Fixed translation variable issue ChannelA # require("dbconnect.php"); @@ -58,8 +59,8 @@ $pass=ereg_replace("[^0-9a-zA-Z]","",$pass); # default optional vars if not set if (!isset($format)) {$format="text";} -$version = '1.1.12'; -$build = '60619-1203'; +$version = '2.0.1'; +$build = '60825-1029'; $StarTtime = date("U"); $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); @@ -145,8 +146,8 @@ echo "$row[0]|"; { $loop_count++; $row=mysql_fetch_row($rslt); - $CanalA[$loop_count] = "$row[0]"; - $CanalB[$loop_count] = "$row[1]"; + $ChanneLA[$loop_count] = "$row[0]"; + $ChanneLB[$loop_count] = "$row[1]"; if ($format=='debug') {echo "\n";} } } @@ -155,7 +156,7 @@ echo "$row[0]|"; while($loop_count > $counter) { $counter++; - $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ChannelA[$counter]';"; + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($rslt) {$trunk_count = mysql_num_rows($rslt);} @@ -163,13 +164,13 @@ echo "$row[0]|"; { $row=mysql_fetch_row($rslt); echo "Conversation: $counter ~"; - echo "CanalA: $CanalA[$counter] ~"; - echo "CanalB: $CanalB[$counter] ~"; + echo "CanalA: $ChanneLA[$counter] ~"; + echo "CanalB: $ChanneLB[$counter] ~"; echo "CanalBtrunk: $row[0]|"; } else { - $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ChannelA[$counter]';"; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($rslt) {$trunk_count = mysql_num_rows($rslt);} @@ -177,13 +178,13 @@ echo "$row[0]|"; { $row=mysql_fetch_row($rslt); echo "Conversation: $counter ~"; - echo "CanalA: $CanalA[$counter] ~"; - echo "CanalB: $CanalB[$counter] ~"; + echo "CanalA: $ChanneLA[$counter] ~"; + echo "CanalB: $ChanneLB[$counter] ~"; echo "CanalBtrunk: $row[0]|"; } else { - $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ChannelB[$counter]%\";"; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($rslt) {$trunk_count = mysql_num_rows($rslt);} @@ -191,13 +192,13 @@ echo "$row[0]|"; { $row=mysql_fetch_row($rslt); echo "Conversation: $counter ~"; - echo "CanalA: $CanalA[$counter] ~"; - echo "CanalB: $CanalB[$counter] ~"; + echo "CanalA: $ChanneLA[$counter] ~"; + echo "CanalB: $ChanneLB[$counter] ~"; echo "CanalBtrunk: $row[0]|"; } else { - $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChannelB[$counter]%\";"; + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($rslt) {$trunk_count = mysql_num_rows($rslt);} @@ -205,16 +206,16 @@ echo "$row[0]|"; { $row=mysql_fetch_row($rslt); echo "Conversation: $counter ~"; - echo "CanalA: $CanalA[$counter] ~"; - echo "CanalB: $CanalB[$counter] ~"; + echo "CanalA: $ChanneLA[$counter] ~"; + echo "CanalB: $ChanneLB[$counter] ~"; echo "CanalBtrunk: $row[0]|"; } else { echo "Conversation: $counter ~"; - echo "CanalA: $CanalA[$counter] ~"; - echo "CanalB: $CanalB[$counter] ~"; - echo "CanalBtrunk: $CanalA[$counter]|"; + echo "CanalA: $ChanneLA[$counter] ~"; + echo "CanalB: $ChanneLB[$counter] ~"; + echo "CanalBtrunk: $ChanneLA[$counter]|"; } } } diff --git a/agc_2-X/trunk/bin/AST_VDadapt.pl b/agc_2-X/trunk/bin/AST_VDadapt.pl index d7dc0e68..1057c464 100644 --- a/agc_2-X/trunk/bin/AST_VDadapt.pl +++ b/agc_2-X/trunk/bin/AST_VDadapt.pl @@ -28,6 +28,7 @@ if ($sec < 10) {$sec = "0$sec";} $file_date = "$year-$mon-$mday"; $now_date = "$year-$mon-$mday $hour:$min:$sec"; $VDL_date = "$year-$mon-$mday 00:00:01"; +$current_hourmin = "$hour$min"; ### get date-time of one hour ago ### $VDL_hour = ($secX - (60 * 60)); @@ -114,6 +115,11 @@ if (length($ARGV[0])>1) $DB_show_offset=1; print "\n-----DEBUG GMT -----\n\n"; } + if ($args =~ /-force/i) + { + $force_test=1; + print "\n----- FORCE TESTING -----\n\n"; + } if ($args =~ /-t/i) { $T=1; $TEST=1; @@ -125,10 +131,6 @@ if (length($ARGV[0])>1) } } } -else -{ -print "no command line options set\n"; -} # default path to astguiclient configuration file: $PATHconf = '/etc/astguiclient.conf'; @@ -252,6 +254,7 @@ while ($sthArows > $rec_count) $adaptive_dropped_percentage[$rec_count] = $aryA[48]; $adaptive_maximum_level[$rec_count] = $aryA[49]; $adaptive_latest_target_gmt[$rec_count] = $aryA[50]; + $adaptive_intensity[$rec_count] = $aryA[51]; $rec_count++; } @@ -542,6 +545,7 @@ foreach(@campaign_id) ##### BEGIN calculate what gmt_offset_now values are within the allowed local_call_time setting ### + $last_target_hour=0; $g=0; $p='13'; $GMT_gmt[0] = ''; @@ -598,191 +602,6 @@ foreach(@campaign_id) $del_state_gmt_SQL = ''; $ct_srs=0; $b=0; - if (length($Gct_state_call_times)>2) - { - @state_rules = split(/\|/,$Gct_state_call_times); - $ct_srs = ($#state_rules - 2); - } - while($ct_srs >= $b) - { - if (length($state_rules[$b])>1) - { - $stmtA = "SELECT * from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; - if ($DBX) {print " |$stmtA|\n";} - $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; - $Gstate_call_time_id = "$aryA[0]"; - $Gstate_call_time_state = "$aryA[1]"; - $Gsct_default_start = "$aryA[4]"; - $Gsct_default_stop = "$aryA[5]"; - $Gsct_sunday_start = "$aryA[6]"; - $Gsct_sunday_stop = "$aryA[7]"; - $Gsct_monday_start = "$aryA[8]"; - $Gsct_monday_stop = "$aryA[9]"; - $Gsct_tuesday_start = "$aryA[10]"; - $Gsct_tuesday_stop = "$aryA[11]"; - $Gsct_wednesday_start = "$aryA[12]"; - $Gsct_wednesday_stop = "$aryA[13]"; - $Gsct_thursday_start = "$aryA[14]"; - $Gsct_thursday_stop = "$aryA[15]"; - $Gsct_friday_start = "$aryA[16]"; - $Gsct_friday_stop = "$aryA[17]"; - $Gsct_saturday_start = "$aryA[18]"; - $Gsct_saturday_stop = "$aryA[19]"; - $ct_states .="'$Gstate_call_time_state',"; - $rec_count++; - } - $sthA->finish(); - - $r=0; - $state_gmt=''; - $del_state_gmt=''; - while($r < $g) - { - if ($GMT_day[$r]==0) #### Sunday local time - { - if (($Gsct_sunday_start==0) and ($Gsct_sunday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - else - {$del_state_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gsct_sunday_start) and ($GMT_hour[$r]<$Gsct_sunday_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - else - {$del_state_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==1) #### Monday local time - { - if (($Gsct_monday_start==0) and ($Gsct_monday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - else - {$del_state_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gsct_monday_start) and ($GMT_hour[$r]<$Gsct_monday_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - else - {$del_state_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==2) #### Tuesday local time - { - if (($Gsct_tuesday_start==0) and ($Gsct_tuesday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - else - {$del_state_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) and ($GMT_hour[$r]<$Gsct_tuesday_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - else - {$del_state_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==3) #### Wednesday local time - { - if (($Gsct_wednesday_start==0) and ($Gsct_wednesday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - else - {$del_state_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) and ($GMT_hour[$r]<$Gsct_wednesday_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - else - {$del_state_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==4) #### Thursday local time - { - if (($Gsct_thursday_start==0) and ($Gsct_thursday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - else - {$del_state_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gsct_thursday_start) and ($GMT_hour[$r]<$Gsct_thursday_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - else - {$del_state_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==5) #### Friday local time - { - if (($Gsct_friday_start==0) and ($Gsct_friday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - else - {$del_state_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gsct_friday_start) and ($GMT_hour[$r]<$Gsct_friday_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - else - {$del_state_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==6) #### Saturday local time - { - if (($Gsct_saturday_start==0) and ($Gsct_saturday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - else - {$del_state_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gsct_saturday_start) and ($GMT_hour[$r]<$Gsct_saturday_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - else - {$del_state_gmt.="'$GMT_gmt[$r]',";} - } - } - $r++; - } - $state_gmt = "$state_gmt'99'"; - $del_state_gmt = "$del_state_gmt'99'"; - $ct_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($state_gmt)) "; - $del_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($del_state_gmt)) "; - } - - $b++; - } - if (length($ct_states)>2) - { - $ct_states =~ s/,$//gi; - $ct_statesSQL = "and state NOT IN($ct_states)"; - } - else - { - $ct_statesSQL = ""; - } - $r=0; $default_gmt=''; $del_default_gmt=''; @@ -793,16 +612,12 @@ foreach(@campaign_id) if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) { if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - else - {$del_default_gmt.="'$GMT_gmt[$r]',";} + {if ($GMT_hour[$r] > $last_target_hour) {$last_target_hour=$GMT_hour[$r];}} } else { if ( ($GMT_hour[$r]>=$Gct_sunday_start) and ($GMT_hour[$r]<$Gct_sunday_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - else - {$del_default_gmt.="'$GMT_gmt[$r]',";} + {if ($GMT_hour[$r] > $last_target_hour) {$last_target_hour=$GMT_hour[$r];}} } } if ($GMT_day[$r]==1) #### Monday local time @@ -810,16 +625,12 @@ foreach(@campaign_id) if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) { if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - else - {$del_default_gmt.="'$GMT_gmt[$r]',";} + {if ($GMT_hour[$r] > $last_target_hour) {$last_target_hour=$GMT_hour[$r];}} } else { if ( ($GMT_hour[$r]>=$Gct_monday_start) and ($GMT_hour[$r]<$Gct_monday_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - else - {$del_default_gmt.="'$GMT_gmt[$r]',";} + {if ($GMT_hour[$r] > $last_target_hour) {$last_target_hour=$GMT_hour[$r];}} } } if ($GMT_day[$r]==2) #### Tuesday local time @@ -827,16 +638,12 @@ foreach(@campaign_id) if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) { if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - else - {$del_default_gmt.="'$GMT_gmt[$r]',";} + {if ($GMT_hour[$r] > $last_target_hour) {$last_target_hour=$GMT_hour[$r];}} } else { if ( ($GMT_hour[$r]>=$Gct_tuesday_start) and ($GMT_hour[$r]<$Gct_tuesday_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - else - {$del_default_gmt.="'$GMT_gmt[$r]',";} + {if ($GMT_hour[$r] > $last_target_hour) {$last_target_hour=$GMT_hour[$r];}} } } if ($GMT_day[$r]==3) #### Wednesday local time @@ -844,16 +651,12 @@ foreach(@campaign_id) if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) { if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - else - {$del_default_gmt.="'$GMT_gmt[$r]',";} + {if ($GMT_hour[$r] > $last_target_hour) {$last_target_hour=$GMT_hour[$r];}} } else { if ( ($GMT_hour[$r]>=$Gct_wednesday_start) and ($GMT_hour[$r]<$Gct_wednesday_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - else - {$del_default_gmt.="'$GMT_gmt[$r]',";} + {if ($GMT_hour[$r] > $last_target_hour) {$last_target_hour=$GMT_hour[$r];}} } } if ($GMT_day[$r]==4) #### Thursday local time @@ -861,16 +664,12 @@ foreach(@campaign_id) if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) { if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - else - {$del_default_gmt.="'$GMT_gmt[$r]',";} + {if ($GMT_hour[$r] > $last_target_hour) {$last_target_hour=$GMT_hour[$r];}} } else { if ( ($GMT_hour[$r]>=$Gct_thursday_start) and ($GMT_hour[$r]<$Gct_thursday_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - else - {$del_default_gmt.="'$GMT_gmt[$r]',";} + {if ($GMT_hour[$r] > $last_target_hour) {$last_target_hour=$GMT_hour[$r];}} } } if ($GMT_day[$r]==5) #### Friday local time @@ -878,16 +677,12 @@ foreach(@campaign_id) if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) { if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - else - {$del_default_gmt.="'$GMT_gmt[$r]',";} + {if ($GMT_hour[$r] > $last_target_hour) {$last_target_hour=$GMT_hour[$r];}} } else { if ( ($GMT_hour[$r]>=$Gct_friday_start) and ($GMT_hour[$r]<$Gct_friday_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - else - {$del_default_gmt.="'$GMT_gmt[$r]',";} + {if ($GMT_hour[$r] > $last_target_hour) {$last_target_hour=$GMT_hour[$r];}} } } if ($GMT_day[$r]==6) #### Saturday local time @@ -895,57 +690,145 @@ foreach(@campaign_id) if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) { if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - else - {$del_default_gmt.="'$GMT_gmt[$r]',";} + {if ($GMT_hour[$r] > $last_target_hour) {$last_target_hour=$GMT_hour[$r];}} } else { if ( ($GMT_hour[$r]>=$Gct_saturday_start) and ($GMT_hour[$r]<$Gct_saturday_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - else - {$del_default_gmt.="'$GMT_gmt[$r]',";} + {if ($GMT_hour[$r] > $last_target_hour) {$last_target_hour=$GMT_hour[$r];}} } } $r++; } - - $default_gmt = "$default_gmt'99'"; - $del_default_gmt = "$del_default_gmt'99'"; - $all_gmtSQL = "(gmt_offset_now IN($default_gmt) $ct_statesSQL) $ct_state_gmt_SQL"; - $del_gmtSQL = "(gmt_offset_now IN($del_default_gmt) $ct_statesSQL) $del_state_gmt_SQL"; - ##### END calculate what gmt_offset_now values are within the allowed local_call_time setting ### + ## UPDATE STATS FOR CAMPAIGN $stmtA = "UPDATE vicidial_campaign_stats SET calls_today='$VCScalls_today',drops_today='$VCSdrops_today',drops_today_pct='$VCSdrops_today_pct',calls_hour='$VCScalls_hour',drops_hour='$VCSdrops_hour',drops_hour_pct='$VCSdrops_hour_pct',calls_halfhour='$VCScalls_halfhour',drops_halfhour='$VCSdrops_halfhour',drops_halfhour_pct='$VCSdrops_halfhour_pct',calls_fivemin='$VCScalls_five',drops_fivemin='$VCSdrops_five',drops_fivemin_pct='$VCSdrops_five_pct',calls_onemin='$VCScalls_one',drops_onemin='$VCSdrops_one',drops_onemin_pct='$VCSdrops_one_pct' where campaign_id='$campaign_id[$i]';"; $affected_rows = $dbhA->do($stmtA); - $differential_mul = ($differential_onemin / $agents_average_onemin); - $differential_pct = ($differential_mul * 100); - $differential_pct = sprintf("%.2f", $differential_pct); - $suggested_dial_level = ($auto_dial_level[$i] * ($differential_mul + 1) ); - $suggested_dial_level = sprintf("%.3f", $suggested_dial_level); - $adaptive_string = "\n"; - $adaptive_string .= "CAMPAIGN: $campaign_id[$i]\n"; - $adaptive_string .= "SETTINGS-\n"; - $adaptive_string .= " DIAL_LEVEL: $auto_dial_level[$i]\n"; - $adaptive_string .= " DIALMETHOD: $dial_method[$i]\n"; - $adaptive_string .= " AVAIL ONLY: $available_only_ratio_tally[$i]\n"; - $adaptive_string .= " DROP PCNT: $adaptive_dropped_percentage[$i]\n"; - $adaptive_string .= " MAX LEVEL: $adaptive_maximum_level[$i]\n"; - $adaptive_string .= " LATEST GMT: $adaptive_latest_target_gmt[$i]\n"; - $adaptive_string .= "CURRENT STATS-\n"; - $adaptive_string .= " AVG AGENTS: $agents_average_onemin\n"; - $adaptive_string .= " AGENTS: $VCSagents ACTIVE: $VCSagents_active CALC: $VCSagents_calc INCALL: $VCSINCALL READY: $VCSREADY\n"; - $adaptive_string .= " DL DIFFERENTIAL: $differential_onemin\n"; - $adaptive_string .= " PERCENT DIFF: $differential_pct\n"; - $adaptive_string .= " SUGGEST DL: $suggested_dial_level = ($auto_dial_level[$i] *($differential_mul+1))\n"; - $adaptive_string .= " TODAY DROPS: $VCScalls_today $VCSdrops_today $VCSdrops_today_pct%\n"; - $adaptive_string .= " ONE HOUR DROPS: $VCScalls_hour $VCSdrops_hour $VCSdrops_hour_pct%\n"; - $adaptive_string .= " HALF HOUR DROPS: $VCScalls_halfhour $VCSdrops_halfhour $VCSdrops_halfhour_pct%\n"; - $adaptive_string .= " FIVE MIN DROPS: $VCScalls_five $VCSdrops_five $VCSdrops_five_pct%\n"; - $adaptive_string .= " ONE MIN DROPS: $VCScalls_one $VCSdrops_one $VCSdrops_one_pct%\n"; + if ( ($dial_method[$i] =~ /ADAPT_HARD_LIMIT|ADAPT_AVERAGE|ADAPT_TAPERED/) || ($force_test>0) ) + { + # Calculate the optimal dial_level differential for the past minute + $differential_mul = ($differential_onemin / $agents_average_onemin); + $differential_pct_raw = ($differential_mul * 100); + $differential_pct = sprintf("%.2f", $differential_pct_raw); + + # Factor in the intensity setting + $intensity_mul = ($adaptive_intensity[$i] / 100); + if ($differential_pct_raw < 0) + {$intensity_diff = ($differential_pct_raw * ($intensity_mul - 1) );} + else + {$intensity_diff = ($differential_pct_raw * ($intensity_mul + 1) );} + $intensity_pct = sprintf("%.2f", $intensity_diff); + $intensity_diff_mul = ($intensity_diff / 100); + + # Suggested dial_level based on differential + $suggested_dial_level = ($auto_dial_level[$i] * ($differential_mul + 1) ); + $suggested_dial_level = sprintf("%.3f", $suggested_dial_level); + + # Suggested dial_level based on differential with intensity setting + $intensity_dial_level = ($auto_dial_level[$i] * ($intensity_diff_mul + 1) ); + $intensity_dial_level = sprintf("%.3f", $intensity_dial_level); + + # Calculate last timezone target for ADAPT_TAPERED + $last_hour_diff_gmt = ($LOCAL_GMT_OFF - $adaptive_latest_target_gmt[$i]); + $last_hour_diff = ($last_hour_diff_gmt * 100); + $last_target_hour_final = ($last_target_hour + $last_hour_diff); + if ($last_target_hour_final>2400) {$last_target_hour_final=2400;} + $tapered_hours_left = ($last_target_hour_final - $current_hourmin); + if ($tapered_hours_left > 1000) + {$tapered_rate = 1;} + else + {$tapered_rate = ($tapered_hours_left / 1000);} + + $adaptive_string = "\n"; + $adaptive_string .= "CAMPAIGN: $campaign_id[$i]\n"; + $adaptive_string .= "SETTINGS-\n"; + $adaptive_string .= " DIAL_LEVEL: $auto_dial_level[$i]\n"; + $adaptive_string .= " DIALMETHOD: $dial_method[$i]\n"; + $adaptive_string .= " AVAIL ONLY: $available_only_ratio_tally[$i]\n"; + $adaptive_string .= " DROP PCNT: $adaptive_dropped_percentage[$i]\n"; + $adaptive_string .= " MAX LEVEL: $adaptive_maximum_level[$i]\n"; + $adaptive_string .= " SERVER GMT: $LOCAL_GMT_OFF - $current_hourmin\n"; + $adaptive_string .= " LATESTHOUR: $last_target_hour\n"; + $adaptive_string .= " LATEST GMT: $adaptive_latest_target_gmt[$i]\n"; + $adaptive_string .= " LATETARGET: $last_target_hour_final ($tapered_hours_left left|$tapered_rate)\n"; + $adaptive_string .= " INTENSITY: $adaptive_intensity[$i]\n"; + $adaptive_string .= "CURRENT STATS-\n"; + $adaptive_string .= " AVG AGENTS: $agents_average_onemin\n"; + $adaptive_string .= " AGENTS: $VCSagents ACTIVE: $VCSagents_active CALC: $VCSagents_calc INCALL: $VCSINCALL READY: $VCSREADY\n"; + $adaptive_string .= " DL DIFFERENTIAL: $differential_onemin\n"; + $adaptive_string .= "DIAL LEVEL SUGGESTION-\n"; + $adaptive_string .= " PERCENT DIFF: $differential_pct\n"; + $adaptive_string .= " SUGGEST DL: $suggested_dial_level = ($auto_dial_level[$i] * ($differential_mul + 1) )\n"; + $adaptive_string .= " INTENSE DIFF: $intensity_pct\n"; + $adaptive_string .= " INTENSE DL: $intensity_dial_level = ($auto_dial_level[$i] * ($intensity_diff_mul + 1) )\n"; + if ($intensity_dial_level > $adaptive_maximum_level[$i]) + { + $adaptive_string .= " DIAL LEVEL OVER CAP! SETTING TO CAP: $adaptive_maximum_level[$i]\n"; + $intensity_dial_level = $adaptive_maximum_level[$i]; + } + if ($intensity_dial_level < 1) + { + $adaptive_string .= " DIAL LEVEL TOO LOW! SETTING TO 1\n"; + $intensity_dial_level = "1.0"; + } + $adaptive_string .= "DROP STATS-\n"; + $adaptive_string .= " TODAY DROPS: $VCScalls_today $VCSdrops_today $VCSdrops_today_pct%\n"; + $adaptive_string .= " ONE HOUR DROPS: $VCScalls_hour $VCSdrops_hour $VCSdrops_hour_pct%\n"; + $adaptive_string .= " HALF HOUR DROPS: $VCScalls_halfhour $VCSdrops_halfhour $VCSdrops_halfhour_pct%\n"; + $adaptive_string .= " FIVE MIN DROPS: $VCScalls_five $VCSdrops_five $VCSdrops_five_pct%\n"; + $adaptive_string .= " ONE MIN DROPS: $VCScalls_one $VCSdrops_one $VCSdrops_one_pct%\n"; + + ### DROP PERCENTAGE RULES TO LOWER DIAL_LEVEL ### + if ( ($VCScalls_one > 20) && ($VCSdrops_one_pct > 50) ) + { + $intensity_dial_level = ($intensity_dial_level / 2); + $adaptive_string .= " DROP RATE OVER 50% FOR LAST MINUTE! CUTTING DIAL LEVEL TO: $intensity_dial_level\n"; + } + if ( ($VCScalls_today > 50) && ($VCSdrops_today_pct > $adaptive_dropped_percentage[$i]) ) + { + if ($dial_method[$i] =~ /ADAPT_HARD_LIMIT/) + { + $intensity_dial_level = "1.0"; + $adaptive_string .= " DROP RATE OVER HARD LIMIT FOR TODAY! HARD DIAL LEVEL TO: 1.0\n"; + } + if ($dial_method[$i] =~ /ADAPT_AVERAGE/) + { + $intensity_dial_level = ($intensity_dial_level / 2); + $adaptive_string .= " DROP RATE OVER LIMIT FOR TODAY! AVERAGING DIAL LEVEL TO: $intensity_dial_level\n"; + } + if ($dial_method[$i] =~ /ADAPT_TAPERED/) + { + if ($tapered_hours_left < 0) + { + $intensity_dial_level = "1.0"; + $adaptive_string .= " DROP RATE OVER LAST HOUR LIMIT FOR TODAY! TAPERING DIAL LEVEL TO: 1.0\n"; + } + else + { + $intensity_dial_level = ($intensity_dial_level * $tapered_rate); + $adaptive_string .= " DROP RATE OVER LIMIT FOR TODAY! TAPERING DIAL LEVEL TO: $intensity_dial_level\n"; + } + } + } + + ### ALWAYS RAISE DIAL_LEVEL TO 1.0 IF IT IS LOWER ### + if ($intensity_dial_level < 1) + { + $adaptive_string .= " DIAL LEVEL TOO LOW! SETTING TO 1\n"; + $intensity_dial_level = "1.0"; + } + + if (!$TEST) + { + $stmtA = "UPDATE vicidial_campaigns SET auto_dial_level='$intensity_dial_level' where campaign_id='$campaign_id[$i]';"; + $Uaffected_rows = $dbhA->do($stmtA); + } + + $adaptive_string .= "DIAL LEVEL UPDATED TO: $intensity_dial_level CONFIRM: $Uaffected_rows\n"; + } if ($DB) {print "campaign stats updated: $campaign_id[$i] $adaptive_string\n";} diff --git a/agc_2-X/trunk/docs/PREDICTIVE.txt b/agc_2-X/trunk/docs/PREDICTIVE.txt index 6722df90..3c526cc7 100644 --- a/agc_2-X/trunk/docs/PREDICTIVE.txt +++ b/agc_2-X/trunk/docs/PREDICTIVE.txt @@ -24,3 +24,5 @@ The second set of data to gather is dropped call information across several inte 5. Total drops and total calls for the campaign in the past one minute Also, the drop percentage is calculated and stored in the vicidial_campaign_stats table. + +To use adaptive dialing you must have the AST_VDadapt.pl script in your crontab running every minute. diff --git a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql index a229e55e..77afd788 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -791,7 +791,7 @@ INSERT INTO vicidial_state_call_times SET state_call_time_id='massachuse',state_ INSERT INTO vicidial_state_call_times SET state_call_time_id='mississipp',state_call_time_state='MS',state_call_time_name='Mississippi 8am-8pm and Sunday',sct_default_start='800',sct_default_stop='2000',sct_sunday_start='2400',sct_sunday_stop='2400'; INSERT INTO vicidial_state_call_times SET state_call_time_id='nebraska',state_call_time_state='NE',state_call_time_name='Nebraska 8am',sct_default_start='800',sct_default_stop='2100'; INSERT INTO vicidial_state_call_times SET state_call_time_id='nevada',state_call_time_state='NV',state_call_time_name='Nevada 8pm restriction',sct_default_start='900',sct_default_stop='2000'; -INSERT INTO vicidial_state_call_times SET state_call_time_id='pennsylvan',state_call_time_state='PN',state_call_time_name='Pennsylvania sunday restriction',sct_sunday_start='1330',sct_sunday_stop='2100'; +INSERT INTO vicidial_state_call_times SET state_call_time_id='pennsylvan',state_call_time_state='PA',state_call_time_name='Pennsylvania sunday restriction',sct_sunday_start='1330',sct_sunday_stop='2100'; INSERT INTO vicidial_state_call_times SET state_call_time_id='rhodeislan',state_call_time_state='RI',state_call_time_name='Rhode Island restrictions',sct_default_start='900',sct_default_stop='1800',sct_sunday_start='2400',sct_sunday_stop='2400',sct_saturday_start='1000',sct_saturday_stop='1700'; INSERT INTO vicidial_state_call_times SET state_call_time_id='sdakota',state_call_time_state='SD',state_call_time_name='South Dakota sunday restrict',sct_sunday_start='2400',sct_sunday_stop='2400'; INSERT INTO vicidial_state_call_times SET state_call_time_id='tennessee',state_call_time_state='TN',state_call_time_name='Tennessee 8am',sct_default_start='800',sct_default_stop='2100'; diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index 004a4012..2f7e24e7 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -4440,11 +4440,11 @@ echo "Maximum Adapt Dial Level: Latest Target Timezone: (MUST Adjust for DST) $NWB#vicidial_campaigns-adaptive_latest_target_gmt$NWE\n"; echo "Adapt Intensity Modifier: $NWB#vicidial_campaigns-adaptive_intensity$NWE\n"; @@ -4852,11 +4852,11 @@ echo "Dial Method: Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE\n"; echo "Adapt Intensity Modifier: $NWB#vicidial_campaigns-adaptive_intensity$NWE\n";