running script problem

General and Support topics relating to ViciDialNow and GoAutoDial ISO installers

Moderators: enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, s0lid

running script problem

Postby gcleffff » Wed Jun 24, 2009 7:27 pm

im having problem running the script /usr/share/astguiclient/AST_CRON_audio_3_ftp.pl could someone help me, im using vicidialnow.
im getting this errors (Can't call method "login" on an undefined value at /usr/share/astguiclient/AST_CRON_audio_3_ftp.pl line 265.) or (nothing happens the recordings wont transfer as it should be).
gcleffff
 
Posts: 20
Joined: Wed Jun 24, 2009 6:47 pm

Postby williamconley » Thu Jun 25, 2009 7:38 pm

how are you trying to run this command, and where did you find the instructions for its use (and did you follow those instructions?)?
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Postby gcleffff » Thu Jun 25, 2009 7:44 pm

by typing this command (#/usr/share/astguiclient/AST_CRON_audio_3_ftp.pl) in my asterisk server where the recordings are.

yes i followed all the instructions and configurations, i can ftp from my asterisk server to my ftp server, i also tried to transfer a single file using send command at ftp> it went well.
gcleffff
 
Posts: 20
Joined: Wed Jun 24, 2009 6:47 pm

Postby williamconley » Thu Jun 25, 2009 8:04 pm

have you verified the settings in astguiclient.conf?
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Postby gcleffff » Thu Jun 25, 2009 8:08 pm

yes as far as i know the configuration on astguiclient.conf is correct.
gcleffff
 
Posts: 20
Joined: Wed Jun 24, 2009 6:47 pm

Postby gcleffff » Fri Jun 26, 2009 11:28 pm

can someone help its not resolved yet
gcleffff
 
Posts: 20
Joined: Wed Jun 24, 2009 6:47 pm

Postby williamconley » Sat Jun 27, 2009 12:09 am

sorry, i never use this script, we do all this stuff manually off the boxes or clients do it like the manual says and it works. never had a problem with it, so i've never "looked inside".

have you tried running the lines one at a time to find the error? if it's having a login issue .. where does it get it's login information (i would assume from astguiclient.conf ..., but you can look ...) and have you tried executing the commands with the info from (wherever) manually to see if they execute manually ...
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Postby gcleffff » Sat Jun 27, 2009 12:14 am

ive got 4 asterisk servers when i ran the script manually by typing the script nothing happen but when i ran it with 1 of my server the 4th one its running but with errors the error says something like "mv: cannot stat ...... no such file or directory" i look both the destination and source its there. astguiclient conf is fine. i think theres something wrong with the script, its written in perl i think, unfortunately i have little understanding deciphering the code of perl script its different from vb. a help or opinion or suggestion is very appreciated thanks.
gcleffff
 
Posts: 20
Joined: Wed Jun 24, 2009 6:47 pm

Postby gcleffff » Sat Jun 27, 2009 12:17 am

and the script when run will transfer the recordings automatically from local GSM folder to local FTP folder and from local FTP to remote FTP server. the only thing that is working when i run the script is from GSM to FTP locally.
gcleffff
 
Posts: 20
Joined: Wed Jun 24, 2009 6:47 pm

Postby gardo » Sat Jun 27, 2009 12:45 pm

/usr/share/astguiclient/AST_CRON_audio_3_ftp.pl is the third step in the Vicidial audio archival process. You should check if the first two steps are successful before running the last script.
http://goautodial.com
Empowering the next generation contact centers
gardo
 
Posts: 1926
Joined: Fri Sep 15, 2006 10:24 am
Location: Manila, 1004

Postby gcleffff » Sun Jun 28, 2009 4:10 pm

yes the first 2 is working as it should be but the last when i run it nothing happen on my 3 servers but on my 4th server the error occur as stated at my last post.
gcleffff
 
Posts: 20
Joined: Wed Jun 24, 2009 6:47 pm

Postby okli » Mon Jun 29, 2009 4:53 am

Lets have a look:

Can't call method "login" on an undefined value at /usr/share/astguiclient/AST_CRON_audio_3_ftp.pl line 265
Bolding is mine.

Line 265:
Code: Select all
$ftp->login("$VARFTP_user","$VARFTP_pass");

$VARFTP_user and $VARFTP_pass are coming by parsing astguiclient.conf:

Code: Select all
...
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;}...


So is the directory, where the files will be copied from:
Code: Select all
### 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";}


Code: Select all
...if ( ($line =~ /^PATHDONEmonitor/) && ($CLIDONEmonitor < 1) )
      {$PATHDONEmonitor = $line;   $PATHDONEmonitor =~ s/.*=//gi;}...


1) Post your astguiclient.conf file, hiding your passwords and public IP if you have such.
2) Post your crontab entry for AST_CRON_audio_3_ftp.pl. Do you have --GSM switch in it?
okli
 
Posts: 671
Joined: Mon Oct 01, 2007 5:09 pm

Postby gardo » Mon Jun 29, 2009 11:38 am

Have you tried editing the variables directly in "/usr/share/astguiclient/AST_CRON_audio_3_ftp.pl"?

# 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';
http://goautodial.com
Empowering the next generation contact centers
gardo
 
Posts: 1926
Joined: Fri Sep 15, 2006 10:24 am
Location: Manila, 1004

Postby gcleffff » Mon Jun 29, 2009 4:52 pm

yes gardo i did edit it directly, still it wont transfer from and to my ftp server.

how can i post my configuration the site is restricting to anything from codes, to u r l, link images etc.
gcleffff
 
Posts: 20
Joined: Wed Jun 24, 2009 6:47 pm

Postby okli » Mon Jun 29, 2009 6:16 pm

Those values would be overridden when parsing astguiclient.conf in script.

Gardo, do you think astguiclient.conf is not parsed properly? That part of the script is standard in probably every vicidial script, if values are not parsed properly there would be so many other errors on this installation...


@gcleffff
Not sure how many posts you have to make until posting restrictions are lifted. Can you try now?
okli
 
Posts: 671
Joined: Mon Oct 01, 2007 5:09 pm

Postby williamconley » Mon Jun 29, 2009 6:27 pm

have you tried making your own script with that one simple command on it to see if it tosses an error?
(perhaps "pare down" the existing script by halves until you end up with just that one thing executing ... the error has to be in there somewhere, right?)
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Postby gcleffff » Mon Jun 29, 2009 6:44 pm

@williamconley
the problem is i dont know how to make a script out of perl, i only understand a few of it since i only know about vb.


@okli
still cant do.
gcleffff
 
Posts: 20
Joined: Wed Jun 24, 2009 6:47 pm

Postby williamconley » Mon Jun 29, 2009 6:55 pm

but you have executed the ftp command straight from the command line to be sure it works?

Wait a minute: if you know vb, why don't you write your own script and skip this one? it's just a file transfer, right?
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Postby okli » Mon Jun 29, 2009 6:56 pm

Can you simply copy-paste astguiclient.conf file, without quoting, code or anything extra? Remember to remove passwords or other sensetive information.

edit:

Lets summarize what's in your posts:

1) On all but one machine GSM to FTP is not working
2) On one machine GSM to local FTP is working
3) You want to FTP all those recording from the FTP you put them on to another place, correct? How did you set this up or expect it to happen?

Is all the above correct?
okli
 
Posts: 671
Joined: Mon Oct 01, 2007 5:09 pm

Postby gcleffff » Mon Jun 29, 2009 7:24 pm

@okli
i already tried that copy and pasting the file and removing sensitive information, it always bring me to that strict page.

next:
1. on all machine local GSM folder to local FTP folder working
2. local FTP folder to FTP server folder by running the script not working.

what i expect is when i run the script by typing the command (/usr/share/astguiclient/AST_CRON_audio_3_ftp.pl --GSM) into the command line, the recordings from the local ftp folder will automatically transfer to ftp server as the script would supposed to do right?

@william
yes i know how to make a vb script, whats the use of the script that comes with the vicidialnow if it aint working, i mean its in there right it comes with the package, i need not to bother writing my own script that would save me time, all i have to do is make it work :| and a big help from you guys. :D
gcleffff
 
Posts: 20
Joined: Wed Jun 24, 2009 6:47 pm

Postby okli » Mon Jun 29, 2009 7:55 pm

The purpose of this script is to gather files from recordings folder ( GSM, WAV or whatever) and upload them on FTP server.

Why do you need to upload them to local FTP server then move them again?

You can upload them directly to the "final" FTP, the idea of this script is this.
okli
 
Posts: 671
Joined: Mon Oct 01, 2007 5:09 pm

Postby gcleffff » Mon Jun 29, 2009 8:49 pm

so what your saying is from GSM, WAV etc when run it will upload directly to the ftp server, why is that when i run the script recordings it only transfer from GSM, WAV etc to local FTP not to FTP server.
gcleffff
 
Posts: 20
Joined: Wed Jun 24, 2009 6:47 pm

Postby williamconley » Mon Jun 29, 2009 9:02 pm

semantics. why are you calling it a "local ftp" folder?
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Postby gcleffff » Mon Jun 29, 2009 9:25 pm

pardon me im newbie...
gcleffff
 
Posts: 20
Joined: Wed Jun 24, 2009 6:47 pm

Postby williamconley » Mon Jun 29, 2009 9:36 pm

LOL. Not pickin. Serious: Is it an "FTP Folder" of some sort? is it published as a folder for an FTP server?

I think it's just a folder to drop the files into after mixing. They must have a "Home".

But then if you don't want their Permanent home to be on this box, you fire up some sort of script to move them ... elsewhere.

I use SCP in a crontab, but you CAN use anything, really. A daily script that says "take all files over 48hours old from HERE and move them THERE". Language aside, that's not a hard script to write. Especially if you skip the "age" part.

But DO remember to get confirmation that they actually copied before deleting the old ones if you don't use a "move" command of some sort (opt first for "move" as opposed to "copy" then "delete", but confirm if you must "copy").
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Postby gcleffff » Mon Jun 29, 2009 10:02 pm

ok. hehehe.
lets try it again.

this is the asterisk server where vicidialnow is installed:
ive got this folder (/var/spool/asterisk/monitorDONE) <this is where the recordings and mixing takes place, inside it there are FTP, GSM, MP3 folder etc.... running the 3rd script which is the AST_CRON_audio_3_ftp will do automatic transfer from the (/var/spool/asterisk/monitorDONE/FTP/) folder to FTP server right?.

now when i run the script all the recordings from this folder (/var/spool/asterisk/monitorDONE/GSM) transfers to this folder (/var/spool/asterisk/monitorDONE/FTP) and stops there.

it should be transferring from this /var/spool/asterisk/monitorDONE/FTP to the ftp server i specify in the astguiclient.conf right?
gcleffff
 
Posts: 20
Joined: Wed Jun 24, 2009 6:47 pm

Postby williamconley » Mon Jun 29, 2009 11:15 pm

and you are sure it is reaching into the FTP folder to attempt the transfer, not some other folder /monitorDONE or something (thus failing and leaving them in the ftp folder, because they weren't where it looked) according to your setup?

does that script have a debug option?
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Postby gcleffff » Mon Jun 29, 2009 11:26 pm

yes im sure its in there in fact im doing the transfer from that folder manually using scp.

not sure about debug, heres the script
Code: Select all
### 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;
gcleffff
 
Posts: 20
Joined: Wed Jun 24, 2009 6:47 pm

Postby williamconley » Mon Jun 29, 2009 11:48 pm

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 means that it has a debug option or two. You may want to try them.
$ftp->put("$dir2/$ALLfile", "$ALLfile");
I think this is the attempted transfer of a file. Doesn't say anything about /FTP.
`mv -f "$dir2/$ALLfile" "$PATHDONEmonitor/FTP/$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.
if ($ping_good)
Of course, it would appear that one must be able to Ping the server in question first.

So what do you have for a folder in your astguiclient.conf?

Can you ping the ftp server from the vicidial server?

Have you run it with super debug to see if it tosses an error?
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Postby gcleffff » Tue Jun 30, 2009 12:12 am

So what do you have for a folder in your astguiclient.conf?
Code: Select all
# FTP recording archive connection information
VARFTP_host => myftpserver
VARFTP_user =>
VARFTP_pass =>
VARFTP_port => 21
VARFTP_dir => RECORDINGS
VARHTTP_path =>  myftpserver/RECORDINGS


Can you ping the ftp server from the vicidial server?
Code: Select all
yes i can ping it.


Have you run it with super debug to see if it tosses an error?
Code: Select all
i havent tried it yet, unfortunately im a noob i dont know how :)
[/code]
gcleffff
 
Posts: 20
Joined: Wed Jun 24, 2009 6:47 pm

Postby williamconley » Tue Jun 30, 2009 12:38 am

scripts are run as "./scriptname" (that would be dot slash filename with no spaces, including extension if there is one).

they can also be run by executing the program that will interpret them (in this case it is a perl script ... so ... "perl scriptname") but i don't like that version.

options (in this case) are entered as "./scriptname --option"
[--debug] = debug\n [--debugX

so:
./scriptname --debugX

you can either cd to the directory it is in first or you can put the entire path in place of "scriptname"

yes i can ping it.
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!)

VARFTP_dir => RECORDINGS
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 ...)

I never use this script, so I'm guessing (you could probably read the manual and get this easier, or you can follow my ramblings, but please do so at your own risk ...)
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Postby okli » Tue Jun 30, 2009 4:30 am

Lets read the script a bit more.
The original script you are using will do the following:

1) Put all files from $dir2 to the FTP server/directory specified in astguiclient.conf

Code: Select all
$ftp->put("$dir2/$ALLfile", "$ALLfile");
where $dir2 is:
Code: Select all
if ($WAV > 0) {$dir2 = "$PATHDONEmonitor";}
if ($MP3 > 0) {$dir2 = "$PATHDONEmonitor/MP3";}
if ($GSM > 0) {$dir2 = "$PATHDONEmonitor/GSM";}
if ($OGG > 0) {$dir2 = "$PATHDONEmonitor/OGG";}
where $PATHDONEmonitor is usually /var/spool/asterisk/monitorDONE, specified in astguiclient.conf.

2) Move all files from $dir2 to $PATHDONEmonitor/FTP/:
Code: Select all
`mv -f "$dir2/$ALLfile" "$PATHDONEmonitor/FTP/$ALLfile"`;


3) Update recording_log table with the new location of the files:
Code: Select all
$stmtA = "UPDATE recording_log set location='$VARHTTP_path/$start_date_PATH$ALLfile' where recording_id='$recording_id';";


If 1) fails (wrong permissions to FTP user on the FTP server to write to RECORDINGS directory, firewall issues etc. etc.) 2) and 3) will still be performed. Here is where your confusion comes from. Seeing files moved to $PATHDONEmonitor/FTP/ , but not in the FTP server dedicated directory (you checked, right?) you think this is script expected behavior, but it is not.

I posted in Mantis a while ago slightly modified version of the same script:
http://www.eflo.net/VICIDIALmantis/view.php?id=197

The original script was modified so it compares file sizes of the transferred file with the original, and:

-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.

The improvement is that if your FTP server is not accessible/unable to write to, but still pingable, files will not be moved to monitorDONE/FTP/, thus making it much easier to troubleshoot until you set up FTP server properly. Otherwise you'd have to move all files back and forth between monitorDONE/FTP/ and monitorDONE/.

You may try it, as well as you'd need to ensure your FTP user on the FTP server has rights to write to the folder specified:
http://www.google.com/search?hl=en&q=ft ... 9&ie=UTF-8



Is all this getting any clearer? Perl is really easy to read, Google is always your (and Perl's) friend.
okli
 
Posts: 671
Joined: Mon Oct 01, 2007 5:09 pm

Postby gcleffff » Tue Jun 30, 2009 11:00 pm

aha!!! i think the user rights from my FTP server is not set.. thanks okli ill check it if that works...

so the process is....
recordings then to the monitordone folders then to ftp folder then update the db then transfer?
gcleffff
 
Posts: 20
Joined: Wed Jun 24, 2009 6:47 pm


Return to ViciDialNow - GoAutoDial

Who is online

Users browsing this forum: Google [Bot] and 26 guests