Added --GSW audio handling script option for GSM codec with RIFF headers and .wav filename extension

git-svn-id: svn://192.168.202.10@1193 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2009-07-27 19:10:09 +00:00
parent 8cabbcaccf
commit 5e66bf545f
9 changed files with 569 additions and 166 deletions
+6
View File
@@ -163,6 +163,12 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom
work the dial method must be set to MANUAL or INBOUND_MAN and No Hopper
Dialing must be enabled. Default is NONE for disabled.
40. Agent screen Alert option is now disabled by default.
41. Added --GSW option for audio processing scripts 2 and 3 for GSM codec files
with an RIFF header and named with .wav file extension
+28 -28
View File
@@ -34,42 +34,42 @@
### begin parsing run-time options ###
if (length($ARGV[0])>1)
{
{
$i=0;
while ($#ARGV >= $i)
{
$args = "$args $ARGV[$i]";
$i++;
}
{
$args = "$args $ARGV[$i]";
$i++;
}
if ($args =~ /--help/i)
{
print "allowed run time options:\n [--debug] = debug\n [--debugX] = super debug\n [-t] = test\n\n";
exit;
}
{
print "allowed run time options:\n [--debug] = debug\n [--debugX] = super debug\n [-t] = test\n\n";
exit;
}
else
{
{
if ($args =~ /--debug/i)
{
$DB=1;
print "\n----- DEBUG -----\n\n";
}
{
$DB=1;
print "\n----- DEBUG -----\n\n";
}
if ($args =~ /--debugX/i)
{
$DBX=1;
print "\n----- SUPER DEBUG -----\n\n";
}
{
$DBX=1;
print "\n----- SUPER DEBUG -----\n\n";
}
if ($args =~ /-t/i)
{
$T=1; $TEST=1;
print "\n-----TESTING -----\n\n";
{
$T=1; $TEST=1;
print "\n-----TESTING -----\n\n";
}
}
}
}
else
{
#print "no command line options set\n";
}
{
#print "no command line options set\n";
}
# default path to astguiclient configuration file:
@@ -146,7 +146,7 @@ opendir(FILE, "$dir1/");
### Loop through files first to gather filesizes
$i=0;
foreach(@FILES)
{
{
$FILEsize1[$i] = 0;
if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") )
{
@@ -154,7 +154,7 @@ foreach(@FILES)
if ($DBX) {print "$FILES[$i] $FILEsize1[$i]\n";}
}
$i++;
}
}
sleep(5);
@@ -162,7 +162,7 @@ sleep(5);
### Loop through files a second time to gather filesizes again 5 seconds later
$i=0;
foreach(@FILES)
{
{
$FILEsize2[$i] = 0;
if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") )
+28 -28
View File
@@ -33,42 +33,42 @@
### begin parsing run-time options ###
if (length($ARGV[0])>1)
{
{
$i=0;
while ($#ARGV >= $i)
{
$args = "$args $ARGV[$i]";
$i++;
}
{
$args = "$args $ARGV[$i]";
$i++;
}
if ($args =~ /--help/i)
{
print "allowed run time options:\n [--debug] = debug\n [--debugX] = super debug\n [-t] = test\n\n";
exit;
}
{
print "allowed run time options:\n [--debug] = debug\n [--debugX] = super debug\n [-t] = test\n\n";
exit;
}
else
{
{
if ($args =~ /--debug/i)
{
$DB=1;
print "\n----- DEBUG -----\n\n";
}
{
$DB=1;
print "\n----- DEBUG -----\n\n";
}
if ($args =~ /--debugX/i)
{
$DBX=1;
print "\n----- SUPER DEBUG -----\n\n";
}
{
$DBX=1;
print "\n----- SUPER DEBUG -----\n\n";
}
if ($args =~ /-t/i)
{
$T=1; $TEST=1;
print "\n-----TESTING -----\n\n";
{
$T=1; $TEST=1;
print "\n-----TESTING -----\n\n";
}
}
}
}
else
{
#print "no command line options set\n";
}
{
#print "no command line options set\n";
}
# default path to astguiclient configuration file:
@@ -167,7 +167,7 @@ opendir(FILE, "$dir1/");
### Loop through files first to gather filesizes
$i=0;
foreach(@FILES)
{
{
$FILEsize1[$i] = 0;
if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") )
{
@@ -175,7 +175,7 @@ foreach(@FILES)
if ($DBX) {print "$FILES[$i] $FILEsize1[$i]\n";}
}
$i++;
}
}
sleep(5);
@@ -183,7 +183,7 @@ sleep(5);
### Loop through files a second time to gather filesizes again 5 seconds later
$i=0;
foreach(@FILES)
{
{
$FILEsize2[$i] = 0;
if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") )
+84 -50
View File
@@ -19,6 +19,7 @@
# --GSM = GSM 6.10 codec
# --MP3 = MPEG Layer3 codec
# --OGG = OGG Vorbis codec
# --GSW = GSM 6.10 codec with RIFF headers (.wav extension)
#
# make sure that the following directories exist:
# /var/spool/asterisk/monitorDONE # where the mixed -all files are put
@@ -30,70 +31,87 @@
#
# 80302-1958 - First Build
# 80731-2253 - Changed size comparisons for more efficiency
# 90727-1417 - Added GSW format option
#
$GSM=0; $MP3=0; $OGG=0;
$GSM=0; $MP3=0; $OGG=0; $GSW=0;
### begin parsing run-time options ###
if (length($ARGV[0])>1)
{
{
$i=0;
while ($#ARGV >= $i)
{
$args = "$args $ARGV[$i]";
$i++;
}
{
$args = "$args $ARGV[$i]";
$i++;
}
if ($args =~ /--help/i)
{
print "allowed run time options:\n [--debug] = debug\n [--debugX] = super debug\n [-t] = test\n [--GSM] = compress into GSM codec\n [--MP3] = compress into MPEG-Layer-3 codec\n [--OGG] = compress into OGG Vorbis codec\n\n";
exit;
}
{
print "allowed run time options:\n";
print " [--help] = this screen\n";
print " [--debug] = debug\n";
print " [--debugX] = super debug\n";
print " [-t] = test\n";
print " [--GSM] = compress into GSM codec\n";
print " [--MP3] = compress into MPEG-Layer-3 codec\n";
print " [--OGG] = compress into OGG Vorbis codec\n";
print " [--GSW] = compress into GSM codec with RIFF headers and .wav extension\n\n";
exit;
}
else
{
{
if ($args =~ /--debug/i)
{
$DB=1;
print "\n----- DEBUG -----\n\n";
}
if ($args =~ /--debugX/i)
{
$DBX=1;
print "\n----- SUPER DEBUG -----\n\n";
}
if ($args =~ /-t/i)
{
$T=1; $TEST=1;
print "\n-----TESTING -----\n\n";
}
if ($args =~ /--GSM/i)
{
$GSM=1;
if ($DB) {print "GSM compression\n";}
}
else
{
if ($args =~ /--MP3/i)
{
$MP3=1;
if ($DB) {print "MP3 compression\n";}
$DB=1;
print "\n----- DEBUG -----\n\n";
}
else
if ($args =~ /--debugX/i)
{
if ($args =~ /--OGG/i)
$DBX=1;
print "\n----- SUPER DEBUG -----\n\n";
}
if ($args =~ /-t/i)
{
$T=1; $TEST=1;
print "\n-----TESTING -----\n\n";
}
if ($args =~ /--GSM/i)
{
$GSM=1;
if ($DB) {print "GSM compression\n";}
}
else
{
if ($args =~ /--MP3/i)
{
$OGG=1;
if ($DB) {print "OGG compression\n";}
$MP3=1;
if ($DB) {print "MP3 compression\n";}
}
else
{
if ($args =~ /--OGG/i)
{
$OGG=1;
if ($DB) {print "OGG compression\n";}
}
else
{
if ($args =~ /--GSW/i)
{
$GSW=1;
if ($DB) {print "GSW compression\n";}
}
}
}
}
}
}
}
else
{
#print "no command line options set\n";
$GSM=1;
}
{
#print "no command line options set\n";
$GSM=1;
}
# default path to astguiclient configuration file:
@@ -159,7 +177,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
or die "Couldn't connect to database: " . DBI->errstr;
if ( ($GSM > 0) || ($OGG > 0) )
if ( ($GSM > 0) || ($OGG > 0) || ($GSW > 0) )
{
### find sox binary to do the compression
$soxbin = '';
@@ -170,7 +188,7 @@ if ( ($GSM > 0) || ($OGG > 0) )
else
{
print "Can't find sox binary! Exiting...\n";
exit
exit;
}
}
}
@@ -186,12 +204,15 @@ if ($MP3 > 0)
else
{
print "Can't find lame binary! Exiting...\n";
exit
exit;
}
}
}
if ($DBX > 0)
{
print "SOX: $soxbin LAME: $lamebin\n";
}
### directory where -all recordings are
$dir2 = "$PATHDONEmonitor";
@@ -203,7 +224,7 @@ opendir(FILE, "$dir2/");
### Loop through files first to gather filesizes
$i=0;
foreach(@FILES)
{
{
$FILEsize1[$i] = 0;
if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") )
{
@@ -211,7 +232,7 @@ foreach(@FILES)
if ($DBX) {print "$FILES[$i] $FILEsize1[$i]\n";}
}
$i++;
}
}
sleep(5);
@@ -290,6 +311,19 @@ foreach(@FILES)
$affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n";
}
if ($GSW > 0)
{
$GSWfile = $FILES[$i];
if ($DB) {print "|$recording_id|$ALLfile|$GSWfile| |$SQLfile|$soxbin \"$dir2/$ALLfile\" -g -b \"$dir2/GSW/$GSWfile\"|\n";}
`$soxbin "$dir2/$ALLfile" -g -b "$dir2/GSW/$GSWfile"`;
$stmtA = "UPDATE recording_log set location='http://$server_ip/RECORDINGS/GSW/$GSWfile' where recording_id='$recording_id';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n";
}
if (!$T)
{
+76 -55
View File
@@ -20,6 +20,7 @@
# --MP3 = MPEG Layer3 files
# --OGG = OGG Vorbis files
# --WAV = WAV files
# --GSW = GSM 6.10 codec with RIFF headers (.wav extension)
#
# FLAG FOR NO DATE DIRECTORY ON FTP
# --NODATEDIR
@@ -37,9 +38,10 @@
# 80302-1958 - First Build
# 80317-2349 - Added FTP debug if debugX
# 80731-2253 - Changed size comparisons for more efficiency
# 90727-1458 - Added GSW format option
#
$GSM=0; $MP3=0; $OGG=0; $WAV=0; $NODATEDIR=0;
$GSM=0; $MP3=0; $OGG=0; $WAV=0; $GSW=0; $NODATEDIR=0;
# Default variables for FTP
$VARFTP_host = '10.0.0.4';
@@ -52,77 +54,95 @@ $VARHTTP_path = 'http://10.0.0.4';
### begin parsing run-time options ###
if (length($ARGV[0])>1)
{
{
$i=0;
while ($#ARGV >= $i)
{
$args = "$args $ARGV[$i]";
$i++;
}
{
$args = "$args $ARGV[$i]";
$i++;
}
if ($args =~ /--help/i)
{
print "allowed run time options:\n [--debug] = debug\n [--debugX] = super debug\n [-t] = test\n [--GSM] = copy GSM files\n [--MP3] = copy MPEG-Layer-3 files\n [--OGG] = copy OGG Vorbis files\n [--WAV] = copy WAV files\n [--NODATEDIR] = do not put into dated directories\n\n";
exit;
}
{
print "allowed run time options:\n";
print " [--help] = this screen\n";
print " [--debug] = debug\n";
print " [--debugX] = super debug\n";
print " [-t] = test\n";
print " [--GSM] = copy GSM files\n";
print " [--MP3] = copy MPEG-Layer-3 files\n";
print " [--OGG] = copy OGG Vorbis files\n";
print " [--WAV] = copy WAV files\n";
print " [--GSW] = copy GSM with RIFF headers and .wav extension files\n";
print " [--NODATEDIR] = do not put into dated directories\n\n";
exit;
}
else
{
{
if ($args =~ /--debug/i)
{
$DB=1;
print "\n----- DEBUG -----\n\n";
}
if ($args =~ /--debugX/i)
{
$DBX=1;
print "\n----- SUPER DEBUG -----\n\n";
}
if ($args =~ /-t/i)
{
$T=1; $TEST=1;
print "\n----- TESTING -----\n\n";
}
if ($args =~ /-nodatedir/i)
{
$NODATEDIR=1;
if ($DB) {print "\n----- NO DATE DIRECTORIES -----\n\n";}
}
if ($args =~ /--GSM/i)
{
$GSM=1;
if ($DB) {print "GSM audio files\n";}
}
else
{
if ($args =~ /--MP3/i)
{
$MP3=1;
if ($DB) {print "MP3 audio files\n";}
$DB=1;
print "\n----- DEBUG -----\n\n";
}
else
if ($args =~ /--debugX/i)
{
if ($args =~ /--OGG/i)
$DBX=1;
print "\n----- SUPER DEBUG -----\n\n";
}
if ($args =~ /-t/i)
{
$T=1; $TEST=1;
print "\n----- TESTING -----\n\n";
}
if ($args =~ /-nodatedir/i)
{
$NODATEDIR=1;
if ($DB) {print "\n----- NO DATE DIRECTORIES -----\n\n";}
}
if ($args =~ /--GSM/i)
{
$GSM=1;
if ($DB) {print "GSM audio files\n";}
}
else
{
if ($args =~ /--MP3/i)
{
$OGG=1;
if ($DB) {print "OGG audio files\n";}
$MP3=1;
if ($DB) {print "MP3 audio files\n";}
}
else
else
{
if ($args =~ /--WAV/i)
if ($args =~ /--OGG/i)
{
$WAV=1;
if ($DB) {print "WAV audio files\n";}
$OGG=1;
if ($DB) {print "OGG audio files\n";}
}
else
{
if ($args =~ /--WAV/i)
{
$WAV=1;
if ($DB) {print "WAV audio files\n";}
}
else
{
if ($args =~ /--GSW/i)
{
$GSW=1;
if ($DB) {print "GSW audio files\n";}
}
}
}
}
}
}
}
}
else
{
#print "no command line options set\n";
$WAV=1;
}
{
#print "no command line options set\n";
$WAV=1;
}
# default path to astguiclient configuration file:
@@ -195,6 +215,7 @@ if ($WAV > 0) {$dir2 = "$PATHDONEmonitor";}
if ($MP3 > 0) {$dir2 = "$PATHDONEmonitor/MP3";}
if ($GSM > 0) {$dir2 = "$PATHDONEmonitor/GSM";}
if ($OGG > 0) {$dir2 = "$PATHDONEmonitor/OGG";}
if ($GSW > 0) {$dir2 = "$PATHDONEmonitor/GSW";}
opendir(FILE, "$dir2/");
@FILES = readdir(FILE);
@@ -202,7 +223,7 @@ opendir(FILE, "$dir2/");
### Loop through files first to gather filesizes
$i=0;
foreach(@FILES)
{
{
$FILEsize1[$i] = 0;
if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") )
{
@@ -210,7 +231,7 @@ foreach(@FILES)
if ($DBX) {print "$FILES[$i] $FILEsize1[$i]\n";}
}
$i++;
}
}
sleep(5);
+285
View File
@@ -0,0 +1,285 @@
#!/usr/bin/perl
#
# Vtiger_KILL_slow_queries.pl version 2.2.0
#
# DESCRIPTION:
# script kills rogue mysql SELECT queries that are launched by vtiger
#
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
#
# CHANGES
# 90727-0757 - First build
#
$secX = time();
$MT[0]='';
$Ealert='';
$importasdeleted=0;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = ($year + 1900);
$mon++;
if ($hour < 10) {$hour = "0$hour";}
if ($min < 10) {$min = "0$min";}
if ($sec < 10) {$sec = "0$sec";}
if ($mon < 10) {$mon = "0$mon";}
if ($mday < 10) {$mday = "0$mday";}
$pulldate0 = "$year-$mon-$mday $hour:$min:$sec";
$NOW_TIME = "$year-$mon-$mday $hour:$min:$sec";
$inSD = $pulldate0;
$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec );
$MT[0]='';
# default path to astguiclient configuration file:
$PATHconf = '/etc/astguiclient.conf';
open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n";
@conf = <conf>;
close(conf);
$i=0;
foreach(@conf)
{
$line = $conf[$i];
$line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi;
if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) )
{$PATHhome = $line; $PATHhome =~ s/.*=//gi;}
if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) )
{$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;}
if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) )
{$PATHagi = $line; $PATHagi =~ s/.*=//gi;}
if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) )
{$PATHweb = $line; $PATHweb =~ s/.*=//gi;}
if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) )
{$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;}
if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) )
{$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;}
if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) )
{$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) )
{$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) )
{$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) )
{$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) )
{$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) )
{$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;}
if ( ($line =~ /^VARREPORT_host/) && ($CLIREPORT_host < 1) )
{$VARREPORT_host = $line; $VARREPORT_host =~ s/.*=//gi;}
if ( ($line =~ /^VARREPORT_user/) && ($CLIREPORT_user < 1) )
{$VARREPORT_user = $line; $VARREPORT_user =~ s/.*=//gi;}
if ( ($line =~ /^VARREPORT_pass/) && ($CLIREPORT_pass < 1) )
{$VARREPORT_pass = $line; $VARREPORT_pass =~ s/.*=//gi;}
if ( ($line =~ /^VARREPORT_port/) && ($CLIREPORT_port < 1) )
{$VARREPORT_port = $line; $VARREPORT_port =~ s/.*=//gi;}
$i++;
}
# Customized Variables
$server_ip = $VARserver_ip; # Asterisk server IP
if (!$VDHLOGfile) {$VDHLOGfile = "$PATHlogs/VTkillslow.$year-$mon-$mday";}
### begin parsing run-time options ###
if (length($ARGV[0])>1)
{
$i=0;
while ($#ARGV >= $i)
{
$args = "$args $ARGV[$i]";
$i++;
}
if ($args =~ /--help|-h/i)
{
print "allowed run time options:\n";
print " [-h] = this help screen\n\n";
print " [-q] = quiet\n";
print " [-t] = test\n";
print " [--debug] = debug output\n";
print " [--slow-seconds=X] = this allows you to override the default slow seconds of 60\n\n";
print "\n";
print "This script finds all SELECT queries running on the database and kills the SELECT queries running more than X seconds\n\n";
exit;
}
else
{
if ($args =~ /-debug/i)
{
$DB=1;
print "\n----- DEBUGGING -----\n\n";
}
if ($args =~ /-debugX/i)
{
$DBX=1;
print "\n----- SUPER-DUPER DEBUGGING -----\n\n";
}
else {$DBX=0;}
if ($args =~ /-q/i)
{
$q=1;
}
if ($args =~ /-t/i)
{
$T=1;
$TEST=1;
if ($q < 1) {print "\n----- TESTING -----\n\n";}
}
if ($args =~ /--slow-seconds=/i)
{
@data_in = split(/--slow-seconds=/,$args);
$slow_seconds = $data_in[1];
$slow_seconds =~ s/ .*//gi;
if ($q < 1) {print "\n----- SLOW SECONDS OVERRIDE: $slow_seconds -----\n\n";}
}
else
{$slow_seconds = '';}
}
}
else
{
print "no command line options set\n";
$args = "";
$i=0;
$slow_seconds='60';
}
### end parsing run-time options ###
if ($q < 1)
{
print "\n\n\n\n\n\n\n\n\n\n\n\n-- Vtiger_KILL_slow_queries.pl --\n\n";
print "This program is designed to kill slow SELECT queries launched from the Vtiger system. \n\n";
}
$i=0;
$US = '_';
$phone_list = '|';
$DASH='-';
$noacct=0;
if (!$VARDB_port) {$VARDB_port='3306';}
use DBI;
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
or die "Couldn't connect to database: " . DBI->errstr;
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmtA = "SELECT use_non_latin,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass FROM system_settings;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$non_latin = "$aryA[0]";
$vtiger_server_ip = "$aryA[1]";
$vtiger_dbname = "$aryA[2]";
$vtiger_login = "$aryA[3]";
$vtiger_pass = "$aryA[4]";
}
$sthA->finish();
##### END SETTINGS LOOKUP #####
###########################################
$dbhB = DBI->connect("DBI:mysql:$vtiger_dbname:$vtiger_server_ip:$VARDB_port", "$vtiger_login", "$vtiger_pass")
or die "Couldn't connect to database: " . DBI->errstr;
if ($non_latin > 0) {$affected_rows = $dbhA->do("SET NAMES 'UTF8'");}
# Get current crm ID, date and description from vtiger_account
$stmtB="SHOW FULL PROCESSLIST;";
if($DB){print STDERR "\n|$stmtB|\n";}
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
$sthBrows=$sthB->rows;
if($DB){print STDERR "\n|$sthBrows records|\n";}
$i=0;
while ($sthBrows > $i)
{
@aryB = $sthB->fetchrow_array;
$id[$i] = $aryB[0];
$user[$i] = $aryB[1];
$host[$i] = $aryB[2];
$db[$i] = $aryB[3];
$command[$i] = $aryB[4];
$time[$i] = $aryB[5];
$state[$i] = $aryB[6];
$info[$i] = $aryB[7];
if ($DBX > 0)
{
if ($command[$i] !~ /^Sleep$/i)
{print "$aryB[0]|$aryB[1]|$aryB[2]|$aryB[3]|$aryB[4]|$aryB[5]|$aryB[6]|$aryB[7]\n";}
}
$i++;
}
$sthB->finish();
$i=0;
while ($sthBrows > $i)
{
if ( ($db[$i] =~ /vtiger/i) && ($info[$i] =~ /^SELECT /i) && ($time[$i] >= $slow_seconds) )
{
if ($DB > 0) {print "Killing process $id[$i], it has been running for $time[$i] seconds\n";}
if ($DBX > 0) {print " STATE:\n$state[$i]\n";}
if ($DBX > 0) {print " INFO:\n$info[$i]\n";}
if ($DBX > 0) {print " QUERY:\n$command[$i]\n";}
### kill process ###
$stmtB = "KILL $id[$i];";
if (!$T) {$affected_rows = $dbhB->do($stmtB); } # or die "Couldn't execute query: |$stmtB|\n";
if($DB){print STDERR "\n|$affected_rows|$stmtB|\n";}
### open the log file for writing ###
open(out, ">>$VDHLOGfile")
|| die "Can't open $VDHLOGfile: $!\n";
print out "DATETIME: $NOW_TIME\n";
print out "ID: $id[$i]\n";
print out "USER: $user[$i]\n";
print out "HOST: $host[$i]\n";
print out "DB: $db[$i]\n";
print out "COMMAND: $command[$i]\n\n";
print out "TIME: $time[$i]\n";
print out "STATE: $state[$i]\n";
print out "INFO: $info[$i]\n";
close(out);
chmod 0777, "$VDHLOGfile";
$Tattempt++;
}
$i++;
}
$Falert = "\n\nTOTALS:\n";
$Falert .= "Queries: $i\n";
$Falert .= "Kills: $Tattempt\n";
if ($DB > 0) {print "$Falert";}
$dbhA->disconnect();
### calculate time to run script ###
$secY = time();
$secZ = ($secY - $secX);
$secZm = ($secZ /60);
if ($q < 1)
{
print "script execution time in seconds: $secZ minutes: $secZm\n";
}
exit;
+29
View File
@@ -318,3 +318,32 @@ ALTER TABLE vicidial_users ADD allow_alerts ENUM('0','1') default '0';
UPDATE vicidial_users SET alert_enabled='0';
UPDATE system_settings SET db_schema_version='1164';
CREATE TABLE vtiger_rank_data (
account VARCHAR(20) PRIMARY KEY NOT NULL,
seqacct VARCHAR(20) UNIQUE NOT NULL,
last_attempt_days SMALLINT(5) UNSIGNED NOT NULL,
orders SMALLINT(5) NOT NULL,
net_sales SMALLINT(5) NOT NULL,
net_sales_ly SMALLINT(5) NOT NULL,
percent_variance SMALLINT(5) NOT NULL,
imu SMALLINT(5) NOT NULL,
aov SMALLINT(5) NOT NULL,
returns SMALLINT(5) NOT NULL,
rank SMALLINT(5) NOT NULL
);
CREATE TABLE vtiger_rank_parameters (
parameter_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
parameter VARCHAR(20) NOT NULL,
lower_range VARCHAR(20) NOT NULL,
upper_range VARCHAR(20) NOT NULL,
points SMALLINT(5) NOT NULL,
index (parameter)
);
UPDATE system_settings SET db_schema_version='1165';
+2
View File
@@ -18,6 +18,7 @@
# 90210-0319 - Added option to prompt for Asterisk version
# 90312-1256 - Added CLI flag for automatic configuration
# 90620-1910 - Added check before creating directories and formatting changes
# 90727-1457 - Added GSW directory creation
#
############################################
@@ -2180,6 +2181,7 @@ if ($WEBONLY < 1)
if (!-e "$PATHDONEmonitor/GSM") {`mkdir -p $PATHDONEmonitor/GSM`;}
if (!-e "$PATHDONEmonitor/MP3") {`mkdir -p $PATHDONEmonitor/MP3`;}
if (!-e "$PATHDONEmonitor/OGG") {`mkdir -p $PATHDONEmonitor/OGG`;}
if (!-e "$PATHDONEmonitor/GSW") {`mkdir -p $PATHDONEmonitor/GSW`;}
if (!-e "$PATHDONEmonitor/FTP") {`mkdir -p $PATHDONEmonitor/FTP`;}
print "Creating $PATHlogs/archive directory for backups...\n";
+31 -5
View File
@@ -10,10 +10,11 @@
# CHANGES
# 90520-1928 - first build
# 90717-0651 - Added batch
# 90726-2302 - Added vicidial_list update option
#
$version = '2.2.0-2';
$build = '90520-1928';
$version = '2.2.0-3';
$build = '90726-2302';
$MT[0]='';
@@ -36,6 +37,8 @@ if (isset($_GET["accountid"])) {$accountid=$_GET["accountid"];}
elseif (isset($_POST["accountid"])) {$accountid=$_POST["accountid"];}
if (isset($_GET["batch"])) {$batch=$_GET["batch"];}
elseif (isset($_POST["batch"])) {$batch=$_POST["batch"];}
if (isset($_GET["vl_owner"])) {$vl_owner=$_GET["vl_owner"];}
elseif (isset($_POST["vl_owner"])) {$vl_owner=$_POST["vl_owner"];}
if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];}
@@ -67,7 +70,7 @@ if ($ss_conf_ct > 0)
###########################################
### check if sounds server matches this server IP, if not then exit with an error
if ($user_territories_active < 1)
{
echo "ERROR: User Territories are not active on this system\n";
@@ -171,6 +174,11 @@ if ( ($action == "CHANGE_TERRITORY_OWNER_ACCOUNT") and ($enable_vtiger_integrati
echo "$users_list";
echo "</select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Update ViciDial List Owner: </td><td align=left><select size=1 name=vl_owner>\n";
echo "<option SELECTED>YES</option>\n";
echo "<option>NO</option>\n";
echo "</select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=SUBMIT value=SUBMIT></td></tr>\n";
echo "</TABLE></center>\n";
exit;
@@ -238,6 +246,11 @@ if ( ($action == "PROCESS_CHANGE_TERRITORY_OWNER_ACCOUNT") and ($enable_vtiger_i
$stmtB="UPDATE vtiger_tracker SET user_id='$user_id' where item_id='$accountid';";
$rsltV=mysql_query($stmtB, $linkV);
if ( ($vl_owner == 'YES') and ($accountid > 0) )
{
$stmtB="UPDATE vicidial_list SET owner='$user' where vendor_lead_code='$accountid';";
$rsltV=mysql_query($stmtB, $link);
}
echo "Vtiger Territory Owner Changed: $user $territory<BR>\n";
echo "Records Changed: $changed<BR>\n";
@@ -373,6 +386,11 @@ if ( ($action == "CHANGE_TERRITORY_OWNER") and ($enable_vtiger_integration > 0)
echo "$users_list";
echo "</select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Update ViciDial List Owner: </td><td align=left><select size=1 name=vl_owner>\n";
echo "<option SELECTED>YES</option>\n";
echo "<option>NO</option>\n";
echo "</select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=SUBMIT value=SUBMIT></td></tr>\n";
echo "</TABLE></center>\n";
}
@@ -465,6 +483,15 @@ if ( ($action == "PROCESS_CHANGE_TERRITORY_OWNER") and ($enable_vtiger_integrati
$r++;
}
if ( ($vl_owner == 'YES') and ($account_ids[$p] > 0) )
{
$stmtB="UPDATE vicidial_list SET owner='$user' where vendor_lead_code='$account_ids[$p]';";
$rslt=mysql_query($stmtB, $link);
$VchangedX = mysql_affected_rows($link);
if ($DB) {echo "$stmtB|$VchangedX\n";}
$Vchanged = ($Vchanged + $VchangedX);
}
$p++;
}
@@ -477,8 +504,7 @@ if ( ($action == "PROCESS_CHANGE_TERRITORY_OWNER") and ($enable_vtiger_integrati
$stmtB="UPDATE vtiger_tracker vt, vtiger_account va SET user_id='$user_id' where vt.item_id=va.accountid and va.tickersymbol='$territory';";
$rsltV=mysql_query($stmtB, $linkV);
echo "Vtiger Territory Owner Changed: $user $territory &nbsp; &nbsp; &nbsp; Records Changed: $changed - $Achanged - $Cchanged<BR>\n";
echo "Vtiger Territory Owner Changed: $user $territory &nbsp; &nbsp; &nbsp; Records Changed: $changed - $Achanged - $Cchanged - $Vchanged<BR>\n";
### LOG INSERTION Admin Log Table ###
$SQL_log = "$stmt|$stmtB|";