backporting of features from trunk(2.0.5)
git-svn-id: svn://192.168.202.10@817 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -4,6 +4,34 @@ NOTE: Upgrading from 2.0.2 to 2.0.3 is below the first section
|
||||
NOTE: Upgrading from 2.0.1 to 2.0.2 is in the middle section
|
||||
NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom
|
||||
|
||||
########## UPGRADING FROM 2.0.4 TO 2.0.4.1 ##########
|
||||
|
||||
1. install new files:
|
||||
perl ./install.pl
|
||||
NOTES: If you have customized any scripts in the bin or agi folders,
|
||||
then make sure you back them up before running the install.pl script.
|
||||
This script will replace existing files in the astguiclient installation.
|
||||
|
||||
2. NO DATABASE UPDATES NEEDED FROM 2.0.4 RELEASE
|
||||
|
||||
3. Audio recording mixing/compression/ftping scripts have been completely
|
||||
rewritten and separated into different scripts for better fault
|
||||
tolerance. Also, you have the option of compression in to the following
|
||||
formats: WAV, GSM, MP3 and OGG
|
||||
- AST_CRON_audio_1_move_mix.pl
|
||||
- AST_CRON_audio_1_move_VDonly.pl
|
||||
- AST_CRON_audio_2_compress.pl
|
||||
- AST_CRON_audio_3_ftp.pl
|
||||
|
||||
4. Created a new script to backup a VICIDIAL setup, including the Asterisk conf
|
||||
files, prompt recordings, bin, agi and web files:
|
||||
ADMIN_backup.pl
|
||||
|
||||
5. Several bug fixes in agent logging and Remote Agents functions
|
||||
|
||||
6. Added ip_relay to allow for loopback IAX trunks that make true blind monitoring possible for all agents no matter their phone type 0860XXXX.
|
||||
|
||||
|
||||
########## UPGRADING FROM 2.0.3 TO 2.0.4 ##########
|
||||
|
||||
1. install new files:
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# agi-record_prompts.agi version 0.2
|
||||
# agi-record_prompts.agi version 2.0.4.1
|
||||
#
|
||||
# for recording prompts to GSM file over the phone
|
||||
# Saves recordings with 8-digit filenames to be played when exten is dialed
|
||||
#
|
||||
# ; prompt recording AGI script, ID is 4321
|
||||
# ; prompts for recording AGI script, ID is 4321
|
||||
# ; first variable is format (gsm/wav)
|
||||
# ; second variable is timeout in milliseconds (default is 360000 [6 minutes])
|
||||
# exten => 8167,1,Answer
|
||||
# exten => 8167,2,AGI(agi-record_prompts.agi,wav-----360000)
|
||||
# exten => 8167,3,Hangup
|
||||
# exten => 8168,1,Answer
|
||||
# exten => 8168,2,AGI(agi-record_prompts.agi)
|
||||
# exten => 8168,2,AGI(agi-record_prompts.agi,gsm-----360000)
|
||||
# exten => 8168,3,Hangup
|
||||
#
|
||||
# ; playback of recorded prompts
|
||||
@@ -24,12 +29,34 @@
|
||||
# - vm-msgsaved
|
||||
# - vm-goodbye
|
||||
#
|
||||
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
# CHANGELOG
|
||||
# 71226-1303 - Added option to change format GSM/WAV and timeout through flags
|
||||
#
|
||||
|
||||
$US='_';
|
||||
|
||||
use Asterisk::AGI;
|
||||
$AGI = new Asterisk::AGI;
|
||||
|
||||
### begin parsing run-time options ###
|
||||
if (length($ARGV[0])>1)
|
||||
{
|
||||
$i=0;
|
||||
while ($#ARGV >= $i)
|
||||
{
|
||||
$args = "$args $ARGV[$i]";
|
||||
$i++;
|
||||
}
|
||||
|
||||
### list of command-line array arguments:
|
||||
@ARGV_vars = split(/-----/, $ARGV[0]);
|
||||
|
||||
$format = $ARGV_vars[0];
|
||||
$timeout = $ARGV_vars[1];
|
||||
}
|
||||
|
||||
$|=1;
|
||||
while(<STDIN>) {
|
||||
chomp;
|
||||
@@ -46,6 +73,10 @@ while(<STDIN>) {
|
||||
|
||||
}
|
||||
|
||||
if ($format =~ /WAV/i) {$format = 'wav';}
|
||||
else {$format = 'gsm';}
|
||||
|
||||
if ($timeout < 1) {$timeout = 360000;} # default is 6 minutes
|
||||
|
||||
$unique_id_out = $unique_id;
|
||||
@NEW_ID = split(/\./, $unique_id_out);
|
||||
@@ -162,7 +193,7 @@ $AGI->stream_file('beep');
|
||||
$digit='';
|
||||
$interrupt_digit='';
|
||||
|
||||
$interrupt_digit = $AGI->record_file("$session_recording", 'gsm', '123456789*#', 360000, 1);
|
||||
$interrupt_digit = $AGI->record_file("$session_recording", "$format", '123456789*#', "$timeout", 1);
|
||||
|
||||
print STDERR "interrupt_digit |$interrupt_digit|\n";
|
||||
|
||||
|
||||
@@ -0,0 +1,315 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# ADMIN_backup.pl version 2.0.4
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Backs-up the asterisk database, conf/agi/sounds/bin files
|
||||
#
|
||||
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
# CHANGELOG
|
||||
#
|
||||
# 80316-2211 - First Build
|
||||
# 80317-1609 - Added Sangoma conf file backup and changed FTP settings
|
||||
# 80328-0135 - Do not attempt to archive /etc/my.cnf is --without-db flag is set
|
||||
#
|
||||
|
||||
|
||||
$secT = time();
|
||||
$secX = time();
|
||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||
$year = ($year + 1900);
|
||||
$mon++;
|
||||
if ($mon < 10) {$mon = "0$mon";}
|
||||
if ($mday < 10) {$mday = "0$mday";}
|
||||
if ($hour < 10) {$Fhour = "0$hour";}
|
||||
if ($min < 10) {$min = "0$min";}
|
||||
if ($sec < 10) {$sec = "0$sec";}
|
||||
$file_date = "$year-$mon-$mday";
|
||||
$now_date = "$year-$mon-$mday $hour:$min:$sec";
|
||||
$VDL_date = "$year-$mon-$mday 00:00:01";
|
||||
|
||||
### 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 " [--all] = *DEFAULT* show GMT offset of records as they are inserted into hopper\n";
|
||||
print " [--db-only] = only backup the database\n";
|
||||
print " [--conf-only] = only backup the asterisk conf files\n";
|
||||
print " [--without-db] = do not backup the database\n";
|
||||
print " [--without-conf] = do not backup the conf files\n";
|
||||
print " [--without-web] = do not backup web files\n";
|
||||
print " [--without-sounds] = do not backup asterisk sounds\n";
|
||||
print " [--ftp-transfer] = Transfer backup to FTP server\n";
|
||||
print " [--debugX] = super debug\n";
|
||||
print " [--debug] = debug\n";
|
||||
print " [-t] = test\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($args =~ /--debug/i)
|
||||
{
|
||||
$DB=1; $FTPdebug=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 =~ /--db-only/i)
|
||||
{
|
||||
$db_only=1;
|
||||
print "\n----- Backup Database Only -----\n\n";
|
||||
}
|
||||
if ($args =~ /--conf-only/i)
|
||||
{
|
||||
$conf_only=1;
|
||||
print "\n----- Conf Files Backup Only -----\n\n";
|
||||
}
|
||||
if ($args =~ /--without-db/i)
|
||||
{
|
||||
$without_db=1;
|
||||
print "\n----- No Database Backup -----\n\n";
|
||||
}
|
||||
if ($args =~ /--without-conf/i)
|
||||
{
|
||||
$without_conf=1;
|
||||
print "\n----- No Conf Files Backup -----\n\n";
|
||||
}
|
||||
if ($args =~ /--without-sounds/i)
|
||||
{
|
||||
$without_sounds=1;
|
||||
print "\n----- No Sounds Backup -----\n\n";
|
||||
}
|
||||
if ($args =~ /--without-web/i)
|
||||
{
|
||||
$without_web=1;
|
||||
print "\n----- No web files Backup -----\n\n";
|
||||
}
|
||||
if ($args =~ /--ftp-transfer/i)
|
||||
{
|
||||
$ftp_transfer=1;
|
||||
print "\n----- FTP transfer -----\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "no command line options set\n";
|
||||
}
|
||||
|
||||
# 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 =~ /^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;}
|
||||
if ( ($line =~ /^VARREPORT_dir/) && ($CLIREPORT_dir < 1) )
|
||||
{$VARREPORT_dir = $line; $VARREPORT_dir =~ s/.*=//gi;}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (!$ARCHIVEpath) {$ARCHIVEpath = "$PATHlogs/archive";}
|
||||
if (!$VARDB_port) {$VARDB_port='3306';}
|
||||
|
||||
### find tar binary to do the archiving
|
||||
$tarbin = '';
|
||||
if ( -e ('/usr/bin/tar')) {$tarbin = '/usr/bin/tar';}
|
||||
else
|
||||
{
|
||||
if ( -e ('/usr/local/bin/tar')) {$tarbin = '/usr/local/bin/tar';}
|
||||
else
|
||||
{
|
||||
if ( -e ('/bin/tar')) {$tarbin = '/bin/tar';}
|
||||
else
|
||||
{
|
||||
print "Can't find tar binary! Exiting...\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
### find gzip binary to do the archiving
|
||||
$gzipbin = '';
|
||||
if ( -e ('/usr/bin/gzip')) {$gzipbin = '/usr/bin/gzip';}
|
||||
else
|
||||
{
|
||||
if ( -e ('/usr/local/bin/gzip')) {$gzipbin = '/usr/local/bin/gzip';}
|
||||
else
|
||||
{
|
||||
if ( -e ('/bin/gzip')) {$gzipbin = '/bin/gzip';}
|
||||
else
|
||||
{
|
||||
print "Can't find gzip binary! Exiting...\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
### find mysqldump binary to do the database dump
|
||||
$mysqldumpbin = '';
|
||||
if ( -e ('/usr/bin/mysqldump')) {$mysqldumpbin = '/usr/bin/mysqldump';}
|
||||
else
|
||||
{
|
||||
if ( -e ('/usr/local/mysql/bin/mysqldump')) {$mysqldumpbin = '/usr/local/mysql/bin/mysqldump';}
|
||||
else
|
||||
{
|
||||
if ( -e ('/bin/mysqldump')) {$mysqldumpbin = '/bin/mysqldump';}
|
||||
else
|
||||
{
|
||||
print "Can't find mysqldump binary! Exiting...\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$conf='_CONF_';
|
||||
$sangoma='_SANGOMA_';
|
||||
$linux='_LINUX_';
|
||||
$bin='_BIN_';
|
||||
$web='_WEB_';
|
||||
$sounds='_SOUNDS_';
|
||||
$all='_ALL_';
|
||||
$tar='.tar';
|
||||
$gz='.gz';
|
||||
$sgSTRING='';
|
||||
|
||||
`cd $ARCHIVEpath`;
|
||||
`mkdir $ARCHIVEpath/temp`;
|
||||
|
||||
if ( ($without_db < 1) && ($conf_only < 1) )
|
||||
{
|
||||
### BACKUP THE MYSQL FILES ON THE DB SERVER ###
|
||||
`$mysqldumpbin --lock-tables --flush-logs $VARDB_database | $gzipbin > $ARCHIVEpath/temp/$VARserver_ip$VARDB_database$wday.gz`;
|
||||
}
|
||||
|
||||
if ( ($without_conf < 1) && ($db_only < 1) )
|
||||
{
|
||||
### BACKUP THE ASTERISK CONF FILES ON THE SERVER ###
|
||||
`$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$conf$wday$tar /etc/astguiclient.conf /etc/zaptel.conf /etc/asterisk`;
|
||||
|
||||
### BACKUP THE WANPIPE CONF FILES(if there are any) ###
|
||||
if ( -e ('/etc/wanpipe/wanpipe1.conf'))
|
||||
{
|
||||
$sgSTRING = '/etc/wanpipe/wanpipe1.conf ';
|
||||
if ( -e ('/etc/wanpipe/wanpipe2.conf')) {$sgSTRING .= '/etc/wanpipe/wanpipe2.conf ';}
|
||||
if ( -e ('/etc/wanpipe/wanpipe3.conf')) {$sgSTRING .= '/etc/wanpipe/wanpipe3.conf ';}
|
||||
if ( -e ('/etc/wanpipe/wanpipe4.conf')) {$sgSTRING .= '/etc/wanpipe/wanpipe4.conf ';}
|
||||
if ( -e ('/etc/wanpipe/wanpipe5.conf')) {$sgSTRING .= '/etc/wanpipe/wanpipe5.conf ';}
|
||||
if ( -e ('/etc/wanpipe/wanpipe6.conf')) {$sgSTRING .= '/etc/wanpipe/wanpipe6.conf ';}
|
||||
if ( -e ('/etc/wanpipe/wanpipe7.conf')) {$sgSTRING .= '/etc/wanpipe/wanpipe7.conf ';}
|
||||
if ( -e ('/etc/wanpipe/wanpipe8.conf')) {$sgSTRING .= '/etc/wanpipe/wanpipe8.conf ';}
|
||||
if ( -e ('/etc/wanpipe/wanrouter.rc')) {$sgSTRING .= '/etc/wanpipe/wanrouter.rc ';}
|
||||
|
||||
`$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$sangoma$wday$tar $sgSTRING`;
|
||||
}
|
||||
|
||||
if ($without_db < 1)
|
||||
{
|
||||
### BACKUP OTHER CONF FILES ON THE SERVER ###
|
||||
`$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$linux$wday$tar /etc/my.cnf /etc/hosts /etc/rc.d/rc.local /etc/resolv.conf`;
|
||||
}
|
||||
else
|
||||
{
|
||||
### BACKUP OTHER CONF FILES ON THE SERVER ###
|
||||
`$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$linux$wday$tar /etc/hosts /etc/rc.d/rc.local /etc/resolv.conf`;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ($conf_only < 1) && ($db_only < 1) && ($without_web < 1) )
|
||||
{
|
||||
### BACKUP THE WEB FILES ON THE SERVER ###
|
||||
`$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$web$wday$tar $PATHweb`;
|
||||
}
|
||||
|
||||
if ( ($conf_only < 1) && ($db_only < 1) )
|
||||
{
|
||||
### BACKUP THE ASTGUICLIENT AND AGI FILES ON THE SERVER ###
|
||||
`$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$bin$wday$tar $PATHagi $PATHhome`;
|
||||
}
|
||||
|
||||
if ( ($conf_only < 1) && ($db_only < 1) && ($without_sounds < 1) )
|
||||
{
|
||||
### BACKUP THE ASTERISK SOUNDS ON THE SERVER ###
|
||||
`$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$sounds$wday$tar $PATHsounds`;
|
||||
}
|
||||
|
||||
### PUT EVERYTHING TOGETHER TO BE COMPRESSED ###
|
||||
`$tarbin cf $ARCHIVEpath/$VARserver_ip$all$wday$tar $ARCHIVEpath/temp`;
|
||||
|
||||
### REMOVE OLD GZ FILE
|
||||
`rm -f $ARCHIVEpath/$VARserver_ip$all$wday$tar$gz`;
|
||||
|
||||
### COMPRESS THE ALL FILE ###
|
||||
`$gzipbin -9 $ARCHIVEpath/$VARserver_ip$all$wday$tar`;
|
||||
|
||||
### REMOVE TEMP FILES ###
|
||||
`rm -fR $ARCHIVEpath/temp`;
|
||||
|
||||
|
||||
#### FTP to the Backup server and upload the final file
|
||||
if ($ftp_transfer > 0)
|
||||
{
|
||||
use Net::FTP;
|
||||
$ftp = Net::FTP->new("$VARREPORT_host", Port => "$VARREPORT_port", Debug => "$FTPdebug");
|
||||
$ftp->login("$VARREPORT_user","$VARREPORT_pass");
|
||||
$ftp->cwd("$VARREPORT_dir");
|
||||
$ftp->binary();
|
||||
$ftp->put("$ARCHIVEpath/$VARserver_ip$all$wday$tar$gz", "$VARserver_ip$all$wday$tar$gz");
|
||||
$ftp->quit;
|
||||
}
|
||||
|
||||
|
||||
exit;
|
||||
@@ -6,7 +6,7 @@
|
||||
# astguiclient.conf file to reflect a change in IP address. The script will
|
||||
# automatically default to the first eth address in the ifconfig output.
|
||||
#
|
||||
# Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
# CHANGELOG
|
||||
# 71205-2144 - added display of extensions.conf example for call routing
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# AST_CRON_audio_1_move_VDonly.pl
|
||||
#
|
||||
# This is a STEP-1 program in the audio archival process
|
||||
#
|
||||
# IMPORTANT!!! ONLY TO BE USED WHEN ONLY VICIDIAL RECORDINGS ARE ON THE SYSTEM!
|
||||
#
|
||||
# runs every 3 minutes and copies the -in recordings in the monitor to the DONE
|
||||
# directory for further processing. Very important for RAM-drive usage
|
||||
#
|
||||
# put an entry into the cron of of your asterisk machine to run this script
|
||||
# every 3 minutes or however often you desire
|
||||
#
|
||||
# ### recording mixing/compressing/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_3_ftp.pl --GSM
|
||||
#
|
||||
# make sure that the following directories exist:
|
||||
# /var/spool/asterisk/monitor # default Asterisk recording directory
|
||||
# /var/spool/asterisk/monitorDONE # where the moved -in files are put
|
||||
#
|
||||
# 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) 2008 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
#
|
||||
# 80302-1958 - First Build
|
||||
#
|
||||
|
||||
### 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 [--debug] = debug\n [--debugX] = super debug\n [-t] = test\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";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#print "no command line options set\n";
|
||||
}
|
||||
|
||||
|
||||
# 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++;
|
||||
}
|
||||
|
||||
# Customized Variables
|
||||
$server_ip = $VARserver_ip; # Asterisk server IP
|
||||
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;
|
||||
|
||||
|
||||
### directory where in/out recordings are saved to by Asterisk
|
||||
$dir1 = "$PATHmonitor";
|
||||
$dir2 = "$PATHDONEmonitor";
|
||||
|
||||
opendir(FILE, "$dir1/");
|
||||
@FILES = readdir(FILE);
|
||||
|
||||
$i=0;
|
||||
foreach(@FILES)
|
||||
{
|
||||
$size1 = 0;
|
||||
$size2 = 0;
|
||||
|
||||
if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) )
|
||||
{
|
||||
|
||||
$size1 = (-s "$dir1/$FILES[$i]");
|
||||
if ($DBX) {print "$FILES[$i] $size1\n";}
|
||||
sleep(1);
|
||||
$size2 = (-s "$dir1/$FILES[$i]");
|
||||
if ($DBX) {print "$FILES[$i] $size2\n\n";}
|
||||
|
||||
if ( ($FILES[$i] !~ /out\.wav|out\.gsm|lost\+found/i) && ($size1 eq $size2) && (length($FILES[$i]) > 4))
|
||||
{
|
||||
$INfile = $FILES[$i];
|
||||
$OUTfile = $FILES[$i];
|
||||
$OUTfile =~ s/-in\.wav/-out.wav/gi;
|
||||
$OUTfile =~ s/-in\.gsm/-out.gsm/gi;
|
||||
$ALLfile = $FILES[$i];
|
||||
$ALLfile =~ s/-in\.wav/-all.wav/gi;
|
||||
$ALLfile =~ s/-in\.gsm/-all.gsm/gi;
|
||||
$SQLFILE = $FILES[$i];
|
||||
$SQLFILE =~ s/-in\.wav|-in\.gsm//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 ($DB) {print "|$recording_id|$INfile| |$ALLfile|\n";}
|
||||
|
||||
if (!$T)
|
||||
{
|
||||
`mv -f "$dir1/$INfile" "$dir2/$ALLfile"`;
|
||||
`rm -f "$dir1/$OUTfile"`;
|
||||
}
|
||||
else
|
||||
{
|
||||
`cp -f "$dir1/$INfile" "$dir2/$ALLfile"`;
|
||||
}
|
||||
|
||||
$stmtA = "UPDATE recording_log set location='http://$server_ip/RECORDINGS/$ALLfile' 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";
|
||||
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($DB) {print "DONE... EXITING\n\n";}
|
||||
|
||||
$dbhA->disconnect();
|
||||
|
||||
|
||||
exit;
|
||||
@@ -0,0 +1,226 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# AST_CRON_audio_1_move_mix.pl
|
||||
#
|
||||
# This is a STEP-1 program in the audio archival process
|
||||
#
|
||||
# runs every 3 minutes and copies and mixes the -in and -out recordings in the
|
||||
# monitor to the DONE directory for further processing. Very important for
|
||||
# RAM-drive usage
|
||||
#
|
||||
# put an entry into the cron of of your asterisk machine to run this script
|
||||
# every 3 minutes or however often you desire
|
||||
#
|
||||
# ### recording mixing/compressing/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_3_ftp.pl --GSM
|
||||
#
|
||||
# make sure that the following directories exist:
|
||||
# /var/spool/asterisk/monitor # default Asterisk recording directory
|
||||
# /var/spool/asterisk/monitorDONE # where the mixed -all files are put
|
||||
#
|
||||
# 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) 2008 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
#
|
||||
# 80302-1958 - First Build
|
||||
#
|
||||
|
||||
### 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 [--debug] = debug\n [--debugX] = super debug\n [-t] = test\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";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#print "no command line options set\n";
|
||||
}
|
||||
|
||||
|
||||
# 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++;
|
||||
}
|
||||
|
||||
# Customized Variables
|
||||
$server_ip = $VARserver_ip; # Asterisk server IP
|
||||
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;
|
||||
|
||||
|
||||
### find soxmix or sox to do the mixing
|
||||
$soxmixbin = '';
|
||||
if ( -e ('/usr/bin/soxmix')) {$soxmixbin = '/usr/bin/soxmix';}
|
||||
else
|
||||
{
|
||||
if ( -e ('/usr/local/bin/soxmix')) {$soxmixbin = '/usr/local/bin/soxmix';}
|
||||
else
|
||||
{
|
||||
if ($DB) {print "Can't find soxmix binary! Trying sox...\n";}
|
||||
if ( -e ('/usr/bin/sox')) {$soxmixbin = '/usr/bin/sox -m';}
|
||||
else
|
||||
{
|
||||
if ( -e ('/usr/local/bin/sox')) {$soxmixbin = '/usr/local/bin/sox -m';}
|
||||
else
|
||||
{
|
||||
print "Can't find sox binary! Exiting...\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
### directory where in/out recordings are saved to by Asterisk
|
||||
$dir1 = "$PATHmonitor";
|
||||
$dir2 = "$PATHDONEmonitor";
|
||||
|
||||
opendir(FILE, "$dir1/");
|
||||
@FILES = readdir(FILE);
|
||||
|
||||
$i=0;
|
||||
foreach(@FILES)
|
||||
{
|
||||
$size1 = 0;
|
||||
$size2 = 0;
|
||||
|
||||
if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) )
|
||||
{
|
||||
|
||||
$size1 = (-s "$dir1/$FILES[$i]");
|
||||
if ($DBX) {print "$FILES[$i] $size1\n";}
|
||||
sleep(1);
|
||||
$size2 = (-s "$dir1/$FILES[$i]");
|
||||
if ($DBX) {print "$FILES[$i] $size2\n\n";}
|
||||
|
||||
if ( ($FILES[$i] !~ /out\.wav|out\.gsm|lost\+found/i) && ($size1 eq $size2) && (length($FILES[$i]) > 4))
|
||||
{
|
||||
$INfile = $FILES[$i];
|
||||
$OUTfile = $FILES[$i];
|
||||
$OUTfile =~ s/-in\.wav/-out.wav/gi;
|
||||
$OUTfile =~ s/-in\.gsm/-out.gsm/gi;
|
||||
$ALLfile = $FILES[$i];
|
||||
$ALLfile =~ s/-in\.wav/-all.wav/gi;
|
||||
$ALLfile =~ s/-in\.gsm/-all.gsm/gi;
|
||||
$SQLFILE = $FILES[$i];
|
||||
$SQLFILE =~ s/-in\.wav|-in\.gsm//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 ($DB) {print "|$recording_id|$INfile|$OUTfile| |$ALLfile|\n";}
|
||||
|
||||
`$soxmixbin "$dir1/$INfile" "$dir1/$OUTfile" "$dir2/$ALLfile"`;
|
||||
|
||||
$stmtA = "UPDATE recording_log set location='http://$server_ip/RECORDINGS/$ALLfile' 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)
|
||||
{
|
||||
`mv -f "$dir1/$INfile" "$dir2/ORIG/$INfile"`;
|
||||
`mv -f "$dir1/$OUTfile" "$dir2/ORIG/$OUTfile"`;
|
||||
}
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($DB) {print "DONE... EXITING\n\n";}
|
||||
|
||||
$dbhA->disconnect();
|
||||
|
||||
|
||||
exit;
|
||||
@@ -0,0 +1,292 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# AST_CRON_audio_2_compress.pl
|
||||
#
|
||||
# This is a STEP-2 program in the audio archival process
|
||||
#
|
||||
# runs every 3 minutes and compresses the -all recording files to GSM format
|
||||
#
|
||||
# put an entry into the cron of of your asterisk machine to run this script
|
||||
# every 3 minutes or however often you desire
|
||||
#
|
||||
# ### recording mixing/compressing/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_3_ftp.pl --GSM
|
||||
#
|
||||
# FLAGS FOR COMPRESSION CODECS
|
||||
# --GSM = GSM 6.10 codec
|
||||
# --MP3 = MPEG Layer3 codec
|
||||
# --OGG = OGG Vorbis codec
|
||||
#
|
||||
# make sure that the following directories exist:
|
||||
# /var/spool/asterisk/monitorDONE # where the mixed -all files are put
|
||||
#
|
||||
# This program assumes that recordings are saved by Asterisk as .wav
|
||||
#
|
||||
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
#
|
||||
# 80302-1958 - First Build
|
||||
#
|
||||
|
||||
$GSM=0; $MP3=0; $OGG=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 [--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;
|
||||
}
|
||||
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";}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($args =~ /--OGG/i)
|
||||
{
|
||||
$OGG=1;
|
||||
if ($DB) {print "OGG compression\n";}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#print "no command line options set\n";
|
||||
$GSM=1;
|
||||
}
|
||||
|
||||
|
||||
# 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++;
|
||||
}
|
||||
|
||||
# Customized Variables
|
||||
$server_ip = $VARserver_ip; # Asterisk server IP
|
||||
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;
|
||||
|
||||
|
||||
if ( ($GSM > 0) || ($OGG > 0) )
|
||||
{
|
||||
### find sox binary to do the compression
|
||||
$soxbin = '';
|
||||
if ( -e ('/usr/bin/sox')) {$soxbin = '/usr/bin/sox';}
|
||||
else
|
||||
{
|
||||
if ( -e ('/usr/local/bin/sox')) {$soxbin = '/usr/local/bin/sox';}
|
||||
else
|
||||
{
|
||||
print "Can't find sox binary! Exiting...\n";
|
||||
exit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($MP3 > 0)
|
||||
{
|
||||
### find lame mp3 encoder binary to do the compression
|
||||
$lamebin = '';
|
||||
if ( -e ('/usr/bin/lame')) {$lamebin = '/usr/bin/lame';}
|
||||
else
|
||||
{
|
||||
if ( -e ('/usr/local/bin/lame')) {$lamebin = '/usr/local/bin/lame';}
|
||||
else
|
||||
{
|
||||
print "Can't find lame binary! Exiting...\n";
|
||||
exit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
### directory where -all recordings are
|
||||
$dir2 = "$PATHDONEmonitor";
|
||||
|
||||
opendir(FILE, "$dir2/");
|
||||
@FILES = readdir(FILE);
|
||||
|
||||
$i=0;
|
||||
foreach(@FILES)
|
||||
{
|
||||
$size1 = 0;
|
||||
$size2 = 0;
|
||||
|
||||
if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) )
|
||||
{
|
||||
|
||||
$size1 = (-s "$dir2/$FILES[$i]");
|
||||
if ($DBX) {print "$FILES[$i] $size1\n";}
|
||||
sleep(1);
|
||||
$size2 = (-s "$dir2/$FILES[$i]");
|
||||
if ($DBX) {print "$FILES[$i] $size2\n\n";}
|
||||
|
||||
if ( ($FILES[$i] !~ /out\.|in\.|lost\+found/i) && ($size1 eq $size2) && (length($FILES[$i]) > 4))
|
||||
{
|
||||
$recording_id='';
|
||||
$ALLfile = $FILES[$i];
|
||||
$SQLFILE = $FILES[$i];
|
||||
$SQLFILE =~ s/-all\.wav|-all\.gsm//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 ($GSM > 0)
|
||||
{
|
||||
$GSMfile = $FILES[$i];
|
||||
$GSMfile =~ s/-all\.wav/-all.gsm/gi;
|
||||
|
||||
if ($DB) {print "|$recording_id|$ALLfile|$GSMfile| |$SQLfile|\n";}
|
||||
|
||||
`$soxbin "$dir2/$ALLfile" "$dir2/GSM/$GSMfile"`;
|
||||
|
||||
$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";
|
||||
}
|
||||
|
||||
if ($OGG > 0)
|
||||
{
|
||||
$OGGfile = $FILES[$i];
|
||||
$OGGfile =~ s/-all\.wav/-all.ogg/gi;
|
||||
|
||||
if ($DB) {print "|$recording_id|$ALLfile|$OGGfile| |$SQLfile|\n";}
|
||||
|
||||
`$soxbin "$dir2/$ALLfile" "$dir2/OGG/$OGGfile"`;
|
||||
|
||||
$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";
|
||||
}
|
||||
|
||||
if ($MP3 > 0)
|
||||
{
|
||||
$MP3file = $FILES[$i];
|
||||
$MP3file =~ s/-all\.wav/-all.mp3/gi;
|
||||
|
||||
if ($DB) {print "|$recording_id|$ALLfile|$MP3file| |$SQLfile|\n";}
|
||||
|
||||
`$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';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n";
|
||||
}
|
||||
|
||||
|
||||
if (!$T)
|
||||
{
|
||||
`mv -f "$dir2/$ALLfile" "$dir2/ORIG/$ALLfile"`;
|
||||
}
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($DB) {print "DONE... EXITING\n\n";}
|
||||
|
||||
$dbhA->disconnect();
|
||||
|
||||
|
||||
exit;
|
||||
@@ -0,0 +1,279 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# AST_CRON_audio_3_ftp.pl
|
||||
#
|
||||
# This is a STEP-3 program in the audio archival process
|
||||
#
|
||||
# runs every 3 minutes and copies the recording files to an FTP server
|
||||
#
|
||||
# put an entry into the cron of of your asterisk machine to run this script
|
||||
# every 3 minutes or however often you desire
|
||||
#
|
||||
# ### recording mixing/compressing/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_3_ftp.pl --GSM
|
||||
#
|
||||
# FLAGS FOR COMPRESSION FILES TO TRANSFER
|
||||
# --GSM = GSM 6.10 files
|
||||
# --MP3 = MPEG Layer3 files
|
||||
# --OGG = OGG Vorbis files
|
||||
# --WAV = WAV files
|
||||
#
|
||||
# FLAG FOR NO DATE DIRECTORY ON FTP
|
||||
# --NODATEDIR
|
||||
#
|
||||
# make sure that the following directories exist:
|
||||
# /var/spool/asterisk/monitorDONE # where the mixed -all files are put
|
||||
#
|
||||
# This program assumes that recordings are saved by Asterisk as .wav
|
||||
#
|
||||
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
#
|
||||
# 80302-1958 - First Build
|
||||
# 80317-2349 - Added FTP debug if debugX
|
||||
#
|
||||
|
||||
$GSM=0; $MP3=0; $OGG=0; $WAV=0; $NODATEDIR=0;
|
||||
|
||||
# Default variables for FTP
|
||||
$VARFTP_host = '10.0.0.4';
|
||||
$VARFTP_user = 'cron';
|
||||
$VARFTP_pass = 'test';
|
||||
$VARFTP_port = '21';
|
||||
$VARFTP_dir = 'RECORDINGS';
|
||||
$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++;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
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";}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($args =~ /--OGG/i)
|
||||
{
|
||||
$OGG=1;
|
||||
if ($DB) {print "OGG audio files\n";}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($args =~ /--WAV/i)
|
||||
{
|
||||
$WAV=1;
|
||||
if ($DB) {print "WAV audio files\n";}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#print "no command line options set\n";
|
||||
$WAV=1;
|
||||
}
|
||||
|
||||
|
||||
# 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++;
|
||||
}
|
||||
|
||||
# Customized Variables
|
||||
$server_ip = $VARserver_ip; # Asterisk server IP
|
||||
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;
|
||||
|
||||
use Net::Ping;
|
||||
use Net::FTP;
|
||||
|
||||
### 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";}
|
||||
|
||||
opendir(FILE, "$dir2/");
|
||||
@FILES = readdir(FILE);
|
||||
|
||||
$i=0;
|
||||
foreach(@FILES)
|
||||
{
|
||||
$size1 = 0;
|
||||
$size2 = 0;
|
||||
|
||||
if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) )
|
||||
{
|
||||
|
||||
$size1 = (-s "$dir2/$FILES[$i]");
|
||||
if ($DBX) {print "$FILES[$i] $size1\n";}
|
||||
sleep(1);
|
||||
$size2 = (-s "$dir2/$FILES[$i]");
|
||||
if ($DBX) {print "$FILES[$i] $size2\n\n";}
|
||||
|
||||
if ( ($FILES[$i] !~ /out\.|in\.|lost\+found/i) && ($size1 eq $size2) && (length($FILES[$i]) > 4))
|
||||
{
|
||||
$recording_id='';
|
||||
$ALLfile = $FILES[$i];
|
||||
$SQLFILE = $FILES[$i];
|
||||
$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;";
|
||||
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]";
|
||||
$start_date = "$aryA[1]";
|
||||
$start_date =~ s/ .*//gi;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
|
||||
if ($DB) {print "|$recording_id|$start_date|$ALLfile| |$SQLfile|\n";}
|
||||
|
||||
### BEGIN Remote file transfer
|
||||
$p = Net::Ping->new();
|
||||
$ping_good = $p->ping("$VARFTP_host");
|
||||
|
||||
if ($ping_good)
|
||||
{
|
||||
$start_date_PATH='';
|
||||
$FTPdb=0;
|
||||
if ($DBX>0) {$FTPdb=1;}
|
||||
$ftp = Net::FTP->new("$VARFTP_host", Port => $VARFTP_port, Debug => $FTPdb);
|
||||
$ftp->login("$VARFTP_user","$VARFTP_pass");
|
||||
$ftp->cwd("$VARFTP_dir");
|
||||
if ($NODATEDIR < 1)
|
||||
{
|
||||
$ftp->mkdir("$start_date");
|
||||
$ftp->cwd("$start_date");
|
||||
$start_date_PATH = "$start_date/";
|
||||
}
|
||||
$ftp->binary();
|
||||
$ftp->put("$dir2/$ALLfile", "$ALLfile");
|
||||
$ftp->quit;
|
||||
|
||||
$stmtA = "UPDATE recording_log set location='$VARHTTP_path/$start_date_PATH$ALLfile' where recording_id='$recording_id';";
|
||||
if($DB){print STDERR "\n|$stmtA|\n";}
|
||||
$affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n";
|
||||
|
||||
if (!$T)
|
||||
{
|
||||
`mv -f "$dir2/$ALLfile" "$PATHDONEmonitor/FTP/$ALLfile"`;
|
||||
}
|
||||
}
|
||||
### END Remote file transfer
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($DB) {print "DONE... EXITING\n\n";}
|
||||
|
||||
$dbhA->disconnect();
|
||||
|
||||
|
||||
exit;
|
||||
@@ -31,16 +31,16 @@ PHASE 1: INSTALLING ASTERISK
|
||||
1. follow these command line steps:
|
||||
mkdir /usr/src/asterisk
|
||||
cd /usr/src/asterisk
|
||||
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.24.tar.gz
|
||||
wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.21.tar.gz
|
||||
wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.5.tar.gz
|
||||
gunzip asterisk-1.2.24.tar.gz
|
||||
tar xvf asterisk-1.2.24.tar
|
||||
gunzip zaptel-1.2.21.tar.gz
|
||||
tar xvf zaptel-1.2.21.tar
|
||||
gunzip libpri-1.2.5.tar.gz
|
||||
tar xvf libpri-1.2.5.tar
|
||||
cd ./zaptel-1.2.21
|
||||
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.27.tar.gz
|
||||
wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.24.tar.gz
|
||||
wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.7.tar.gz
|
||||
gunzip asterisk-1.2.27.tar.gz
|
||||
tar xvf asterisk-1.2.27.tar
|
||||
gunzip zaptel-1.2.24.tar.gz
|
||||
tar xvf zaptel-1.2.24.tar
|
||||
gunzip libpri-1.2.7.tar.gz
|
||||
tar xvf libpri-1.2.7.tar
|
||||
cd ./zaptel-1.2.24
|
||||
wget http://www.freedomphones.net/files/newt-0.51.6.tar.gz
|
||||
gunzip newt-0.51.6.tar.gz
|
||||
tar xvf newt-0.51.6.tar
|
||||
@@ -54,11 +54,11 @@ make clean
|
||||
make zttool
|
||||
make
|
||||
make install
|
||||
cd ../libpri-1.2.5
|
||||
cd ../libpri-1.2.7
|
||||
make clean
|
||||
make
|
||||
make install
|
||||
cd ../asterisk-1.2.24
|
||||
cd ../asterisk-1.2.27
|
||||
(1.2 tree) If you want to include Answering Machine Detection ability
|
||||
you will need to download app_amd.c and amd.conf and alter the
|
||||
apps/Makefile to compile it properly
|
||||
@@ -73,11 +73,11 @@ cd ../asterisk-1.2.24
|
||||
wget http://www.eflo.net/files/amd2.conf
|
||||
mkdir /etc/asterisk
|
||||
mv amd2.conf /etc/asterisk/amd.conf
|
||||
*OPTIONAL*(1.2.23 thru 1.2.24) apply the meetme DTMF passthru patch
|
||||
*OPTIONAL*(1.2.23 thru 1.2.27) apply the meetme DTMF passthru patch
|
||||
wget http://www.eflo.net/files/meetme_DTMF_passthru-1.2.23.patch
|
||||
patch -p1 < ./meetme_DTMF_passthru-1.2.23.patch
|
||||
- File to patch: app_meetme.c
|
||||
*OPTIONAL*(1.2.12.1 thru 1.2.24) apply the meetme volume control patch
|
||||
*OPTIONAL*(1.2.12.1 thru 1.2.27) apply the meetme volume control patch
|
||||
*Different patches available for 1.2.7.1 through 1.2.14
|
||||
wget http://www.eflo.net/files/meetme_volume_control_1.2.16.patch
|
||||
patch -p1 < ./meetme_volume_control_1.2.16.patch
|
||||
@@ -89,7 +89,7 @@ cd ../asterisk-1.2.24
|
||||
patch -p1 < ./cli_chan_concise_delimiter.patch
|
||||
- File to patch: cli.c
|
||||
|
||||
*OPTIONAL*(1.2.14 thru 1.2.24) rewrite of waitforsilence
|
||||
*OPTIONAL*(1.2.14 thru 1.2.27) rewrite of waitforsilence
|
||||
wget http://www.eflo.net/files/app_waitforsilence.c
|
||||
mv -f app_waitforsilence.c apps/app_waitforsilence.c
|
||||
|
||||
@@ -233,9 +233,20 @@ musiconhold audio files to be converted to native formats like GSM, ULAW and ALA
|
||||
sox -r 44100 -w -s -c 1 fpm-world-mix.raw -r 8000 -c 1 fpm-world-mix.wav
|
||||
sox fpm-world-mix.wav -t gsm -r 8000 -b -c 1 fpm-world-mix.gsm
|
||||
sox fpm-world-mix.wav -t ul -r 8000 -b -c 1 fpm-world-mix.pcm
|
||||
rm -f *.raw
|
||||
mkdir ../orig-mp3
|
||||
mv -f *.mp3 ../orig-mp3/
|
||||
mkdir ../quiet-mp3
|
||||
cd ../quiet-mp3
|
||||
sox -r 44100 -w -s -c 1 ../mohmp3/fpm-sunshine.raw -r 8000 -c 1 -v 0.25 fpm-sunshine.wav
|
||||
sox fpm-sunshine.wav -t gsm -r 8000 -b -c 1 fpm-sunshine.gsm
|
||||
sox fpm-sunshine.wav -t ul -r 8000 -b -c 1 fpm-sunshine.pcm
|
||||
sox -r 44100 -w -s -c 1 ../mohmp3/fpm-calm-river.raw -r 8000 -c 1 -v 0.25 fpm-calm-river.wav
|
||||
sox fpm-calm-river.wav -t gsm -r 8000 -b -c 1 fpm-calm-river.gsm
|
||||
sox fpm-calm-river.wav -t ul -r 8000 -b -c 1 fpm-calm-river.pcm
|
||||
sox -r 44100 -w -s -c 1 ../mohmp3/fpm-world-mix.raw -r 8000 -c 1 -v 0.25 fpm-world-mix.wav
|
||||
sox fpm-world-mix.wav -t gsm -r 8000 -b -c 1 fpm-world-mix.gsm
|
||||
sox fpm-world-mix.wav -t ul -r 8000 -b -c 1 fpm-world-mix.pcm
|
||||
rm -f ../mohmp3/*.raw
|
||||
|
||||
|
||||
|
||||
@@ -267,6 +278,10 @@ use asterisk;
|
||||
##### make sure on these queries that you change the server_ip "10.10.10.15"
|
||||
##### to the server IP that you are using
|
||||
|
||||
# NOTE: make sure you do NOT put any spaces or other punctuation in the
|
||||
# server_id, phone, extension, or user fields in the queries below if you edit them.
|
||||
|
||||
|
||||
insert into servers (server_id,server_description,server_ip,active,asterisk_version)values('TESTast','Test install of Asterisk server', '10.10.10.15','Y','1.2.26.2');
|
||||
|
||||
insert into server_updater values('10.10.10.15','');
|
||||
@@ -475,6 +490,7 @@ insert into vicidial_statuses values('XDROP','Agent Not Available IN','N','Y','U
|
||||
insert into vicidial_statuses values('NA','No Answer AutoDial','N','N','UNDEFINED');
|
||||
|
||||
insert into vicidial_statuses values('CALLBK','Call Back','Y','Y','UNDEFINED');
|
||||
insert into vicidial_statuses values('CBHOLD','Call Back Hold','N','Y','UNDEFINED');
|
||||
insert into vicidial_statuses values('A','Answering Machine','Y','N','UNDEFINED');
|
||||
insert into vicidial_statuses values('AA','Answering Machine Auto','N','N','UNDEFINED');
|
||||
insert into vicidial_statuses values('AM','Answering Machine Sent to Mesg','N','N','UNDEFINED');
|
||||
@@ -603,12 +619,12 @@ PHASE 6: ADDING CRONTAB ENTRIES FOR ASTGUICLIENT/VICIDIAL SCRIPTS
|
||||
- cd /usr/share/astguiclient
|
||||
- crontab -e
|
||||
- add the following entries(here's what we used):
|
||||
(Note if you have not edited the AST_CRON_mix_recordings.pl script
|
||||
to FTP to a different server, then you should use the
|
||||
AST_CRON_mix_recordings_BASIC.pl file in it's place)
|
||||
|
||||
### recording mixing for Asterisk run every 5 minutes
|
||||
1,6,11,16,21,26,31,36,41,46,51,56 * * * 1,2,3,4,5,6 /usr/share/astguiclient/AST_CRON_mix_recordings_BASIC.pl
|
||||
### recording mixing/compressing/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_3_ftp.pl --GSM
|
||||
|
||||
### keepalive script for astguiclient processes
|
||||
* * * * * /usr/share/astguiclient/ADMIN_keepalive_ALL.pl
|
||||
|
||||
@@ -12,23 +12,32 @@ cd make-3.81
|
||||
make
|
||||
make install
|
||||
|
||||
cd /usr/local
|
||||
wget http://mirror.trouble-free.net/mysql_mirror/Downloads/MySQL-4.0/mysql-4.0.27.tar.gz
|
||||
gunzip mysql-4.0.27.tar.gz
|
||||
tar xvf mysql-4.0.27.tar
|
||||
cd mysql-4.0.27
|
||||
cd /usr/local/
|
||||
wget http://mirror.trouble-free.net/mysql_mirror/Downloads/MySQL-5.0/mysql-5.0.45.tar.gz
|
||||
gunzip mysql-5.0.45.tar.gz
|
||||
tar xvf mysql-5.0.45.tar
|
||||
cd mysql-5.0.45
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
./configure --prefix=/usr/local/mysql --enable-large-files --enable-shared=yes --with-readline
|
||||
./configure --prefix=/usr/local/mysql --enable-shared=yes --with-readline --enable-thread-safe-client --enable-large-files --enable-assembler --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-big-tables
|
||||
make
|
||||
make install
|
||||
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin/
|
||||
export PATH
|
||||
cp /usr/local/mysql-5.0.45/libmysql/.libs/libmysqlclient.so /usr/lib/
|
||||
cp /usr/local/mysql-5.0.45/libmysql/.libs/libmysqlclient.so.15 /usr/lib/
|
||||
cd /usr/local/mysql-5.0.45
|
||||
scripts/mysql_install_db
|
||||
chown -R root /usr/local/mysql
|
||||
chown -R mysql /usr/local/mysql/var
|
||||
chgrp -R mysql /usr/local/mysql
|
||||
cp support-files/my-medium.cnf /etc/my.cnf
|
||||
/usr/local/mysql/bin/mysqld_safe --user=mysql &
|
||||
cp support-files/my-huge.cnf /etc/my.cnf
|
||||
/usr/local/mysql/bin/mysqld_safe --user=mysql --skip-name-resolve --skip-host-cache &
|
||||
ln -s /tmp/mysql.sock /var/run/mysql/mysql.sock
|
||||
vi /etc/my.cnf
|
||||
# add this line below 'skip-locking'
|
||||
skip-name-resolve
|
||||
# comment out the line 'log-bin=mysql-bin'
|
||||
|
||||
|
||||
perl -MCPAN -e shell
|
||||
@@ -53,25 +62,35 @@ quit
|
||||
|
||||
|
||||
cd /usr/local
|
||||
wget http://asterisk.gnuinter.net/files/asterisk-perl-0.08.tar.gz
|
||||
gunzip asterisk-perl-0.08.tar.gz
|
||||
tar xvf asterisk-perl-0.08.tar
|
||||
cd asterisk-perl-0.08
|
||||
wget http://asterisk.gnuinter.net/files/asterisk-perl-0.10.tar.gz
|
||||
gunzip asterisk-perl-0.10.tar.gz
|
||||
tar xvf asterisk-perl-0.10.tar
|
||||
cd asterisk-perl-0.10
|
||||
perl Makefile.PL
|
||||
make all
|
||||
make install
|
||||
|
||||
|
||||
cd /usr/local
|
||||
wget http://easynews.dl.sourceforge.net/sourceforge/sox/sox-12.17.9.tar.gz
|
||||
gunzip sox-12.17.9.tar.gz
|
||||
tar xvf sox-12.17.9.tar
|
||||
cd sox-12.17.9
|
||||
wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.96.1.tar.gz
|
||||
gunzip lame-3.96.1.tar.gz
|
||||
tar xvf lame-3.96.1.tar
|
||||
cd lame-3.96.1
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
|
||||
cd /usr/local
|
||||
wget http://easynews.dl.sourceforge.net/sourceforge/sox/sox-14.0.1.tar.gz
|
||||
gunzip sox-14.0.1.tar.gz
|
||||
tar xvf sox-14.0.1.tar
|
||||
cd sox-14.0.1
|
||||
./configure --disable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
|
||||
cd /usr/local
|
||||
wget http://ftp.gnu.org/gnu/screen/screen-4.0.2.tar.gz
|
||||
gunzip screen-4.0.2.tar.gz
|
||||
@@ -172,9 +191,9 @@ cd /usr/local
|
||||
wget http://mirror.candidhosting.com/pub/apache/httpd/httpd-2.0.61.tar.gz
|
||||
gunzip httpd-2.0.61.tar.gz
|
||||
tar xvf httpd-2.0.61.tar
|
||||
wget http://us2.php.net/distributions/php-4.4.7.tar.gz
|
||||
gunzip php-4.4.7.tar.gz
|
||||
tar xvf php-4.4.7.tar
|
||||
wget http://us2.php.net/distributions/php-4.4.8.tar.gz
|
||||
gunzip php-4.4.8.tar.gz
|
||||
tar xvf php-4.4.8.tar
|
||||
cd httpd-2.0.61
|
||||
./configure --prefix=/usr/local/apache2 --enable-ssl --enable-setenvif --enable-so --with-apxs2 --enable-dav --enable-maintainer-mode
|
||||
make
|
||||
@@ -188,7 +207,7 @@ openssl req -new -x509 -days 1200 -keyout /usr/local/apache2/conf/ssl.key/server
|
||||
openssl rsa -in /usr/local/apache2/conf/ssl.key/server.key.cpy -out /usr/local/apache2/conf/ssl.key/server.key
|
||||
|
||||
|
||||
cd ../php-4.4.7
|
||||
cd ../php-4.4.8
|
||||
./configure --with-mysql=/usr/local/mysql --enable-inline-optimization --enable-memory-limit --enable-track-vars --enable-libgcc --with-xml --enable-versioning --enable-sysvsem --with-openssl --disable-debug --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib
|
||||
make
|
||||
make install
|
||||
@@ -288,16 +307,16 @@ make install
|
||||
|
||||
mkdir /usr/src/asterisk
|
||||
cd /usr/src/asterisk
|
||||
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.26.2.tar.gz
|
||||
wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.23.tar.gz
|
||||
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.27.tar.gz
|
||||
wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.24.tar.gz
|
||||
wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.7.tar.gz
|
||||
gunzip asterisk-1.2.26.2.tar.gz
|
||||
tar xvf asterisk-1.2.26.2.tar
|
||||
gunzip zaptel-1.2.23.tar.gz
|
||||
tar xvf zaptel-1.2.23.tar
|
||||
gunzip asterisk-1.2.27.tar.gz
|
||||
tar xvf asterisk-1.2.27.tar
|
||||
gunzip zaptel-1.2.24.tar.gz
|
||||
tar xvf zaptel-1.2.24.tar
|
||||
gunzip libpri-1.2.7.tar.gz
|
||||
tar xvf libpri-1.2.7.tar
|
||||
cd ./zaptel-1.2.23
|
||||
cd ./zaptel-1.2.24
|
||||
wget http://www.freedomphones.net/files/newt-0.51.6.tar.gz
|
||||
gunzip newt-0.51.6.tar.gz
|
||||
tar xvf newt-0.51.6.tar
|
||||
@@ -315,7 +334,7 @@ cd ../libpri-1.2.7
|
||||
make clean
|
||||
make
|
||||
make install
|
||||
cd ../asterisk-1.2.26.2
|
||||
cd ../asterisk-1.2.27
|
||||
cd apps
|
||||
wget http://www.eflo.net/files/app_amd2.c
|
||||
mv app_amd2.c app_amd.c
|
||||
@@ -379,13 +398,28 @@ mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-world-mix.mp3 > /var/
|
||||
sox -r 44100 -w -s -c 1 fpm-world-mix.raw -r 8000 -c 1 fpm-world-mix.wav
|
||||
sox fpm-world-mix.wav -t gsm -r 8000 -b -c 1 fpm-world-mix.gsm
|
||||
sox fpm-world-mix.wav -t ul -r 8000 -b -c 1 fpm-world-mix.pcm
|
||||
rm -f *.raw
|
||||
mkdir ../orig-mp3
|
||||
mv -f *.mp3 ../orig-mp3/
|
||||
mkdir ../quiet-mp3
|
||||
cd ../quiet-mp3
|
||||
sox -r 44100 -w -s -c 1 ../mohmp3/fpm-sunshine.raw -r 8000 -c 1 -v 0.25 fpm-sunshine.wav
|
||||
sox fpm-sunshine.wav -t gsm -r 8000 -b -c 1 fpm-sunshine.gsm
|
||||
sox fpm-sunshine.wav -t ul -r 8000 -b -c 1 fpm-sunshine.pcm
|
||||
sox -r 44100 -w -s -c 1 ../mohmp3/fpm-calm-river.raw -r 8000 -c 1 -v 0.25 fpm-calm-river.wav
|
||||
sox fpm-calm-river.wav -t gsm -r 8000 -b -c 1 fpm-calm-river.gsm
|
||||
sox fpm-calm-river.wav -t ul -r 8000 -b -c 1 fpm-calm-river.pcm
|
||||
sox -r 44100 -w -s -c 1 ../mohmp3/fpm-world-mix.raw -r 8000 -c 1 -v 0.25 fpm-world-mix.wav
|
||||
sox fpm-world-mix.wav -t gsm -r 8000 -b -c 1 fpm-world-mix.gsm
|
||||
sox fpm-world-mix.wav -t ul -r 8000 -b -c 1 fpm-world-mix.pcm
|
||||
rm -f ../mohmp3/*.raw
|
||||
|
||||
|
||||
|
||||
############# INSTRUCTIONS FOR Asterik 1.4 release ####################
|
||||
Downgrading back to 1.2.X from 1.4.X:
|
||||
rm -f /usr/lib/asterisk/modules/*
|
||||
rm -f /usr/include/asterisk/*
|
||||
|
||||
|
||||
NOTE: If you want to use Asterisk 1.4, you will need to make sure that you set
|
||||
the servers table "asterisk_version" field to the proper version number and you
|
||||
@@ -409,14 +443,44 @@ rm -f /usr/lib/asterisk/modules/format_au.so
|
||||
rm -f /usr/lib/asterisk/modules/format_pcm_alaw.so
|
||||
rm -f /usr/lib/asterisk/modules/pbx_functions.so
|
||||
|
||||
### If downgrading from 1.4.X Asterisk to 1.2.X asterisk:
|
||||
rm -f /usr/lib/asterisk/modules/app_channelredirect.so
|
||||
rm -f /usr/lib/asterisk/modules/app_followme.so
|
||||
rm -f /usr/lib/asterisk/modules/app_morsecode.so
|
||||
rm -f /usr/lib/asterisk/modules/app_speech_utils.so
|
||||
rm -f /usr/lib/asterisk/modules/format_h264.so
|
||||
rm -f /usr/lib/asterisk/modules/func_base64.so
|
||||
rm -f /usr/lib/asterisk/modules/func_cdr.so
|
||||
rm -f /usr/lib/asterisk/modules/func_channel.so
|
||||
rm -f /usr/lib/asterisk/modules/func_curl.so
|
||||
rm -f /usr/lib/asterisk/modules/func_cut.so
|
||||
rm -f /usr/lib/asterisk/modules/func_db.so
|
||||
rm -f /usr/lib/asterisk/modules/func_env.so
|
||||
rm -f /usr/lib/asterisk/modules/func_global.so
|
||||
rm -f /usr/lib/asterisk/modules/func_groupcount.so
|
||||
rm -f /usr/lib/asterisk/modules/func_language.so
|
||||
rm -f /usr/lib/asterisk/modules/func_logic.so
|
||||
rm -f /usr/lib/asterisk/modules/func_math.so
|
||||
rm -f /usr/lib/asterisk/modules/func_md5.so
|
||||
rm -f /usr/lib/asterisk/modules/func_moh.so
|
||||
rm -f /usr/lib/asterisk/modules/func_rand.so
|
||||
rm -f /usr/lib/asterisk/modules/func_realtime.so
|
||||
rm -f /usr/lib/asterisk/modules/func_sha1.so
|
||||
rm -f /usr/lib/asterisk/modules/func_strings.so
|
||||
rm -f /usr/lib/asterisk/modules/func_timeout.so
|
||||
rm -f /usr/lib/asterisk/modules/res_clioriginate.so
|
||||
rm -f /usr/lib/asterisk/modules/res_convert.so
|
||||
rm -f /usr/lib/asterisk/modules/res_smdi.so
|
||||
rm -f /usr/lib/asterisk/modules/res_snmp.so
|
||||
rm -f /usr/lib/asterisk/modules/res_speech.so
|
||||
|
||||
mkdir /usr/src/asterisk-1.4
|
||||
cd /usr/src/asterisk-1.4
|
||||
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.4.17.tar.gz
|
||||
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.4.18.tar.gz
|
||||
wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.4.8.tar.gz
|
||||
wget http://ftp.digium.com/pub/libpri/releases/libpri-1.4.3.tar.gz
|
||||
gunzip asterisk-1.4.17.tar.gz
|
||||
tar xvf asterisk-1.4.17.tar
|
||||
gunzip asterisk-1.4.18.tar.gz
|
||||
tar xvf asterisk-1.4.18.tar
|
||||
gunzip zaptel-1.4.8.tar.gz
|
||||
tar xvf zaptel-1.4.8.tar
|
||||
gunzip libpri-1.4.3.tar.gz
|
||||
@@ -429,7 +493,7 @@ cd ../libpri-1.4.3
|
||||
make clean
|
||||
make
|
||||
make install
|
||||
cd ../asterisk-1.4.17
|
||||
cd ../asterisk-1.4.18
|
||||
wget http://www.eflo.net/files/enter.h
|
||||
wget http://www.eflo.net/files/leave.h
|
||||
mv -f enter.h apps/enter.h
|
||||
|
||||
@@ -66,7 +66,7 @@ PHASE 1: INSTALLING AN OPERATING SYSTEM
|
||||
|
||||
|
||||
This installation will be using Slackware 11 for the linux distribution,
|
||||
Slackware 10.X will also work with these instructions. There are several easier
|
||||
Slackware 12.X will also work with these instructions. There are several easier
|
||||
linux distributions and there are others that are more popular, but Slackware is
|
||||
a nice non-commercial distro that has been around for a long time and proven
|
||||
itself to be a very uncluttered and stable platform for development.
|
||||
@@ -363,7 +363,7 @@ NOTE: a minimum of MySQL server 4.0.X is required
|
||||
- to install this directly on the command line type:
|
||||
- cd /usr/local
|
||||
- wget http://mirror.trouble-free.net/mysql_mirror/Downloads/MySQL-4.0/mysql-4.0.27.tar.gz
|
||||
# http://mirror.trouble-free.net/mysql_mirror/Downloads/MySQL-5.0/mysql-5.0.41.tar.gz
|
||||
# http://mirror.trouble-free.net/mysql_mirror/Downloads/MySQL-5.0/mysql-5.0.45.tar.gz
|
||||
- gunzip mysql-4.0.27.tar.gz
|
||||
- tar xvf mysql-4.0.27.tar
|
||||
- cd mysql-4.0.27
|
||||
@@ -381,15 +381,15 @@ NOTE: a minimum of MySQL server 4.0.X is required
|
||||
- chown -R mysql /usr/local/mysql/var
|
||||
- chgrp -R mysql /usr/local/mysql
|
||||
- cp support-files/my-medium.cnf /etc/my.cnf
|
||||
- /usr/local/mysql/bin/mysqld_safe --user=mysql &
|
||||
- /usr/local/mysql/bin/mysqld_safe --user=mysql --skip-name-resolve --skip-host-cache &
|
||||
- ln -s /tmp/mysql.sock /var/run/mysql/mysql.sock
|
||||
**** For some systems you may need to add the mysql/bin directory to your PATH:
|
||||
- PATH=$PATH:$HOME/bin:/usr/local/mysql/bin/
|
||||
- export PATH
|
||||
**** you may also want to add those two lines to your /root/.bash_profile file
|
||||
**** For Mysql 5 tree only, you also may need to copy the libmysqlclient.so file to libs
|
||||
- cp /usr/local/mysql-5.0.27/libmysql/.libs/libmysqlclient.so /usr/lib/
|
||||
- cp /usr/local/mysql-5.0.27/libmysql/.libs/libmysqlclient.so.15 /usr/lib/
|
||||
- cp /usr/local/mysql-5.0.45/libmysql/.libs/libmysqlclient.so /usr/lib/
|
||||
- cp /usr/local/mysql-5.0.45/libmysql/.libs/libmysqlclient.so.15 /usr/lib/
|
||||
- you are done
|
||||
|
||||
** INSTALLATION NOTE **
|
||||
@@ -479,11 +479,12 @@ in and out as separate files
|
||||
1. Go to http://sourceforge.net/projects/sox/ and download the sox package
|
||||
- to install this directly on the command line type:
|
||||
- cd /usr/local
|
||||
- wget http://easynews.dl.sourceforge.net/sourceforge/sox/sox-12.17.9.tar.gz
|
||||
- gunzip sox-12.17.9.tar.gz
|
||||
- tar xvf sox-12.17.9.tar
|
||||
- cd sox-12.17.9
|
||||
- ./configure
|
||||
- cd /usr/local
|
||||
- wget http://easynews.dl.sourceforge.net/sourceforge/sox/sox-14.0.1.tar.gz
|
||||
- gunzip sox-14.0.1.tar.gz
|
||||
- tar xvf sox-14.0.1.tar
|
||||
- cd sox-14.0.1
|
||||
- ./configure --disable-shared
|
||||
- make (if alsa.o errors add --disable-alsa-dsp to configure and redo)
|
||||
- make install
|
||||
- you are done
|
||||
@@ -610,15 +611,15 @@ that can be displayed real-time on a web page.
|
||||
- to install this directly on the command line type:
|
||||
NOTE: you may have to edit the Makefile to remove X11 if you don't have it
|
||||
- cd /usr/local
|
||||
- wget http://ploticus.sourceforge.net/download/pl232src.tar.gz
|
||||
- gunzip pl232src.tar.gz
|
||||
- tar xvf pl232src.tar
|
||||
- cd pl232src/src/
|
||||
- wget http://superb-west.dl.sourceforge.net/sourceforge/ploticus/pl240src.tar.gz
|
||||
- gunzip pl240src.tar.gz
|
||||
- tar xvf pl240src.tar
|
||||
- cd pl240src/src/
|
||||
- make clean
|
||||
- make
|
||||
- make install
|
||||
- you are done
|
||||
NOTE: uncomment these lines to compile on systems without X11:
|
||||
NOTE: uncomment these lines to compile on systems without X11(v232):
|
||||
NOXFLAG = -DNOX11
|
||||
XLIBS =
|
||||
XOBJ =
|
||||
@@ -681,18 +682,18 @@ installation on another machine)
|
||||
Go to http://www.php.net/ and download the php unix source code
|
||||
- to install this directly on the command line type:
|
||||
- cd /usr/local
|
||||
- wget http://apache.secsup.org/dist/httpd/httpd-2.0.61.tar.gz
|
||||
- wget http://mirror.candidhosting.com/pub/apache/httpd/httpd-2.0.61.tar.gz
|
||||
- gunzip httpd-2.0.61.tar.gz
|
||||
- tar xvf httpd-2.0.61.tar
|
||||
- wget http://us2.php.net/distributions/php-4.4.7.tar.gz
|
||||
- wget http://us2.php.net/distributions/php-4.4.8.tar.gz
|
||||
NOTE: PHP 5.1.1 has also been tested with this release
|
||||
- gunzip php-4.4.7.tar.gz
|
||||
- tar xvf php-4.4.7.tar
|
||||
- gunzip php-4.4.8.tar.gz
|
||||
- tar xvf php-4.4.8.tar
|
||||
- cd httpd-2.0.61
|
||||
- ./configure --enable-so --with-apxs2
|
||||
- make
|
||||
- make install
|
||||
- cd ../php-4.4.7
|
||||
- cd ../php-4.4.8
|
||||
- ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
|
||||
- make
|
||||
- make install
|
||||
@@ -853,13 +854,13 @@ with the following patch:
|
||||
- mkdir /usr/src/asterisk
|
||||
- cd /usr/src/asterisk
|
||||
A. if you want 1.2 release (reliable with new features):
|
||||
- wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.24.tar.gz
|
||||
- wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.21.tar.gz
|
||||
- wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.27.tar.gz
|
||||
- wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.24.tar.gz
|
||||
- wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.5.tar.gz
|
||||
- gunzip asterisk-1.2.24.tar.gz
|
||||
- tar xvf asterisk-1.2.24.tar
|
||||
- gunzip zaptel-1.2.21.tar.gz
|
||||
- tar xvf zaptel-1.2.21.tar
|
||||
- gunzip asterisk-1.2.27.tar.gz
|
||||
- tar xvf asterisk-1.2.27.tar
|
||||
- gunzip zaptel-1.2.24.tar.gz
|
||||
- tar xvf zaptel-1.2.24.tar
|
||||
- gunzip libpri-1.2.5.tar.gz
|
||||
- tar xvf libpri-1.2.5.tar
|
||||
B. if you want latest SVN_1.2 version (release tree with new patches)
|
||||
@@ -884,7 +885,7 @@ with the following patch:
|
||||
edit this line at the top and just add a hash # in front of it as shown:
|
||||
#PBX_LIBS+=$(shell $(CROSS_COMPILE_BIN)gtk-config --cflags >/dev/null 2>/dev/null && echo "pbx_gtkconsole.so")
|
||||
|
||||
- cd ./zaptel-1.2.21
|
||||
- cd ./zaptel-1.2.24
|
||||
- make clean
|
||||
- make
|
||||
- make install
|
||||
@@ -892,7 +893,7 @@ with the following patch:
|
||||
- make clean
|
||||
- make
|
||||
- make install
|
||||
- cd ../asterisk-1.2.24
|
||||
- cd ../asterisk-1.2.27
|
||||
- (1.2 tree) If you want to include Answering Machine Detection ability
|
||||
you will need to download app_amd.c and amd.conf and alter the
|
||||
apps/Makefile to compile it properly
|
||||
@@ -907,11 +908,11 @@ with the following patch:
|
||||
- wget http://www.eflo.net/files/amd2.conf
|
||||
- mkdir /etc/asterisk
|
||||
- mv amd2.conf /etc/asterisk/amd.conf
|
||||
*OPTIONAL*(1.2.23 thru 1.2.24) apply the meetme DTMF passthru patch
|
||||
*OPTIONAL*(1.2.23 thru 1.2.27) apply the meetme DTMF passthru patch
|
||||
- wget http://www.eflo.net/files/meetme_DTMF_passthru-1.2.23.patch
|
||||
- patch -p1 < ./meetme_DTMF_passthru-1.2.23.patch
|
||||
- File to patch: app_meetme.c
|
||||
*OPTIONAL*(1.2.12.1 thru 1.2.24) apply the meetme volume control patch
|
||||
*OPTIONAL*(1.2.12.1 thru 1.2.27) apply the meetme volume control patch
|
||||
*Different patches available for 1.2.7.1 through 1.2.14
|
||||
- wget http://www.eflo.net/files/meetme_volume_control_1.2.16.patch
|
||||
- patch -p1 < ./meetme_volume_control_1.2.16.patch
|
||||
@@ -923,9 +924,9 @@ with the following patch:
|
||||
- patch -p1 < ./cli_chan_concise_delimiter.patch
|
||||
- File to patch: cli.c
|
||||
|
||||
*OPTIONAL*(1.2.14 thru 1.2.24) rewrite of waitforsilence
|
||||
*OPTIONAL*(1.2.14 thru 1.2.27) rewrite of waitforsilence
|
||||
- wget http://www.eflo.net/files/app_waitforsilence.c
|
||||
- mv app_waitforsilence.c apps/app_waitforsilence.c
|
||||
- mv -f app_waitforsilence.c apps/app_waitforsilence.c
|
||||
|
||||
*OPTIONAL* shorter enter and leave sounds for meetme
|
||||
- wget http://www.eflo.net/files/enter.h
|
||||
@@ -966,7 +967,7 @@ them:
|
||||
- If you have chosen a Sangoma T1/E1 or analog card, you will need to
|
||||
follow their instructions for installation of their driver software
|
||||
LATEST Sangoma Wanpipe drivers:
|
||||
ftp://ftp.sangoma.com/linux/current_wanpipe/wanpipe-3.2.1.tgz
|
||||
ftp://ftp.sangoma.com/linux/current_wanpipe/wanpipe-3.2.4.tgz
|
||||
- now your asterisk installation is built and loaded and it's time to
|
||||
configure it.
|
||||
|
||||
@@ -1021,9 +1022,20 @@ musiconhold audio files to be converted to native formats like GSM, ULAW and ALA
|
||||
sox -r 44100 -w -s -c 1 fpm-world-mix.raw -r 8000 -c 1 fpm-world-mix.wav
|
||||
sox fpm-world-mix.wav -t gsm -r 8000 -b -c 1 fpm-world-mix.gsm
|
||||
sox fpm-world-mix.wav -t ul -r 8000 -b -c 1 fpm-world-mix.pcm
|
||||
rm -f *.raw
|
||||
mkdir ../orig-mp3
|
||||
mv -f *.mp3 ../orig-mp3/
|
||||
mkdir ../quiet-mp3
|
||||
cd ../quiet-mp3
|
||||
sox -r 44100 -w -s -c 1 ../mohmp3/fpm-sunshine.raw -r 8000 -c 1 -v 0.25 fpm-sunshine.wav
|
||||
sox fpm-sunshine.wav -t gsm -r 8000 -b -c 1 fpm-sunshine.gsm
|
||||
sox fpm-sunshine.wav -t ul -r 8000 -b -c 1 fpm-sunshine.pcm
|
||||
sox -r 44100 -w -s -c 1 ../mohmp3/fpm-calm-river.raw -r 8000 -c 1 -v 0.25 fpm-calm-river.wav
|
||||
sox fpm-calm-river.wav -t gsm -r 8000 -b -c 1 fpm-calm-river.gsm
|
||||
sox fpm-calm-river.wav -t ul -r 8000 -b -c 1 fpm-calm-river.pcm
|
||||
sox -r 44100 -w -s -c 1 ../mohmp3/fpm-world-mix.raw -r 8000 -c 1 -v 0.25 fpm-world-mix.wav
|
||||
sox fpm-world-mix.wav -t gsm -r 8000 -b -c 1 fpm-world-mix.gsm
|
||||
sox fpm-world-mix.wav -t ul -r 8000 -b -c 1 fpm-world-mix.pcm
|
||||
rm -f ../mohmp3/*.raw
|
||||
|
||||
|
||||
|
||||
@@ -1685,6 +1697,9 @@ GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@localhost ID
|
||||
# NOTE: if using MySQL 4.1.12 or higher you may need to run this query too:
|
||||
UPDATE mysql.user set password=OLD_PASSWORD('1234') where user='cron';
|
||||
|
||||
# NOTE: make sure you do NOT put any spaces or other punctuation in the
|
||||
# server_id, phone, extension, or user fields in the queries below if you edit them.
|
||||
|
||||
use asterisk;
|
||||
|
||||
\. /usr/share/astguiclient/MySQL_AST_CREATE_tables.sql
|
||||
@@ -2486,9 +2501,14 @@ exten => 8500998,2,Playback(silence)
|
||||
exten => 8500998,3,AGI(agi-dtmf.agi)
|
||||
exten => 8500998,4,Hangup
|
||||
|
||||
; prompt recording AGI script, ID is 4321
|
||||
; prompts for recording AGI script, ID is 4321
|
||||
; first variable is format (gsm/wav)
|
||||
; second variable is timeout in milliseconds (default is 360000 [6 minutes])
|
||||
exten => 8167,1,Answer
|
||||
exten => 8167,2,AGI(agi-record_prompts.agi,wav-----360000)
|
||||
exten => 8167,3,Hangup
|
||||
exten => 8168,1,Answer
|
||||
exten => 8168,2,AGI(agi-record_prompts.agi)
|
||||
exten => 8168,2,AGI(agi-record_prompts.agi,gsm-----360000)
|
||||
exten => 8168,3,Hangup
|
||||
|
||||
; playback of recorded prompts
|
||||
@@ -2791,8 +2811,10 @@ SUBPHASE 6.4: setting up asterisk and helper applications for startup
|
||||
# mke2fs -m 0 /dev/ram0
|
||||
# mount /dev/ram0 /var/spool/asterisk/monitor
|
||||
|
||||
### Path to local asterisk-perl_0.08 module if needed
|
||||
PERL5LIB="/usr/share/astguiclient/libs"; export PERL5LIB
|
||||
# Disable console blanking and powersaving
|
||||
/usr/bin/setterm -blank
|
||||
/usr/bin/setterm -powersave off
|
||||
/usr/bin/setterm -powerdown
|
||||
|
||||
### start time server
|
||||
/usr/local/bin/ntpdate -u 18.145.0.30
|
||||
@@ -2839,12 +2861,12 @@ SUBPHASE 6.5: setting up astguiclient scripts for continuous running
|
||||
- cd /usr/share/astguiclient
|
||||
- crontab -e
|
||||
- add the following entries(here's what we used):
|
||||
(Note if you have not edited the AST_CRON_mix_recordings.pl script
|
||||
to FTP to a different server, then you should use the
|
||||
AST_CRON_mix_recordings_BASIC.pl file in it's place)
|
||||
|
||||
### recording mixing for Asterisk run every 5 minutes
|
||||
1,6,11,16,21,26,31,36,41,46,51,56 * * * 1,2,3,4,5,6 /usr/share/astguiclient/AST_CRON_mix_recordings_BASIC.pl
|
||||
### recording mixing/compressing/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_3_ftp.pl --GSM
|
||||
|
||||
### keepalive script for astguiclient processes
|
||||
* * * * * /usr/share/astguiclient/ADMIN_keepalive_ALL.pl
|
||||
@@ -2963,6 +2985,7 @@ insert into vicidial_statuses values('XDROP','Agent Not Available IN','N','Y','U
|
||||
insert into vicidial_statuses values('NA','No Answer AutoDial','N','N','UNDEFINED');
|
||||
|
||||
insert into vicidial_statuses values('CALLBK','Call Back','Y','Y','UNDEFINED');
|
||||
insert into vicidial_statuses values('CBHOLD','Call Back Hold','N','Y','UNDEFINED');
|
||||
insert into vicidial_statuses values('A','Answering Machine','Y','N','UNDEFINED');
|
||||
insert into vicidial_statuses values('AA','Answering Machine Auto','N','N','UNDEFINED');
|
||||
insert into vicidial_statuses values('AM','Answering Machine Sent to Mesg','N','N','UNDEFINED');
|
||||
@@ -3091,10 +3114,7 @@ The browser requirements for this are:
|
||||
- Microsoft Internet Explorer 6.0
|
||||
|
||||
This version is fully functional and has been tested in our production
|
||||
call center with no problems. On RedHat 9.0 Linux workstations we have noticed
|
||||
a decrease in system load running the web-client as compared to the Perl/Tk
|
||||
client. Also, the memory usage stayed at about 22MB for a full shift of
|
||||
activity, so no memory leaks with Firefox.
|
||||
call center with no problems.
|
||||
|
||||
To log into this app you will need a login setup in the vicidial_users table
|
||||
with a user_level of 1 or greater as well as an entry for the phone you are
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,59 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# relay_control ip_relay startup/shutdown script
|
||||
#
|
||||
# Version: 1.0 ip_relay/relay_control 7-Feb-2003
|
||||
#
|
||||
# info@eflo.net
|
||||
#
|
||||
# This script is released under the BSD license
|
||||
# (for compatibility with the ip_relay project)
|
||||
# http://sourceforge.net/projects/iprelay/
|
||||
#
|
||||
# Thanks to Rachad ALAO (ralao@venus.org) for writing ip_relay
|
||||
#
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
|
||||
echo "starting up ip_relay services "
|
||||
|
||||
ip_relay 40569 127.0.0.1 4569 9999999 &
|
||||
ip_relay 41569 127.0.0.1 4569 9999999 &
|
||||
|
||||
echo "done "
|
||||
echo
|
||||
;;
|
||||
|
||||
status)
|
||||
|
||||
echo "current running processes "
|
||||
|
||||
ps -C ip_relay
|
||||
|
||||
echo "Done "
|
||||
exit 0
|
||||
;;
|
||||
|
||||
restart|reload)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
|
||||
stop)
|
||||
echo "Shutting down ip_relay services "
|
||||
|
||||
# Turn off IP Forwarding
|
||||
kill `ps -C ip_relay -o pid --no-heading`
|
||||
|
||||
echo "Done "
|
||||
|
||||
echo
|
||||
;;
|
||||
*)
|
||||
echo "Usage: relay_control {start|stop|status|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# install.pl
|
||||
#
|
||||
# Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
|
||||
# CHANGES
|
||||
@@ -10,6 +10,10 @@
|
||||
# 71012-1251 - Added PATHDONEmonitor setting
|
||||
# 71121-1048 - Added -p flag to mkdir to not show errors
|
||||
# 80110-0351 - Added --build_multiserver_conf flag to generate dynamic multi-server conf sections
|
||||
# 80330-0327 - Added ip_relay scripts for port forwarding
|
||||
# - Added build_phones_conf flag to generate phones conf entries from phones table records
|
||||
# - Added ip_relay to keepalive list
|
||||
# - Added $PATHlogs/archive for backups
|
||||
#
|
||||
|
||||
############################################
|
||||
@@ -42,7 +46,7 @@ $VARDB_user = 'cron';
|
||||
$VARDB_pass = '1234';
|
||||
$VARDB_port = '3306';
|
||||
# default keepalive processes:
|
||||
$VARactive_keepalives = '123456';
|
||||
$VARactive_keepalives = '1234568';
|
||||
# default recording FTP archive variables:
|
||||
$VARFTP_host = '10.0.0.4';
|
||||
$VARFTP_user = 'cron';
|
||||
@@ -158,6 +162,7 @@ if (length($ARGV[0])>1)
|
||||
print " 5 - AST_VDadapt (If multi-server system, this must only be on one server)\n";
|
||||
print " 6 - FastAGI_log\n";
|
||||
print " 7 - AST_VDauto_dial_FILL (only for multi-server, this must only be on one server)\n";
|
||||
print " 8 - ip_relay (used for blind agent monitoring)\n";
|
||||
print " [--copy_sample_conf_files] = copies the sample conf files to /etc/asterisk/\n";
|
||||
print " [--FTP_host=192.168.0.2] = define recording archive server IP address at runtime\n";
|
||||
print " [--FTP_user=cron] = define archive server name at runtime\n";
|
||||
@@ -178,6 +183,7 @@ if (length($ARGV[0])>1)
|
||||
print " [--fastagi_log_checkfordead=30] = define FastAGI log check-for-dead seconds\n";
|
||||
print " [--fastagi_log_checkforwait=60] = define FastAGI log check-for-wait seconds\n";
|
||||
print " [--build_multiserver_conf] = generates conf file examples for extensions.conf and iax.conf\n";
|
||||
print " [--build_phones_conf] = generates conf file examples for extensions.conf, sip.conf and iax.conf\n";
|
||||
print "\n";
|
||||
|
||||
exit;
|
||||
@@ -514,6 +520,7 @@ if (length($ARGV[0])>1)
|
||||
{
|
||||
$CLIcopy_conf_files='n';
|
||||
}
|
||||
|
||||
if ($args =~ /--fastagi_log_min_servers=/i) # CLI defined fastagi min servers
|
||||
{
|
||||
@CLIDB_minserARY = split(/--fastagi_log_min_servers=/,$args);
|
||||
@@ -653,18 +660,20 @@ if (length($ARGV[0])>1)
|
||||
}
|
||||
|
||||
$ext = "\nAdd the following lines to your extensions.conf file:\n";
|
||||
$ext .= "TRUNKloop = IAX2/ASTloop:test\@127.0.0.1:40569\n";
|
||||
$ext .= "TRUNKblind = IAX2/ASTblind:test\@127.0.0.1:41569\n";
|
||||
|
||||
$iax = "\nAdd the following lines to your iax.conf file:\n";
|
||||
$iax .= "#register => ASTloop:test\@$server_ip:40569\n";
|
||||
$iax .= "register => ASTloop:test\@127.0.0.1:40569\n";
|
||||
$iax .= "register => ASTblind:test\@127.0.0.1:41569\n";
|
||||
|
||||
$Lext = "\n";
|
||||
$Lext .= "; Local Server: $server_ip\n";
|
||||
$Lext .= "exten => _$VARremDIALstr*8600XXX,1,Goto(default,\${EXTEN:16},1)\n";
|
||||
$Lext .= "exten => _$VARremDIALstr*8600XXX*.,1,Goto(default,\${EXTEN:16},1)\n";
|
||||
$Lext .= "exten => _$VARremDIALstr*78600XXX,1,Goto(default,\${EXTEN:16},1)\n";
|
||||
$Lext .= "exten => _$VARremDIALstr*78600XXX*.,1,Goto(default,\${EXTEN:16},1)\n";
|
||||
$Lext .= "exten => _$VARremDIALstr*.,1,Goto(default,\${EXTEN:16},1)\n";
|
||||
$Lext .= "exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi)\n";
|
||||
$Lext .= "exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi)\n";
|
||||
$Lext .= "; Local blind monitoring\n";
|
||||
$Lext .= "exten => _08600XXX,1,Dial(\${TRUNKblind}/6\${EXTEN:1},55,o)\n";
|
||||
|
||||
$Liax .= "\n";
|
||||
$Liax .= "[ASTloop]\n";
|
||||
@@ -679,6 +688,19 @@ if (length($ARGV[0])>1)
|
||||
$Liax .= "allow=ulaw\n";
|
||||
$Liax .= "qualify=yes\n";
|
||||
|
||||
$Liax .= "\n";
|
||||
$Liax .= "[ASTblind]\n";
|
||||
$Liax .= "type=friend\n";
|
||||
$Liax .= "accountcode=IAXASTblind\n";
|
||||
$Liax .= "context=default\n";
|
||||
$Liax .= "auth=plaintext\n";
|
||||
$Liax .= "host=dynamic\n";
|
||||
$Liax .= "permit=0.0.0.0/0.0.0.0\n";
|
||||
$Liax .= "secret=test\n";
|
||||
$Liax .= "disallow=all\n";
|
||||
$Liax .= "allow=ulaw\n";
|
||||
$Liax .= "qualify=yes\n";
|
||||
|
||||
##### Get the server_id for this server's server_ip #####
|
||||
$stmtA = "SELECT server_id FROM servers where server_ip='$server_ip';";
|
||||
print "$stmtA\n";
|
||||
@@ -719,10 +741,7 @@ if (length($ARGV[0])>1)
|
||||
$iax .= "register => $server_id:test\@$server_ip[$i]:4569\n";
|
||||
|
||||
$Lext .= "; Remote Server VDAD extens: $server_id[$i] $server_ip[$i]\n";
|
||||
$Lext .= "exten => _$VARremDIALstr*8600XXX,1,Dial(\${TRUNK$server_id[$i]}/\${EXTEN:16},55,o)\n";
|
||||
$Lext .= "exten => _$VARremDIALstr*8600XXX*.,1,Dial(\${TRUNK$server_id[$i]}/\${EXTEN:16},55,o)\n";
|
||||
$Lext .= "exten => _$VARremDIALstr*78600XXX,1,Dial(\${TRUNK$server_id[$i]}/\${EXTEN:16},55,o)\n";
|
||||
$Lext .= "exten => _$VARremDIALstr*78600XXX*.,1,Dial(\${TRUNK$server_id[$i]}/\${EXTEN:16},55,o)\n";
|
||||
$Lext .= "exten => _$VARremDIALstr*.,1,Dial(\${TRUNK$server_id[$i]}/\${EXTEN:16},55,o)\n";
|
||||
|
||||
$Liax .= "\n";
|
||||
$Liax .= "[$server_id[$i]]\n";
|
||||
@@ -745,6 +764,134 @@ if (length($ARGV[0])>1)
|
||||
print "$ext$Lext\n$iax$Liax\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if ($args =~ /--build_phones_conf/i) # CLI defined conf files
|
||||
{
|
||||
$build_phones_conf='y';
|
||||
print " CLI phones conf gen: YES\n";
|
||||
|
||||
# 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 =~ /^PATHlogs/) && ($CLIlogs < 1) )
|
||||
{$PATHlogs = $line; $PATHlogs =~ 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;}
|
||||
$i++;
|
||||
}
|
||||
|
||||
# Customized Variables
|
||||
$server_ip = $VARserver_ip; # Asterisk server IP
|
||||
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;
|
||||
|
||||
$ext = "\nAdd the following lines to your extensions.conf file:\n";
|
||||
|
||||
$sip = "\nAdd the following lines to your sip.conf file:\n";
|
||||
|
||||
$iax = "\nAdd the following lines to your iax.conf file:\n";
|
||||
|
||||
$vm = "\nAdd the following lines to your voicemail.conf file:\n";
|
||||
|
||||
##### Get the SIP phone entries #####
|
||||
$stmtA = "SELECT extension,dialplan_number,voicemail_id,pass FROM phones where server_ip='$server_ip' and protocol='SIP';";
|
||||
print "$stmtA\n";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$i=0;
|
||||
while ($sthArows > $i)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$extension[$i] = "$aryA[0]";
|
||||
$dialplan[$i] = "$aryA[1]";
|
||||
$voicemail[$i] = "$aryA[2]";
|
||||
$pass[$i] = "$aryA[3]";
|
||||
|
||||
$ext .= "exten => $dialplan[$i],1,Dial(SIP/$extension[$i])\n";
|
||||
$ext .= "exten => $dialplan[$i],2,Voicemail,u$voicemail[$i]\n";
|
||||
|
||||
$sip .= "\[$extension[$i]\]\n";
|
||||
$sip .= "disallow=all\n";
|
||||
$sip .= "allow=ulaw\n";
|
||||
$sip .= "type=friend\n";
|
||||
$sip .= "username=$extension[$i]\n";
|
||||
$sip .= "secret=$pass[$i]\n";
|
||||
$sip .= "host=dynamic\n";
|
||||
$sip .= "dtmfmode=rfc2833\n";
|
||||
$sip .= "qualify=1000\n";
|
||||
$sip .= "mailbox=$voicemail[$i]\n\n";
|
||||
|
||||
$vm .= "$voicemail[$i] => $voicemail[$i],$extension[$i] Mailbox\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
##### Get the IAX phone entries #####
|
||||
$stmtA = "SELECT extension,dialplan_number,voicemail_id,pass FROM phones where server_ip='$server_ip' and protocol='IAX2';";
|
||||
print "$stmtA\n";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$i=0;
|
||||
while ($sthArows > $i)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$extension[$i] = "$aryA[0]";
|
||||
$dialplan[$i] = "$aryA[1]";
|
||||
$voicemail[$i] = "$aryA[2]";
|
||||
$pass[$i] = "$aryA[3]";
|
||||
|
||||
$ext .= "exten => $dialplan[$i],1,Dial(IAX2/$extension[$i])\n";
|
||||
$ext .= "exten => $dialplan[$i],2,Voicemail,u$voicemail[$i]\n";
|
||||
|
||||
$iax .= "\[$extension[$i]\]\n";
|
||||
$iax .= "disallow=all\n";
|
||||
$iax .= "allow=ulaw\n";
|
||||
$iax .= "context=default\n";
|
||||
$iax .= "type=friend\n";
|
||||
$iax .= "accountcode=$extension[$i]\n";
|
||||
$iax .= "secret=$pass[$i]\n";
|
||||
$iax .= "auth=md5\n";
|
||||
$iax .= "host=dynamic\n";
|
||||
$iax .= "permit=0.0.0.0/0.0.0.0\n";
|
||||
$iax .= "qualify=1000\n";
|
||||
$iax .= "mailbox=$voicemail[$i]\n\n";
|
||||
|
||||
$vm .= "$voicemail[$i] => $voicemail[$i],$extension[$i] Mailbox\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
|
||||
print "$ext\n$sip\n$iax\n$vm\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1412,6 +1559,7 @@ else
|
||||
print " 5 - AST_VDadapt (If multi-server system, this must only be on one server)\n";
|
||||
print " 6 - FastAGI_log\n";
|
||||
print " 7 - AST_VDauto_dial_FILL (only for multi-server, this must only be on one server)\n";
|
||||
print " 8 - ip_relay (used for blind agent monitoring)\n";
|
||||
print "Enter active keepalives or press enter for default: [$VARactive_keepalives] ";
|
||||
$PROMPTactive_keepalives = <STDIN>;
|
||||
chomp($PROMPTactive_keepalives);
|
||||
@@ -1909,7 +2057,7 @@ print conf "VARDB_pass => $VARDB_pass\n";
|
||||
print conf "VARDB_port => $VARDB_port\n";
|
||||
print conf "\n";
|
||||
print conf "# Alpha-Numeric list of the astGUIclient processes to be kept running\n";
|
||||
print conf "# (value should be listing of characters with no spaces: 123456)\n";
|
||||
print conf "# (value should be listing of characters with no spaces: 1234568)\n";
|
||||
print conf "# X - NO KEEPALIVE PROCESSES (use only if you want none to be keepalive)\n";
|
||||
print conf "# 1 - AST_update\n";
|
||||
print conf "# 2 - AST_send_listen\n";
|
||||
@@ -1918,6 +2066,7 @@ print conf "# 4 - AST_VDremote_agents\n";
|
||||
print conf "# 5 - AST_VDadapt (If multi-server system, this must only be on one server)\n";
|
||||
print conf "# 6 - FastAGI_log\n";
|
||||
print conf "# 7 - AST_VDauto_dial_FILL (only for multi-server, this must only be on one server)\n";
|
||||
print conf "# 8 - ip_relay (used for blind agent monitoring)\n";
|
||||
print conf "VARactive_keepalives => $VARactive_keepalives\n";
|
||||
print conf "\n";
|
||||
print conf "# FTP recording archive connection information\n";
|
||||
@@ -1961,9 +2110,16 @@ if ($WEBONLY < 1)
|
||||
`mkdir -p $PATHmonitor`;
|
||||
`mkdir -p $PATHDONEmonitor`;
|
||||
`mkdir -p $PATHDONEmonitor/ORIG`;
|
||||
`mkdir -p $PATHDONEmonitor/GSM`;
|
||||
`mkdir -p $PATHDONEmonitor/MP3`;
|
||||
`mkdir -p $PATHDONEmonitor/OGG`;
|
||||
`mkdir -p $PATHDONEmonitor/FTP`;
|
||||
`chmod -R 0766 $PATHmonitor`;
|
||||
`chmod -R 0766 $PATHDONEmonitor`;
|
||||
|
||||
print "Creating $PATHlogs/archive directory for backups...\n";
|
||||
`mkdir -p $PATHlogs/archive`;
|
||||
|
||||
print "Copying bin scripts to $PATHhome ...\n";
|
||||
`cp -f ./bin/* $PATHhome/`;
|
||||
|
||||
@@ -1987,6 +2143,19 @@ if ($WEBONLY < 1)
|
||||
|
||||
print "Copying sounds to $PATHsounds...\n";
|
||||
`cp -f ./sounds/* $PATHsounds/`;
|
||||
|
||||
print "Copying ip_relay scripts to $PATHhome...\n";
|
||||
`cp -fR ./extras/ip_relay $PATHhome/`;
|
||||
|
||||
print "Setting ip_relay scripts to executable...\n";
|
||||
`chmod 0755 $PATHhome/ip_relay/relay_control`;
|
||||
`chmod 0755 $PATHhome/ip_relay/ip_relay_linux_i386`;
|
||||
`ln -s $PATHhome/ip_relay/ip_relay_linux_i386 $PATHhome/ip_relay/ip_relay`;
|
||||
`ln -s $PATHhome/ip_relay/ip_relay_linux_i386 /usr/bin/ip_relay`;
|
||||
`ln -s $PATHhome/ip_relay/ip_relay_linux_i386 /usr/local/bin/ip_relay`;
|
||||
|
||||
print "Starting ip_relay port forwarding for IAX on 40569 and 41569\n";
|
||||
`$PATHhome/ip_relay/relay_control start 2>/dev/null 1>&2`;
|
||||
}
|
||||
if ($NOWEB < 1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user