Added recent session per-call logging and force_fronter_audio_stop Agent API function
git-svn-id: svn://192.168.202.10@3066 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -27,8 +27,11 @@
|
||||
# 180519-1431 - Added vicidial_inbound_groups optimization
|
||||
# 181003-2115 - Added optimize of cid_channels_recent_ tables
|
||||
# 190214-1758 - Fix for cid_recent_ table optimization issue
|
||||
# 190222-1321 - Added optional flushing of vicidial_sessions_recent table
|
||||
#
|
||||
|
||||
$session_flush=0;
|
||||
|
||||
### begin parsing run-time options ###
|
||||
if (length($ARGV[0])>1)
|
||||
{
|
||||
@@ -46,6 +49,7 @@ if (length($ARGV[0])>1)
|
||||
print " [-t] = test\n";
|
||||
print " [--debug] = debugging messages\n";
|
||||
print " [--seconds=XXX] = optional, minimum number of seconds worth of records to keep(default 3600)\n";
|
||||
print " [--session-flush] = flush the vicidial_sessions_recent table\n";
|
||||
print "\n";
|
||||
|
||||
exit;
|
||||
@@ -66,6 +70,11 @@ if (length($ARGV[0])>1)
|
||||
$T=1; $TEST=1;
|
||||
print "\n-----TESTING -----\n\n";
|
||||
}
|
||||
if ($args =~ /--session-flush/i)
|
||||
{
|
||||
$session_flush=1;
|
||||
print "\n----- SESSION FLUSH(vicidial_sessions_recent) ----- $session_flush \n\n";
|
||||
}
|
||||
if ($args =~ /--seconds=/i)
|
||||
{
|
||||
@data_in = split(/--seconds=/,$args);
|
||||
@@ -428,6 +437,27 @@ while ($sthArowsSERVERS > $aas)
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
|
||||
if ($session_flush > 0)
|
||||
{
|
||||
$stmtA = "DELETE from vicidial_sessions_recent where call_date < '$SQLdate_NEG_1hour';";
|
||||
if($DB){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T) { $affected_rows = $dbhA->do($stmtA);}
|
||||
if (!$Q) {print " - vicidial_sessions_recent flush: $affected_rows rows\n";}
|
||||
|
||||
$stmtA = "OPTIMIZE table vicidial_sessions_recent;";
|
||||
if($DB){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T)
|
||||
{
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";}
|
||||
$sthA->finish();
|
||||
}
|
||||
if (!$Q) {print " - OPTIMIZE vicidial_sessions_recent \n";}
|
||||
}
|
||||
$dbhA->disconnect();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user