Added optional GPG audio recording encryption.
Added option to use RECID as a recording filename variable. git-svn-id: svn://192.168.202.10@2378 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -141,6 +141,11 @@ OTHER CHANGES:
|
||||
30. Added new User Group options for Allowed Reports to control the Report Page
|
||||
Servers Summary and the Admin Utilities Page
|
||||
|
||||
31. Added optional GPG audio recording encryption.
|
||||
|
||||
32. Added option to use RECID as a recording filename variable.
|
||||
NOTE: Cannot be used as the ONLY variable for recording filename
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# agi-NVA_recording.agi version 2.10
|
||||
# agi-NVA_recording.agi version 2.12
|
||||
#
|
||||
# This script is designed to give recording ability to agents not the using
|
||||
# ViciDial agent screen
|
||||
@@ -11,21 +11,26 @@
|
||||
# ; 4. log this call in call_log (Y|N) default N, ONLY NEEDED FOR INBOUND AND INTERSYSTEM CALLS!!!
|
||||
# ; 5. audio record this call (Y|N) default N
|
||||
# ; 6. double-log this call in call_log (Y|N) default N, ONLY NEEDED FOR INBOUND CALLMENU FORWARDED CALLS!!!
|
||||
# ; 7. play the recording ID of this call before recording starts
|
||||
# ; 8. include the recording ID in the filename
|
||||
#
|
||||
# ;custom dialplan entry example: (similar to the defaultlog Call Menu)
|
||||
#exten => _X.,1,AGI(agi-NVA_recording.agi,BOTH------Y---N---Y---N)
|
||||
#exten => _X.,1,AGI(agi-NVA_recording.agi,BOTH------Y---N---Y---N---N---N)
|
||||
#exten => _X.,n,Goto(default,${EXTEN},1)
|
||||
#exten => _X.,n,Hangup
|
||||
#
|
||||
# ;inbound to agent example:
|
||||
#exten => 5678,1,AGI(agi-NVA_recording.agi,BOTH------Y---Y---Y---N)
|
||||
#exten => 5678,1,AGI(agi-NVA_recording.agi,BOTH------Y---Y---Y---N---N---N)
|
||||
#exten => 5678,n,Goto(vicidial-auto,5678,1)
|
||||
#exten => 5678,n,Hangup
|
||||
#
|
||||
# ; example of dial prefix of 94 in System Settings Custom Dialplan to default log
|
||||
#exten => _941NXXNXXXXXX,1,Goto(defaultlog,9${EXTEN:2},1)
|
||||
#
|
||||
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# ; example of using as Call Menu prompt to record with playing of recording id
|
||||
#agi-NVA_recording.agi,BOTH------Y---N---Y---N---Y---Y
|
||||
#
|
||||
# Copyright (C) 2015 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGELOG
|
||||
# 91105-1402 - First build
|
||||
@@ -34,6 +39,7 @@
|
||||
# 130108-1811 - Changes for Asterisk 1.8 compatibility
|
||||
# 130326-1510 - Added lead_id and user logging from vicidial values
|
||||
# 141124-2309 - Fixed Fhour variable bug
|
||||
# 150915-1824 - Added recording ID play and filename options
|
||||
#
|
||||
|
||||
&get_time_now;
|
||||
@@ -135,6 +141,8 @@ if (length($ARGV[0])>1)
|
||||
$log_call = $ARGV_vars[3];
|
||||
$record_call = $ARGV_vars[4];
|
||||
$double_log = $ARGV_vars[5];
|
||||
$play_recid = $ARGV_vars[6];
|
||||
$file_recid = $ARGV_vars[7];
|
||||
|
||||
if ($AGI_output =~ /STDERR/) {$AGILOG = '1';}
|
||||
if ($AGI_output =~ /FILE/) {$AGILOG = '2';}
|
||||
@@ -246,6 +254,32 @@ if ($record_call =~ /Y/)
|
||||
$filename =~ s/\"|\'//gi;
|
||||
### code to record call goes here ###
|
||||
|
||||
### insert record into recording_log table ###
|
||||
$stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,length_in_sec,filename,lead_id,user,location,vicidial_id) values('$channel','$VARserver_ip','$extension','$now_date','$start_epoch','0','$filename','$lead_id','$accountcode','$filename','$unique_id');";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;";
|
||||
$sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtB ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$recording_id = $aryA[0];
|
||||
}
|
||||
|
||||
if ($file_recid =~ /Y/)
|
||||
{
|
||||
$filename .= "$US$recording_id";
|
||||
|
||||
$stmtA = "UPDATE recording_log SET filename='$filename',location='$filename' where recording_id='$recording_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
}
|
||||
if ($play_recid =~ /Y/)
|
||||
{
|
||||
$AGI->stream_file('id_number');
|
||||
$AGI->say_digits("$recording_id");
|
||||
}
|
||||
|
||||
%ast_ver_str = parse_asterisk_version($asterisk_version);
|
||||
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
|
||||
{
|
||||
@@ -256,9 +290,6 @@ if ($record_call =~ /Y/)
|
||||
$AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$filename");
|
||||
}
|
||||
|
||||
### insert record into recording_log table ###
|
||||
$stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,length_in_sec,filename,lead_id,user,location,vicidial_id) values('$channel','$VARserver_ip','$extension','$now_date','$start_epoch','0','$filename','$lead_id','$accountcode','$filename','$unique_id');";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
}
|
||||
|
||||
### if set to user log this call, insert user_call_log entry ###
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#
|
||||
# This program assumes that recordings are saved by Asterisk as .wav
|
||||
#
|
||||
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2015 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
#
|
||||
# 80302-1958 - First Build
|
||||
@@ -37,6 +37,7 @@
|
||||
#
|
||||
|
||||
$GSM=0; $MP3=0; $OGG=0; $GSW=0;
|
||||
$maxfiles = 100000;
|
||||
|
||||
### begin parsing run-time options ###
|
||||
if (length($ARGV[0])>1)
|
||||
@@ -59,7 +60,9 @@ 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 " [--run-check] = concurrency check, die if another instance is running\n\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";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@@ -84,6 +87,12 @@ if (length($ARGV[0])>1)
|
||||
$run_check=1;
|
||||
if ($DB) {print "\n----- CONCURRENCY CHECK -----\n\n";}
|
||||
}
|
||||
if ($args =~ /--max-files=/i)
|
||||
{
|
||||
@data_in = split(/--max-files=/,$args);
|
||||
$maxfiles = $data_in[1];
|
||||
$maxfiles =~ s/ .*$//gi;
|
||||
}
|
||||
if ($args =~ /--GSM/i)
|
||||
{
|
||||
$GSM=1;
|
||||
@@ -262,12 +271,11 @@ 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]") )
|
||||
if ( ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") ) && ($maxfiles > $i) )
|
||||
{
|
||||
|
||||
$FILEsize2[$i] = (-s "$dir1/$FILES[$i]");
|
||||
if ($DBX) {print "$FILES[$i] $FILEsize2[$i]\n\n";}
|
||||
|
||||
|
||||
@@ -0,0 +1,365 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# AST_CRON_audio_2_encrypt.pl
|
||||
#
|
||||
# This is a STEP-2 program in the audio archival process(should happen AFTER any compression)
|
||||
#
|
||||
# runs every 3 minutes and encrypts the recording files to GPG format by default
|
||||
#
|
||||
# put an entry into the cron of of your asterisk machine to run this script
|
||||
# every 3 minutes or however often you desire
|
||||
#
|
||||
# You MUST define the type of audio file that this process will pull from: WAV, GSM, MP3, OGG, GSW
|
||||
#
|
||||
# ### recording mixing/compressing/encrypting/ftping scripts
|
||||
##0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /usr/share/astguiclient/AST_CRON_audio_1_move_mix.pl
|
||||
# 0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /usr/share/astguiclient/AST_CRON_audio_1_move_VDonly.pl
|
||||
# 1,4,7,10,13,16,19,22,25,28,31,34,37,40,43,46,49,52,55,58 * * * * /usr/share/astguiclient/AST_CRON_audio_2_compress.pl --GSM
|
||||
# 2,5,8,11,14,17,20,23,26,29,32,35,38,41,44,47,50,53,56,59 * * * * /usr/share/astguiclient/AST_CRON_audio_2_encrypt.pl --GPG --GSM --recipients=gpg@vicidial.com
|
||||
# 0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /usr/share/astguiclient/AST_CRON_audio_3_ftp.pl --GPG
|
||||
#
|
||||
# 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
|
||||
#
|
||||
#
|
||||
# 150911-1814 - First Build based upon 110524-1059 AST_CRON_audio_2_compress.pl
|
||||
#
|
||||
|
||||
$WAV=0; $GSM=0; $MP3=0; $OGG=0; $GSW=0;
|
||||
$GPG=0;
|
||||
|
||||
### begin parsing run-time options ###
|
||||
if (length($ARGV[0])>1)
|
||||
{
|
||||
$i=0;
|
||||
while ($#ARGV >= $i)
|
||||
{
|
||||
$args = "$args $ARGV[$i]";
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($args =~ /--help/i)
|
||||
{
|
||||
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 " [--GPG] = encrypt into GPG codec\n";
|
||||
print " [--WAV] = look for uncompressed WAV files\n";
|
||||
print " [--GSM] = look for already compressed GSM files\n";
|
||||
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 " [--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";
|
||||
print " NOTE: all recipients must be loaded into keys on local server and accessible to gpg binary\n";
|
||||
print "\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 =~ /--run-check/i)
|
||||
{
|
||||
$run_check=1;
|
||||
if ($DB) {print "\n----- CONCURRENCY CHECK -----\n\n";}
|
||||
}
|
||||
if ($args =~ /--recipients=/i)
|
||||
{
|
||||
@data_in = split(/--recipients=/,$args);
|
||||
$CLIrecipient = $data_in[1];
|
||||
$CLIrecipient =~ s/ .*$//gi;
|
||||
if ($DB) {print "\n----- RECIPIENTS: $CLIrecipient -----\n\n";}
|
||||
if ($CLIrecipient =~ /---/)
|
||||
{
|
||||
$CLIrecipient =~ s/---/ --recipient /gi;
|
||||
}
|
||||
}
|
||||
else
|
||||
{print "ERROR: recipient is required, exiting..."; exit;}
|
||||
if ($args =~ /--max-files=/i)
|
||||
{
|
||||
@data_in = split(/--max-files=/,$args);
|
||||
$maxfiles = $data_in[1];
|
||||
$maxfiles =~ s/ .*$//gi;
|
||||
$maxfiles = ($maxfiles + 2); # account for directory lists
|
||||
}
|
||||
else
|
||||
{$maxfiles = 100000;}
|
||||
if ($DB) {print "\n----- MAX FILES: $maxfiles -----\n\n";}
|
||||
if ($args =~ /--GPG/i)
|
||||
{
|
||||
$GPG=1;
|
||||
if ($DB) {print "GPG encryption\n";}
|
||||
}
|
||||
else
|
||||
{
|
||||
$GPG=1;
|
||||
if ($DB) {print "Defaulting to use GPG encryption\n";}
|
||||
}
|
||||
if ($args =~ /--WAV/i)
|
||||
{
|
||||
$WAV=1;
|
||||
if ($DB) {print "WAV compression\n";}
|
||||
}
|
||||
else
|
||||
{
|
||||
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";}
|
||||
}
|
||||
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 "ERROR: no audio format defined, exiting..."; exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "ERROR: cannot run script without any command line options, exiting..."; exit;
|
||||
}
|
||||
|
||||
|
||||
# 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 =~ /^PATHDONEmonitor/) && ($CLIDONEmonitor < 1) )
|
||||
{$PATHDONEmonitor = $line; $PATHDONEmonitor =~ 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 =~ /^VARFTP_host/) && ($CLIFTP_host < 1) )
|
||||
{$VARFTP_host = $line; $VARFTP_host =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARFTP_user/) && ($CLIFTP_user < 1) )
|
||||
{$VARFTP_user = $line; $VARFTP_user =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARFTP_pass/) && ($CLIFTP_pass < 1) )
|
||||
{$VARFTP_pass = $line; $VARFTP_pass =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARFTP_port/) && ($CLIFTP_port < 1) )
|
||||
{$VARFTP_port = $line; $VARFTP_port =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARFTP_dir/) && ($CLIFTP_dir < 1) )
|
||||
{$VARFTP_dir = $line; $VARFTP_dir =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARHTTP_path/) && ($CLIHTTP_path < 1) )
|
||||
{$VARHTTP_path = $line; $VARHTTP_path =~ s/.*=//gi;}
|
||||
$i++;
|
||||
}
|
||||
|
||||
### concurrency check
|
||||
if ($run_check > 0)
|
||||
{
|
||||
my $grepout = `/bin/ps ax | grep $0 | grep -v grep | grep -v '/bin/sh'`;
|
||||
my $grepnum=0;
|
||||
$grepnum++ while ($grepout =~ m/\n/g);
|
||||
if ($grepnum > 1)
|
||||
{
|
||||
if ($DB) {print "I am not alone! Another $0 is running! Exiting...\n";}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Customized Variables
|
||||
$server_ip = $VARserver_ip; # Asterisk server IP
|
||||
if (!$VARDB_port) {$VARDB_port='3306';}
|
||||
|
||||
use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second
|
||||
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;
|
||||
|
||||
|
||||
if ($GPG > 0)
|
||||
{
|
||||
### find GnuPG encryption binary to do the encryption
|
||||
$gpgbin = '';
|
||||
if ( -e ('/usr/bin/gpg')) {$gpgbin = '/usr/bin/gpg';}
|
||||
else
|
||||
{
|
||||
if ( -e ('/usr/local/bin/gpg')) {$gpgbin = '/usr/local/bin/gpg';}
|
||||
else
|
||||
{
|
||||
print "Can't find gpg binary! Exiting...\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
### directory where -all recordings are
|
||||
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";}
|
||||
|
||||
if ($DBX > 0)
|
||||
{
|
||||
print "GPG: $gpgbin DIR: $dir2\n";
|
||||
}
|
||||
|
||||
if (!-e "$PATHDONEmonitor/GPG")
|
||||
{
|
||||
print "Creating directory: $PATHDONEmonitor/GPG \n";
|
||||
`mkdir -p $PATHDONEmonitor/GPG`;
|
||||
}
|
||||
|
||||
opendir(FILE, "$dir2/");
|
||||
@FILES = readdir(FILE);
|
||||
|
||||
|
||||
### Loop through files first to gather filesizes
|
||||
$i=0;
|
||||
foreach(@FILES)
|
||||
{
|
||||
$FILEsize1[$i] = 0;
|
||||
if ( (length($FILES[$i]) > 4) && (!-d "$dir2/$FILES[$i]") )
|
||||
{
|
||||
$FILEsize1[$i] = (-s "$dir2/$FILES[$i]");
|
||||
if ($DBX) {print "$FILES[$i] $FILEsize1[$i]\n";}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
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 "$dir2/$FILES[$i]") && ($maxfiles > $i) )
|
||||
{
|
||||
$FILEsize2[$i] = (-s "$dir2/$FILES[$i]");
|
||||
if ($DBX) {print "$FILES[$i] $FILEsize2[$i]\n\n";}
|
||||
|
||||
if ( ($FILES[$i] !~ /out\.|in\.|lost\+found/i) && ($FILEsize1[$i] eq $FILEsize2[$i]) && (length($FILES[$i]) > 4))
|
||||
{
|
||||
$recording_id='';
|
||||
$ALLfile = $FILES[$i];
|
||||
$SQLFILE = $FILES[$i];
|
||||
$SQLFILE =~ s/-all\.wav|-all\.gsm|-all\.mp3|-all\.gsw|-all\.ogg//gi;
|
||||
|
||||
$stmtA = "select recording_id from recording_log where filename='$SQLFILE' order by recording_id desc LIMIT 1;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$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;
|
||||
$recording_id = "$aryA[0]";
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
|
||||
if ($GPG > 0)
|
||||
{
|
||||
$GPGfile = $FILES[$i];
|
||||
$GPGfile =~ s/-all\.wav/-all.wav.gpg/gi;
|
||||
$GPGfile =~ s/-all\.gsm/-all.gsm.gpg/gi;
|
||||
$GPGfile =~ s/-all\.mp3/-all.mp3.gpg/gi;
|
||||
$GPGfile =~ s/-all\.gsw/-all.gsw.gpg/gi;
|
||||
$GPGfile =~ s/-all\.ogg/-all.ogg.gpg/gi;
|
||||
|
||||
if ($DB) {print "$i|$recording_id|$ALLfile|$GPGfile| |$SQLfile|\n";}
|
||||
|
||||
`$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';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n";
|
||||
}
|
||||
|
||||
|
||||
if (!$T)
|
||||
{
|
||||
`rm -f "$dir2/$ALLfile"`;
|
||||
}
|
||||
|
||||
### sleep for twenty hundredths of a second to not flood the server with disk activity
|
||||
usleep(1*200*1000);
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($DB) {print "DONE... EXITING\n\n";}
|
||||
|
||||
$dbhA->disconnect();
|
||||
|
||||
|
||||
exit;
|
||||
@@ -21,6 +21,7 @@
|
||||
# --OGG = OGG Vorbis files
|
||||
# --WAV = WAV files
|
||||
# --GSW = GSM 6.10 codec with RIFF headers (.wav extension)
|
||||
# --GPG = GnuPG encrypted audio files
|
||||
#
|
||||
# FLAG FOR NO DATE DIRECTORY ON FTP
|
||||
# --NODATEDIR
|
||||
@@ -32,7 +33,7 @@
|
||||
#
|
||||
# This program assumes that recordings are saved by Asterisk as .wav
|
||||
#
|
||||
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2015 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
#
|
||||
# 80302-1958 - First Build
|
||||
@@ -48,6 +49,7 @@
|
||||
# 111128-1615 - Added Ftp persistence option
|
||||
# 111130-1751 - Added Ftp validate option
|
||||
# 130116-1536 - Added ftp port CLI flag
|
||||
# 150911-2336 - Added GPG encrypted audio file compatibility
|
||||
#
|
||||
|
||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||
@@ -60,7 +62,7 @@ if ($mon < 10) {$mon = "0$mon";}
|
||||
if ($mday < 10) {$mday = "0$mday";}
|
||||
$FTPdate = "$year-$mon-$mday";
|
||||
|
||||
$GSM=0; $MP3=0; $OGG=0; $WAV=0; $GSW=0; $NODATEDIR=0;
|
||||
$GSM=0; $MP3=0; $OGG=0; $WAV=0; $GSW=0; $GPG=0; $NODATEDIR=0;
|
||||
|
||||
# Default variables for FTP
|
||||
$VARFTP_host = '10.0.0.4';
|
||||
@@ -100,8 +102,10 @@ if (length($ARGV[0])>1)
|
||||
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 " [--GPG] = copy GPG encrypted files\n";
|
||||
print " [--nodatedir] = do not put into dated directories\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 " [--ftp-server=XXX] = FTP server\n";
|
||||
print " [--ftp-port=XXX] = FTP server port\n";
|
||||
print " [--ftp-login=XXX] = FTP server login account\n";
|
||||
@@ -186,6 +190,14 @@ if (length($ARGV[0])>1)
|
||||
$GSW=1;
|
||||
if ($DB) {print "GSW audio files\n";}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($args =~ /--GPG/i)
|
||||
{
|
||||
$GPG=1;
|
||||
if ($DB) {print "GPG encrypted audio files\n";}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -341,6 +353,7 @@ if ($MP3 > 0) {$dir2 = "$PATHDONEmonitor/MP3";}
|
||||
if ($GSM > 0) {$dir2 = "$PATHDONEmonitor/GSM";}
|
||||
if ($OGG > 0) {$dir2 = "$PATHDONEmonitor/OGG";}
|
||||
if ($GSW > 0) {$dir2 = "$PATHDONEmonitor/GSW";}
|
||||
if ($GPG > 0) {$dir2 = "$PATHDONEmonitor/GPG";}
|
||||
|
||||
opendir(FILE, "$dir2/");
|
||||
@FILES = readdir(FILE);
|
||||
@@ -390,6 +403,7 @@ foreach(@FILES)
|
||||
$recording_id='';
|
||||
$ALLfile = $FILES[$i];
|
||||
$SQLFILE = $FILES[$i];
|
||||
$SQLFILE =~ s/\.gpg//gi;
|
||||
$SQLFILE =~ s/-all\.wav|-all\.gsm|-all\.ogg|-all\.mp3//gi;
|
||||
|
||||
$stmtA = "select recording_id,start_time from recording_log where filename='$SQLFILE' order by recording_id desc LIMIT 1;";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# AST_CRON_audio_3_newftp.pl version 2.4
|
||||
# AST_CRON_audio_3_newftp.pl version 2.12
|
||||
#
|
||||
# This is a STEP-3 program in the audio archival process. Normally you can run it
|
||||
# every 3 minutes and copies the recording files to an FTP server.
|
||||
@@ -20,6 +20,7 @@
|
||||
# --ogg or --OGG = OGG Vorbis files
|
||||
# --wav or --WAV = WAV files
|
||||
# --gsw or --GSW = GSM 6.10 codec with RIFF headers (.wav extension)
|
||||
# --gpg or --GPG = GnuPG encrypted files
|
||||
#
|
||||
# FLAGS FOR PING SETTINGS
|
||||
# --ping-type = The type of ping to send. Options are "none", "tcp", "udp", "icmp",
|
||||
@@ -52,11 +53,12 @@
|
||||
# --ftp-host="10.10.10.15" --ftp-port=21 --ftp-user="username" --ftp-pass="password" --ftp-dir="RECORDINGS" \
|
||||
# --url-path="http://10.10.10.15/RECORDINGS" --transfer-limit=50 --list-limit=200 --campaign_id="TESTCAMP1-TESTCAMP2"
|
||||
#
|
||||
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2015 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGELOG:
|
||||
# 90930-1405 - mikec - first build
|
||||
# 110524-1054 - Added run-check concurrency check option
|
||||
# 150912-0837 - Added GPG encrypted audio file compatibility
|
||||
#
|
||||
|
||||
use 5.008;
|
||||
@@ -181,6 +183,7 @@ if (length($ARGV[0])>1) {
|
||||
print " [--ogg or --OGG] = copy OGG Vorbis files\n";
|
||||
print " [--wav or --WAV] = copy WAV files\n";
|
||||
print " [--gsw or --GSW] = copy GSM 6.10 codec with RIFF headers (.wav extension)\n";
|
||||
print " [--gpg or --GPG] = copy GPG encrypted files\n";
|
||||
print " [--ping-type] = The type of ping to send. Options are \"none\", \"tcp\", \"udp\", \"icmp\", \n";
|
||||
print " \"stream\", \"syn\", and \"external\". None disables pinging. Default is \"icmp\"\n";
|
||||
print " WARNING setting --ping-type=\"none\" can lead to files being \"transfer\"\n";
|
||||
@@ -199,7 +202,8 @@ if (length($ARGV[0])>1) {
|
||||
print " [--campaign_id] = which OUTBOUND campaigns to transfer files for in a '-' delimited list \n";
|
||||
print " (this only works for outbound calls, not inbound or transfers)\n";
|
||||
print " [--ingroup_id] = which ingroups to transfer files for in a '-' delimited list\n";
|
||||
print " WARNING you can only set --campaign_id or --ingroup_id, not both.\n\n";
|
||||
print " WARNING you can only set --campaign_id or --ingroup_id, not both.\n";
|
||||
print "\n";
|
||||
exit;
|
||||
} else {
|
||||
if ($args =~ /--debug/i) {
|
||||
@@ -355,6 +359,13 @@ if (length($ARGV[0])>1) {
|
||||
if ($debug) {
|
||||
print "GSW audio files\n";
|
||||
}
|
||||
} else {
|
||||
if ( ($args =~ /--GPG/i) || ($args =~ /--gpg/i) ) {
|
||||
$trans_type="gpg";
|
||||
if ($debug) {
|
||||
print "GPG compressed files\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -423,6 +434,7 @@ if ($trans_type eq "gsw") {$directory = "$PATHDONEmonitor/GSW";}
|
||||
if ($trans_type eq "gsm") {$directory = "$PATHDONEmonitor/GSM";}
|
||||
if ($trans_type eq "ogg") {$directory = "$PATHDONEmonitor/OGG";}
|
||||
if ($trans_type eq "mp3") {$directory = "$PATHDONEmonitor/MP3";}
|
||||
if ($trans_type eq "gpg") {$directory = "$PATHDONEmonitor/GPG";}
|
||||
|
||||
|
||||
opendir(FILE, "$directory/");
|
||||
@@ -490,6 +502,7 @@ foreach(@files) {
|
||||
my $vicidial_id = '';
|
||||
my $ALLfile = $files[$file_loop_count];
|
||||
my $SQLFILE = $files[$file_loop_count];
|
||||
$SQLFILE =~ s/\.gpg//gi;
|
||||
$SQLFILE =~ s/-all\.wav|-all\.gsm|-all\.ogg|-all\.mp3//gi;
|
||||
|
||||
my $rec_log_db_stmt = "select recording_id, start_time, vicidial_id, lead_id from recording_log where filename=$SQLFILE order by recording_id desc LIMIT 1;";
|
||||
@@ -592,7 +605,7 @@ foreach(@files) {
|
||||
|
||||
my $update_log_db_stmt = "UPDATE recording_log set location='$url_path/$start_date_PATH$ALLfile' where recording_id='$recording_id';";
|
||||
if($debug){print STDERR "\n|$update_log_db_stmt|\n";}
|
||||
my $affected_rows = $update_log_sth->execute('$url_path/$start_date_PATH$ALLfile',$recording_id)
|
||||
my $affected_rows = $update_log_sth->execute("$url_path/$start_date_PATH$ALLfile",$recording_id)
|
||||
or die "executing: $rec_log_db_stmt ", $dbhA->errstr;
|
||||
|
||||
if (!$test) {
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
#
|
||||
# This program assumes that recordings are saved by Asterisk as .wav
|
||||
#
|
||||
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2015 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
#
|
||||
# CHANGES:
|
||||
# 91123-0005 - First Build
|
||||
# 110524-1052 - Added run-check concurrency check option
|
||||
# 111128-1617 - Added Ftp persistence option
|
||||
@@ -330,6 +330,7 @@ foreach(@FILES)
|
||||
$recording_id='';
|
||||
$ALLfile = $FILES[$i];
|
||||
$SQLFILE = $FILES[$i];
|
||||
$SQLFILE =~ s/\.gpg//gi;
|
||||
$SQLFILE =~ s/-all\.wav|-all\.gsm|-all\.ogg|-all\.mp3//gi;
|
||||
|
||||
$stmtA = "select recording_id,start_time from recording_log where filename='$SQLFILE' order by recording_id desc LIMIT 1;";
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
#
|
||||
# This program assumes that recordings are saved by Asterisk as .wav
|
||||
#
|
||||
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2015 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
#
|
||||
# CHANGES:
|
||||
# 130730-1849 - First Build based upon AST_CRON_audio_4_ftp2.pl script
|
||||
#
|
||||
|
||||
@@ -339,7 +339,6 @@ foreach(@FILES)
|
||||
|
||||
if ( (length($FILES[$i]) > 4) && (!-d "$dir2/$FILES[$i]") )
|
||||
{
|
||||
|
||||
$FILEsize2[$i] = (-s "$dir2/$FILES[$i]");
|
||||
if ($DBX) {print "$dir2/$FILES[$i] $FILEsize2[$i]\n\n";}
|
||||
|
||||
@@ -353,6 +352,7 @@ foreach(@FILES)
|
||||
$recording_id='';
|
||||
$ALLfile = $FILES[$i];
|
||||
$SQLFILE = $FILES[$i];
|
||||
$SQLFILE =~ s/\.gpg//gi;
|
||||
$SQLFILE =~ s/-all\.wav|-all\.gsm|-all\.ogg|-all\.mp3//gi;
|
||||
|
||||
$stmtA = "select recording_id,start_time from recording_log where filename='$SQLFILE' order by recording_id desc LIMIT 1;";
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
# 150115-0657 - Changes to save custom.css customizations, issue #816
|
||||
# 150302-0706 - Removed path changes for non-English languages
|
||||
# 150312-0942 - Added ExpectedDBSchema value in astguiclient.conf
|
||||
# 150911-1808 - Added creation of GPG directory for encrypted recordings
|
||||
#
|
||||
|
||||
############################################
|
||||
@@ -2497,6 +2498,7 @@ if ($WEBONLY < 1)
|
||||
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/GPG") {`mkdir -p $PATHDONEmonitor/GPG`;}
|
||||
if (!-e "$PATHDONEmonitor/FTP") {`mkdir -p $PATHDONEmonitor/FTP`;}
|
||||
if (!-e "$PATHDONEmonitor/FTP2") {`mkdir -p $PATHDONEmonitor/FTP2`;}
|
||||
|
||||
|
||||
@@ -126,13 +126,14 @@
|
||||
# 150307-1837 - Added leave 3way custom sound context
|
||||
# 150701-1208 - Modified mysqli_error() to mysqli_connect_error() where appropriate
|
||||
# 150723-1643 - Added ajax logging
|
||||
# 150915-2039 - Added option for RECID as variable in recording filename
|
||||
#
|
||||
|
||||
$version = '2.12-73';
|
||||
$build = '150723-1643';
|
||||
$version = '2.12-74';
|
||||
$build = '150915-2039';
|
||||
$php_script = 'manager_send.php';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=129;
|
||||
$mysql_log_count=132;
|
||||
$one_mysql_log=0;
|
||||
$SSagent_debug_logging=0;
|
||||
$startMS = microtime();
|
||||
@@ -2040,48 +2041,75 @@ if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") )
|
||||
}
|
||||
if ($channel_live==1)
|
||||
{
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02067',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
if ($ACTION=="Monitor")
|
||||
if ( ($ACTION=="Monitor") and (preg_match("/RECID/",$filename) ) )
|
||||
{
|
||||
$stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02068',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02130',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$recording_id = mysqli_insert_id($link);
|
||||
|
||||
$stmt="SELECT recording_id FROM recording_log where filename='$filename'";
|
||||
$filename = preg_replace("/RECID/","$recording_id",$filename);
|
||||
|
||||
$stmt = "UPDATE recording_log SET filename='$filename' where recording_id='$recording_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02069',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$recording_id = $row[0];
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02131',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
$SQLfile = "File: $filename";
|
||||
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02132',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
echo _QXZ("%1s command sent for Channel %2s on %3s",0,'',$ACTION,$channel,$server_ip)."\nFilename: $filename\nRecorDing_ID: $recording_id\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'";
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02070',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rec_count = mysqli_num_rows($rslt);
|
||||
if ($rec_count>0)
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02067',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
if ($ACTION=="Monitor")
|
||||
{
|
||||
$stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02068',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
$stmt="SELECT recording_id FROM recording_log where filename='$filename'";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02069',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$recording_id = $row[0];
|
||||
$start_time = $row[1];
|
||||
$length_in_sec = ($StarTtime - $start_time);
|
||||
$length_in_min = ($length_in_sec / 60);
|
||||
$length_in_min = sprintf("%8.2f", $length_in_min);
|
||||
|
||||
$stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02071',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02070',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rec_count = mysqli_num_rows($rslt);
|
||||
if ($rec_count>0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$recording_id = $row[0];
|
||||
$start_time = $row[1];
|
||||
$length_in_sec = ($StarTtime - $start_time);
|
||||
$length_in_min = ($length_in_sec / 60);
|
||||
$length_in_min = sprintf("%8.2f", $length_in_min);
|
||||
|
||||
$stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02071',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
echo _QXZ("%1s command sent for Channel %2s on %3s",0,'',$ACTION,$channel,$server_ip)."\nFilename: $filename\nRecorDing_ID: $recording_id\n";
|
||||
}
|
||||
echo _QXZ("%1s command sent for Channel %2s on %3s",0,'',$ACTION,$channel,$server_ip)."\nFilename: $filename\nRecorDing_ID: $recording_id\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2111,21 +2139,47 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") )
|
||||
|
||||
if ($ACTION=="MonitorConf")
|
||||
{
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02072',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
$stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02073',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$RLaffected_rows = mysqli_affected_rows($link);
|
||||
if ($RLaffected_rows > 0)
|
||||
if (preg_match("/RECID/",$filename) )
|
||||
{
|
||||
$recording_id = mysqli_insert_id($link);
|
||||
}
|
||||
$stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02133',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$RLaffected_rows = mysqli_affected_rows($link);
|
||||
if ($RLaffected_rows > 0)
|
||||
{
|
||||
$recording_id = mysqli_insert_id($link);
|
||||
}
|
||||
|
||||
$filename = preg_replace("/RECID/","$recording_id",$filename);
|
||||
|
||||
$stmt = "UPDATE recording_log SET filename='$filename' where recording_id='$recording_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02134',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02135',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02072',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
$stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02073',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$RLaffected_rows = mysqli_affected_rows($link);
|
||||
if ($RLaffected_rows > 0)
|
||||
{
|
||||
$recording_id = mysqli_insert_id($link);
|
||||
}
|
||||
}
|
||||
if ($FROMvdc=='YES')
|
||||
{
|
||||
##### update vla record with recording_id
|
||||
|
||||
@@ -3586,12 +3586,13 @@ else
|
||||
# 150903-1457 - Added options for encrypt hosted features
|
||||
# 150909-0158 - Added Report Page Servers Summary and Admin Utilities Page options for User Group Allowed Reports
|
||||
# 150909-1418 - Added $active_only_default_campaigns options.php option for Campaigns Listings
|
||||
# 150915-2113 - Added x_ra_carrier module option
|
||||
#
|
||||
|
||||
# make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time
|
||||
|
||||
$admin_version = '2.12-508a';
|
||||
$build = '150909-1418';
|
||||
$admin_version = '2.12-509a';
|
||||
$build = '150915-2113';
|
||||
|
||||
$STARTtime = date("U");
|
||||
$SQLdate = date("Y-m-d H:i:s");
|
||||
@@ -3753,6 +3754,9 @@ else
|
||||
$admin_lists_custom = 'admin_lists_custom.php';
|
||||
if (preg_match("/cf_encrypt/",$SSactive_modules))
|
||||
{$admin_lists_custom = 'admin_lists_custom_encrypt.php';}
|
||||
$x_ra_carrier = 0;
|
||||
if (preg_match("/x_ra_carrier/",$SSactive_modules))
|
||||
{$x_ra_carrier = 1;}
|
||||
|
||||
##############################################
|
||||
# Include QC Agents with no other permission #
|
||||
@@ -6684,7 +6688,7 @@ if ($ADD==1711)
|
||||
|
||||
if ($ADD==11111)
|
||||
{
|
||||
if ($LOGmodify_remoteagents==1)
|
||||
if ( ($LOGmodify_remoteagents==1) and ($x_ra_carrier < 1) )
|
||||
{
|
||||
echo "<TABLE><TR><TD>\n";
|
||||
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
|
||||
@@ -7364,7 +7368,7 @@ if ($ADD==131111111111)
|
||||
|
||||
if ($ADD==141111111111)
|
||||
{
|
||||
if ( ($LOGmodify_servers==1) or ($LOGmodify_carriers==1) )
|
||||
if ( ( ($LOGmodify_servers==1) or ($LOGmodify_carriers==1) ) and ($x_ra_carrier < 1) )
|
||||
{
|
||||
echo "<TABLE><TR><TD>\n";
|
||||
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
|
||||
@@ -7424,7 +7428,7 @@ if ($ADD==141111111111)
|
||||
|
||||
if ($ADD==140111111111)
|
||||
{
|
||||
if ( ($LOGmodify_servers==1) or ($LOGmodify_carriers==1) )
|
||||
if ( ( ($LOGmodify_servers==1) or ($LOGmodify_carriers==1) ) and ($x_ra_carrier < 1) )
|
||||
{
|
||||
echo "<TABLE><TR><TD>\n";
|
||||
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
|
||||
@@ -9905,7 +9909,7 @@ if ($ADD==2711)
|
||||
|
||||
if ($ADD==21111)
|
||||
{
|
||||
if ( ($add_copy_disabled > 0) or ($LOGmodify_remoteagents!='1') )
|
||||
if ( ($add_copy_disabled > 0) or ($LOGmodify_remoteagents!='1') or ($x_ra_carrier > 0) )
|
||||
{
|
||||
echo "<br>"._QXZ("You do not have permission to add records on this system")." -system_settings-\n";
|
||||
}
|
||||
@@ -10863,7 +10867,7 @@ if ($ADD==231111111111)
|
||||
|
||||
if ($ADD==241111111111)
|
||||
{
|
||||
if ($add_copy_disabled > 0)
|
||||
if ( ($add_copy_disabled > 0) or ($x_ra_carrier > 0) )
|
||||
{
|
||||
echo "<br>"._QXZ("You do not have permission to add records on this system")." -system_settings-\n";
|
||||
}
|
||||
@@ -27196,7 +27200,7 @@ if ($ADD==3511)
|
||||
|
||||
if ($ADD==31111)
|
||||
{
|
||||
if ($LOGmodify_remoteagents==1)
|
||||
if ( ($LOGmodify_remoteagents==1) and ($x_ra_carrier < 1) )
|
||||
{
|
||||
if ( ($SSadmin_modify_refresh > 1) and ($modify_refresh_set < 1) )
|
||||
{
|
||||
@@ -29731,7 +29735,7 @@ if ($ADD==331111111111)
|
||||
|
||||
if ($ADD==341111111111)
|
||||
{
|
||||
if ( ($LOGast_admin_access==1) or ($LOGmodify_carriers==1) )
|
||||
if ( ( ($LOGast_admin_access==1) or ($LOGmodify_carriers==1) ) and ($x_ra_carrier < 1) )
|
||||
{
|
||||
if ( ($SSadmin_modify_refresh > 1) and ($modify_refresh_set < 1) )
|
||||
{
|
||||
|
||||
@@ -1300,7 +1300,7 @@ if ($SSoutbound_autodial_active > 0)
|
||||
<BR>
|
||||
<A NAME="campaigns-campaign_rec_filename">
|
||||
<BR>
|
||||
<B><?php echo _QXZ("Campaign Rec Filename"); ?> -</B><?php echo _QXZ("This field allows you to customize the name of the recording when Campaign recording is ONDEMAND or ALLCALLS. The allowed variables are CAMPAIGN INGROUP CUSTPHONE FULLDATE TINYDATE EPOCH AGENT VENDORLEADCODE LEADID CALLID. The default is FULLDATE_AGENT and would look like this 20051020-103108_6666. Another example is CAMPAIGN_TINYDATE_CUSTPHONE which would look like this TESTCAMP_51020103108_3125551212. Te resulting filename must be less than 90 characters in length."); ?>
|
||||
<B><?php echo _QXZ("Campaign Rec Filename"); ?> -</B><?php echo _QXZ("This field allows you to customize the name of the recording when Campaign recording is ONDEMAND or ALLCALLS. The allowed variables are CAMPAIGN INGROUP CUSTPHONE FULLDATE TINYDATE EPOCH AGENT VENDORLEADCODE LEADID CALLID RECID. The default is FULLDATE_AGENT and would look like this 20051020-103108_6666. Another example is CAMPAIGN_TINYDATE_CUSTPHONE which would look like this TESTCAMP_51020103108_3125551212. Te resulting filename must be less than 90 characters in length."); ?>
|
||||
|
||||
<BR>
|
||||
<A NAME="campaigns-allcalls_delay">
|
||||
@@ -2585,7 +2585,7 @@ if ($SSqc_features_active > 0)
|
||||
<BR>
|
||||
<A NAME="inbound_groups-ingroup_rec_filename">
|
||||
<BR>
|
||||
<B><?php echo _QXZ("In-Group Recording Filename"); ?> -</B><?php echo _QXZ("This field will override the Campaign Recording Filenaming Scheme unless it is set to NONE. The allowed variables are CAMPAIGN INGROUP CUSTPHONE FULLDATE TINYDATE EPOCH AGENT VENDORLEADCODE LEADID CALLID. The default is FULLDATE_AGENT and would look like this 20051020-103108_6666. Another example is CAMPAIGN_TINYDATE_CUSTPHONE which would look like this TESTCAMP_51020103108_3125551212. Te resulting filename must be less than 90 characters in length. Default is NONE.");
|
||||
<B><?php echo _QXZ("In-Group Recording Filename"); ?> -</B><?php echo _QXZ("This field will override the Campaign Recording Filenaming Scheme unless it is set to NONE. The allowed variables are CAMPAIGN INGROUP CUSTPHONE FULLDATE TINYDATE EPOCH AGENT VENDORLEADCODE LEADID CALLID RECID. The default is FULLDATE_AGENT and would look like this 20051020-103108_6666. Another example is CAMPAIGN_TINYDATE_CUSTPHONE which would look like this TESTCAMP_51020103108_3125551212. Te resulting filename must be less than 90 characters in length. Default is NONE.");
|
||||
|
||||
if ($SSqc_features_active > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user