added local trunk shortage calc and stat logging to AST_VDauto_dial

git-svn-id: svn://192.168.202.10@319 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2006-10-02 20:01:59 +00:00
parent 2626993838
commit ebad306ae2
+38
View File
@@ -241,6 +241,8 @@ while($one_day_interval > 0)
@DBIPlivecalls=@MT;
@DBIPclosercamp=@MT;
@DBIPomitcode=@MT;
@DBIPtrunk_shortage=@MT;
@DBIPold_trunk_shortage=@MT;
$active_line_counter=0;
$user_counter=0;
@@ -310,6 +312,29 @@ while($one_day_interval > 0)
$user_counter++;
}
### check for vicidial_campaign_server_stats record, if non present then create it
$stmtA = "SELECT local_trunk_shortage FROM vicidial_campaign_server_stats where campaign_id='$DBIPcampaign[$user_CIPct]' and server_ip='$server_ip';";
$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;
$DBIPold_trunk_shortage[$user_CIPct] = "$aryA[0]";
$rec_count++;
}
if ($rec_count < 1)
{
$stmtA = "INSERT INTO vicidial_campaign_server_stats SET local_trunk_shortage='0', server_ip='$server_ip',campaign_id='$DBIPcampaign[$user_CIPct]';";
$affected_rows = $dbhA->do($stmtA);
$DBIPold_trunk_shortage[$user_CIPct]=0;
$event_string="VCSS ENTRY INSERTED: $affected_rows";
&event_logger;
}
### grab the dial_level and multiply by active agents to get your goalcalls
$DBIPadlevel[$user_CIPct]=0;
$stmtA = "SELECT auto_dial_level,local_call_time,dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,closer_campaigns,omit_phone_code,available_only_ratio_tally FROM vicidial_campaigns where campaign_id='$DBIPcampaign[$user_CIPct]'";
@@ -403,6 +428,11 @@ while($one_day_interval > 0)
{
$MVT_msg = "MVT override: $max_vicidial_trunks";
$DBIPmakecalls[$user_CIPct] = ($max_vicidial_trunks - $active_line_counter);
$DBIPtrunk_shortage[$user_CIPct] = ($active_line_goal - $max_vicidial_trunks);
}
else
{
$DBIPtrunk_shortage[$user_CIPct] = 0;
}
$event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: Calls to place: $DBIPmakecalls[$user_CIPct] ($DBIPgoalcalls[$user_CIPct] - $DBIPexistcalls[$user_CIPct]) $MVT_msg";
&event_logger;
@@ -493,6 +523,14 @@ while($one_day_interval > 0)
$stmtA = "UPDATE vicidial_campaign_stats SET differential_onemin='$stat_differential', agents_average_onemin='$total_agents_avg' where campaign_id='$DBIPcampaign[$user_CIPct]';";
$affected_rows = $dbhA->do($stmtA);
if ( ($DBIPold_trunk_shortage[$user_CIPct] > $DBIPtrunk_shortage[$user_CIPct]) || ($DBIPold_trunk_shortage[$user_CIPct] < $DBIPtrunk_shortage[$user_CIPct]) )
{
$stmtA = "UPDATE vicidial_campaign_server_stats SET local_trunk_shortage='$DBIPtrunk_shortage[$user_CIPct]' where server_ip='$server_ip' and campaign_id='$DBIPcampaign[$user_CIPct]';";
$affected_rows = $dbhA->do($stmtA);
}
$event_string="LOCAL TRUNK SHORTAGE: $DBIPtrunk_shortage[$user_CIPct]|$DBIPold_trunk_shortage[$user_CIPct] ($active_line_goal - $max_vicidial_trunks)";
&event_logger;
$user_CIPct++;
}