fixed unneeded simulated agent calls in AST_VDremote_agents.pl script

git-svn-id: svn://192.168.202.10@594 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2007-04-17 18:12:19 +00:00
parent 75889efac1
commit 415765321e
2 changed files with 29 additions and 13 deletions
+22 -6
View File
@@ -33,6 +33,7 @@
# 70213-1306 - Added queuemetrics logging
# 70214-1243 - Added queuemetrics_log_id field to queue_log logging
# 70222-1606 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL
# 70417-1346 - Fixed bug that would add unneeded simulated agent lines
#
### begin parsing run-time options ###
@@ -459,10 +460,27 @@ while($one_day_interval > 0)
if ($DBX) {print STDERR "$DBremote_user[$h] NEW INSERT\n";}
if ($TESTrun > 0)
{
$SIqueryCID = "T$CIDdate$DBremote_conf_exten[$h]";
$stmtA="INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $local_DEF$DBremote_conf_exten[$h]$local_AMP$ext_context','Context: $ext_context','Exten: 999999999999','Priority: 1','Callerid: $SIqueryCID','','','','','');";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print STDERR " TESTrun CALL PLACED: 999999999999 $DBremote_conf_exten[$h] $DBremote_user[$h] NEW INSERT: |$affected_rows|\n";}
$stmtA = "SELECT count(*) FROM live_sip_channels where extension LIKE \"%999999999999\" 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_countLSC=0;
while ($sthArows > $rec_countLSC)
{
@aryA = $sthA->fetchrow_array;
$LSC_count = "$aryA[0]";
$rec_countLSC++;
}
$sthA->finish();
if ($number_of_lines > $LSC_count)
{
$SIqueryCID = "T$CIDdate$DBremote_conf_exten[$h]";
$stmtA="INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $local_DEF$DBremote_conf_exten[$h]$local_AMP$ext_context','Context: $ext_context','Exten: 999999999999','Priority: 1','Callerid: $SIqueryCID','','','','','');";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print STDERR " TESTrun CALL PLACED: 999999999999 $DBremote_conf_exten[$h] $DBremote_user[$h] NEW INSERT: |$affected_rows|\n";}
}
else {print STDERR "Agent test calls already adequate $number_of_lines !> $LSC_count\n";}
}
if ($affected_rows>0)
{
@@ -481,9 +499,7 @@ while($one_day_interval > 0)
$dbhB->disconnect();
}
}
}
}
}
@@ -147,12 +147,12 @@ $AVGcpuUSER = sprintf("%10s", $row[0]);
$AVGcpuSYSTEM = sprintf("%10s", $row[1]);
$AVGcpuIDLE = sprintf("%10s", $row[2]);
$stmt="select count(*),SUM(length_in_min) from call_log where extension NOT IN('8365','8366','8367') and start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$TOTALcalls = sprintf("%10s", $row[0]);
$OFFHOOKtime = sprintf("%10s", $row[1]);
$stmt="select count(*),SUM(length_in_min) from call_log where extension NOT IN('8365','8366','8367') and start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$TOTALcalls = sprintf("%10s", $row[0]);
$OFFHOOKtime = sprintf("%10s", $row[1]);
echo "Total Calls in/out on this server: $TOTALcalls\n";
@@ -199,7 +199,7 @@ fclose($DATfp);
$rows_to_max = ($rows_to_print + 100);
print "rows: $i\n";
#print "rows: $i\n";
$time_scale_abb = '5 minutes';
$time_scale_tick = '1 minute';