For all AST_CRON_audio step 1 and 2 scripts, added --HTTPS option to use https instead of http in local location
git-svn-id: svn://192.168.202.10@2539 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -25,14 +25,17 @@
|
||||
# This program assumes that recordings are saved by Asterisk as .wav
|
||||
# should be easy to change this code if you use .gsm instead
|
||||
#
|
||||
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2016 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
#
|
||||
# 80302-1958 - First Build
|
||||
# 80731-2253 - Changed size comparisons for more efficiency
|
||||
# 130805-1450 - Added check for length and gather length of recording for database record
|
||||
# 160523-0654 - Added --HTTPS option to use https instead of http in local location
|
||||
#
|
||||
|
||||
$HTTPS=0;
|
||||
|
||||
### begin parsing run-time options ###
|
||||
if (length($ARGV[0])>1)
|
||||
{
|
||||
@@ -45,11 +48,22 @@ if (length($ARGV[0])>1)
|
||||
|
||||
if ($args =~ /--help/i)
|
||||
{
|
||||
print "allowed run time options:\n [--debug] = debug\n [--debugX] = super debug\n [-t] = test\n\n";
|
||||
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 " [--HTTPS] = use https instead of http in local location\n";
|
||||
print "\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($args =~ /--HTTPS/i)
|
||||
{
|
||||
$HTTPS=1;
|
||||
if ($DB) {print "HTTPS location option enabled\n";}
|
||||
}
|
||||
if ($args =~ /--debug/i)
|
||||
{
|
||||
$DB=1;
|
||||
@@ -237,7 +251,9 @@ foreach(@FILES)
|
||||
$lengthSQL = ",length_in_sec='$soxi_sec',length_in_min='$soxi_min'";
|
||||
}
|
||||
|
||||
$stmtA = "UPDATE recording_log set location='http://$server_ip/RECORDINGS/$ALLfile' $lengthSQL where recording_id='$recording_id';";
|
||||
$HTTP='http';
|
||||
if ($HTTPS > 0) {$HTTP='https';}
|
||||
$stmtA = "UPDATE recording_log set location='$HTTP://$server_ip/RECORDINGS/$ALLfile' $lengthSQL 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";
|
||||
|
||||
|
||||
@@ -32,10 +32,12 @@
|
||||
# 91105-1353 - Added --MIX option to only check the /var/spool/asterisk/monitor/MIX directory
|
||||
# 130805-1450 - Added check for length and gather length of recording for database record
|
||||
# 160501-1001 - Added --SPHINX options to check for SPHINX audio files
|
||||
# 160523-0650 - Added --HTTPS option to use https instead of http in local location
|
||||
#
|
||||
|
||||
$MIX=0;
|
||||
$SPHINX=0;
|
||||
$HTTPS=0;
|
||||
|
||||
### begin parsing run-time options ###
|
||||
if (length($ARGV[0])>1)
|
||||
@@ -55,6 +57,7 @@ if (length($ARGV[0])>1)
|
||||
print " [-t] = test\n";
|
||||
print " [--MIX] = mix audio files in MIX directory\n";
|
||||
print " [--SPHINX] = mix audio files in SPHINX/RAW directory\n";
|
||||
print " [--HTTPS] = use https instead of http in local location\n";
|
||||
print "\n";
|
||||
exit;
|
||||
}
|
||||
@@ -85,6 +88,11 @@ if (length($ARGV[0])>1)
|
||||
$SPHINX=1;
|
||||
if ($DB) {print "SPHINX directory audio processing only\n";}
|
||||
}
|
||||
if ($args =~ /--HTTPS/i)
|
||||
{
|
||||
$HTTPS=1;
|
||||
if ($DB) {print "HTTPS location option enabled\n";}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -279,7 +287,9 @@ foreach(@FILES)
|
||||
$lengthSQL = ",length_in_sec='$soxi_sec',length_in_min='$soxi_min'";
|
||||
}
|
||||
|
||||
$stmtA = "UPDATE recording_log set location='http://$server_ip/RECORDINGS/$ALLfile' $lengthSQL where recording_id='$recording_id';";
|
||||
$HTTP='http';
|
||||
if ($HTTPS > 0) {$HTTP='https';}
|
||||
$stmtA = "UPDATE recording_log set location='$HTTP://$server_ip/RECORDINGS/$ALLfile' $lengthSQL 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";
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#
|
||||
# This program assumes that recordings are saved by Asterisk as .wav
|
||||
#
|
||||
# Copyright (C) 2015 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2016 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
#
|
||||
# 80302-1958 - First Build
|
||||
@@ -34,9 +34,11 @@
|
||||
# 90727-1417 - Added GSW format option
|
||||
# 101207-1024 - Change to GSW option because of SoX flag changes in 14.3.0
|
||||
# 110524-1059 - Added run-check concurrency check option
|
||||
# 160523-0652 - Added --HTTPS option to use https instead of http in local location
|
||||
#
|
||||
|
||||
$GSM=0; $MP3=0; $OGG=0; $GSW=0;
|
||||
$HTTPS=0;
|
||||
$maxfiles = 100000;
|
||||
|
||||
### begin parsing run-time options ###
|
||||
@@ -60,6 +62,7 @@ if (length($ARGV[0])>1)
|
||||
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";
|
||||
print " [--HTTPS] = use https instead of http in local location\n";
|
||||
print " [--run-check] = concurrency check, die if another instance is running\n";
|
||||
print " [--max-files=x] = maximum number of files to process, default is 100000\n";
|
||||
print "\n";
|
||||
@@ -93,6 +96,11 @@ if (length($ARGV[0])>1)
|
||||
$maxfiles = $data_in[1];
|
||||
$maxfiles =~ s/ .*$//gi;
|
||||
}
|
||||
if ($args =~ /--HTTPS/i)
|
||||
{
|
||||
$HTTPS=1;
|
||||
if ($DB) {print "HTTPS location option enabled\n";}
|
||||
}
|
||||
if ($args =~ /--GSM/i)
|
||||
{
|
||||
$GSM=1;
|
||||
@@ -298,6 +306,8 @@ foreach(@FILES)
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
$HTTP='http';
|
||||
if ($HTTPS > 0) {$HTTP='https';}
|
||||
|
||||
if ($GSM > 0)
|
||||
{
|
||||
@@ -308,7 +318,7 @@ foreach(@FILES)
|
||||
|
||||
`$soxbin "$dir2/$ALLfile" "$dir2/GSM/$GSMfile"`;
|
||||
|
||||
$stmtA = "UPDATE recording_log set location='http://$server_ip/RECORDINGS/GSM/$GSMfile' where recording_id='$recording_id';";
|
||||
$stmtA = "UPDATE recording_log set location='$HTTP://$server_ip/RECORDINGS/GSM/$GSMfile' 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";
|
||||
}
|
||||
@@ -322,7 +332,7 @@ foreach(@FILES)
|
||||
|
||||
`$soxbin "$dir2/$ALLfile" "$dir2/OGG/$OGGfile"`;
|
||||
|
||||
$stmtA = "UPDATE recording_log set location='http://$server_ip/RECORDINGS/OGG/$OGGfile' where recording_id='$recording_id';";
|
||||
$stmtA = "UPDATE recording_log set location='$HTTP://$server_ip/RECORDINGS/OGG/$OGGfile' 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";
|
||||
}
|
||||
@@ -336,7 +346,7 @@ foreach(@FILES)
|
||||
|
||||
`$lamebin -b 16 -m m --silent "$dir2/$ALLfile" "$dir2/MP3/$MP3file"`;
|
||||
|
||||
$stmtA = "UPDATE recording_log set location='http://$server_ip/RECORDINGS/MP3/$MP3file' where recording_id='$recording_id';";
|
||||
$stmtA = "UPDATE recording_log set location='$HTTP://$server_ip/RECORDINGS/MP3/$MP3file' 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";
|
||||
}
|
||||
@@ -352,7 +362,7 @@ foreach(@FILES)
|
||||
# for SoX versions 14.3.0 and after
|
||||
`$soxbin "$dir2/$ALLfile" -e gsm-full-rate "$dir2/GSW/$GSWfile"`;
|
||||
|
||||
$stmtA = "UPDATE recording_log set location='http://$server_ip/RECORDINGS/GSW/$GSWfile' where recording_id='$recording_id';";
|
||||
$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";
|
||||
}
|
||||
|
||||
@@ -21,14 +21,16 @@
|
||||
# FLAGS FOR ENCRYPTION OPTIONS
|
||||
# --GPG = GnuPG encryption(assumes recipient public keys are loaded on server)
|
||||
#
|
||||
# Copyright (C) 2015 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2016 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
#
|
||||
# 150911-1814 - First Build based upon 110524-1059 AST_CRON_audio_2_compress.pl
|
||||
# 160523-0651 - Added --HTTPS option to use https instead of http in local location
|
||||
#
|
||||
|
||||
$WAV=0; $GSM=0; $MP3=0; $OGG=0; $GSW=0;
|
||||
$GPG=0;
|
||||
$HTTPS=0;
|
||||
|
||||
### begin parsing run-time options ###
|
||||
if (length($ARGV[0])>1)
|
||||
@@ -53,6 +55,7 @@ if (length($ARGV[0])>1)
|
||||
print " [--MP3] = look for already compressed MPEG-Layer-3 files\n";
|
||||
print " [--OGG] = look for already compressed OGG Vorbis files\n";
|
||||
print " [--GSW] = look for already compressed GSM codec with RIFF headers and .wav extension files\n";
|
||||
print " [--HTTPS] = use https instead of http in local location\n";
|
||||
print " [--run-check] = concurrency check, die if another instance is running\n";
|
||||
print " [--max-files=x] = maximum number of files to process, defaults to 100000\n";
|
||||
print " [--recipients=x\@y.com---z\@a.net] = encryption recipients addresses, REQUIRED\n";
|
||||
@@ -115,6 +118,11 @@ if (length($ARGV[0])>1)
|
||||
$GPG=1;
|
||||
if ($DB) {print "Defaulting to use GPG encryption\n";}
|
||||
}
|
||||
if ($args =~ /--HTTPS/i)
|
||||
{
|
||||
$HTTPS=1;
|
||||
if ($DB) {print "HTTPS location option enabled\n";}
|
||||
}
|
||||
if ($args =~ /--WAV/i)
|
||||
{
|
||||
$WAV=1;
|
||||
@@ -325,6 +333,8 @@ foreach(@FILES)
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
$HTTP='http';
|
||||
if ($HTTPS > 0) {$HTTP='https';}
|
||||
|
||||
if ($GPG > 0)
|
||||
{
|
||||
@@ -339,7 +349,7 @@ foreach(@FILES)
|
||||
|
||||
`$gpgbin --trust-model always --output $PATHDONEmonitor/GPG/$GPGfile --encrypt --recipient $CLIrecipient $dir2/$ALLfile`;
|
||||
|
||||
$stmtA = "UPDATE recording_log set location='http://$server_ip/RECORDINGS/GPG/$GPGfile' where recording_id='$recording_id';";
|
||||
$stmtA = "UPDATE recording_log set location='$HTTP://$server_ip/RECORDINGS/GPG/$GPGfile' 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";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user