Moderators: enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, s0lid
Bolding is mine.Can't call method "login" on an undefined value at /usr/share/astguiclient/AST_CRON_audio_3_ftp.pl line 265
$ftp->login("$VARFTP_user","$VARFTP_pass");
...
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;}...
### directory where -all recordings are
if ($WAV > 0) {$dir2 = "$PATHDONEmonitor";}
if ($MP3 > 0) {$dir2 = "$PATHDONEmonitor/MP3";}
if ($GSM > 0) {$dir2 = "$PATHDONEmonitor/GSM";}
if ($OGG > 0) {$dir2 = "$PATHDONEmonitor/OGG";}
...if ( ($line =~ /^PATHDONEmonitor/) && ($CLIDONEmonitor < 1) )
{$PATHDONEmonitor = $line; $PATHDONEmonitor =~ s/.*=//gi;}...
### 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;
if ($DB) {print "\n----- NO DATE DIRECTORIES -----\n\n";}
}
if ($args =~ /--GSM/i)
{
$GSM=1;
if ($DB) {print "GSM audio files\n";}
}
else
{
if ($args =~ /--MP3/i)
{
$MP3=1;
if ($DB) {print "MP3 audio files\n";}
}
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 Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second
use DBI;
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
or die "Couldn't connect to database: " . DBI->errstr;
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);
### Loop through files first to gather filesizes
$i=0;
foreach(@FILES)
{
$FILEsize1[$i] = 0;
if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") )
{
$FILEsize1[$i] = (-s "$dir1/$FILES[$i]");
if ($DBX) {print "$FILES[$i] $FILEsize1[$i]\n";}
}
$i++;
}
sleep(5);
### Loop through files a second time to gather filesizes again 5 seconds later
$i=0;
foreach(@FILES)
{
$FILEsize2[$i] = 0;
if ( (length($FILES[$i]) > 4) && (!-d "$dir1/$FILES[$i]") )
{
$FILEsize2[$i] = (-s "$dir1/$FILES[$i]");
if ($DBX) {print "$FILES[$i] $FILEsize2[$i]\n\n";}
if ( ($FILES[$i] !~ /out\.|in\.|lost\+found/i) && ($FILEsize1[$i] eq $FILEsize2[$i]) && (length($FILES[$i]) > 4))
{
$recording_id='';
$ALLfile = $FILES[$i];
$SQLFILE = $FILES[$i];
$SQLFILE =~ s/-all\.wav|-all\.gsm|-all\.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();
# $p = Net::Ping->new("icmp");
$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
### sleep for twenty hundredths of a second to not flood the server with disk activity
usleep(1*200*1000);
}
}
$i++;
}
if ($DB) {print "DONE... EXITING\n\n";}
$dbhA->disconnect();
exit;
I think this means that it has a debug option or two. You may want to try them.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";
I think this is the attempted transfer of a file. Doesn't say anything about /FTP.$ftp->put("$dir2/$ALLfile", "$ALLfile");
This comes after the file has transferred. In fact it would appear that the FTP is a storage folder for AFTER they have been transferred.`mv -f "$dir2/$ALLfile" "$PATHDONEmonitor/FTP/$ALLfile"`;
Of course, it would appear that one must be able to Ping the server in question first.if ($ping_good)
# FTP recording archive connection information
VARFTP_host => myftpserver
VARFTP_user =>
VARFTP_pass =>
VARFTP_port => 21
VARFTP_dir => RECORDINGS
VARHTTP_path => myftpserver/RECORDINGS
yes i can ping it.
i havent tried it yet, unfortunately im a noob i dont know how :)
[--debug] = debug\n [--debugX
./scriptname --debugX
can you ping it FROM THE VICIDIAL SERVER. (it makes a difference, and yes firewalls and other settings often cause one to spend HOURS trying to resolve something that is this simple, i HAVE to ask!)yes i can ping it.
That's where they are GOING, where are they coming from? What do you have for the monitor paths? Oh, and there IS a RECORDINGS folder where the ftp server is sending these files, right? (after all, that's the folder it's trying to put them in ...)VARFTP_dir => RECORDINGS
$ftp->put("$dir2/$ALLfile", "$ALLfile");
if ($WAV > 0) {$dir2 = "$PATHDONEmonitor";}
if ($MP3 > 0) {$dir2 = "$PATHDONEmonitor/MP3";}
if ($GSM > 0) {$dir2 = "$PATHDONEmonitor/GSM";}
if ($OGG > 0) {$dir2 = "$PATHDONEmonitor/OGG";}
`mv -f "$dir2/$ALLfile" "$PATHDONEmonitor/FTP/$ALLfile"`;
$stmtA = "UPDATE recording_log set location='$VARHTTP_path/$start_date_PATH$ALLfile' where recording_id='$recording_id';";
-if file size matches, and --DELETE is used file will be deleted from source directory
-if file size matches, and --DELETE is NOT used, file will be moved to /var/spool/asterisk/monitorDONE/FTP/ directory as normal
-if file size does NOT match, error message with file name is displayed and files are not moved nor deleted.
Return to ViciDialNow - GoAutoDial
Users browsing this forum: No registered users and 46 guests