Blog

How to set up (and recover) Vicidial audio recording conversion and FTP to an archive server.

I have a large volume customer with a Vicidial cluster that I set up to convert call recordings to MP3 format and FTP them to an archive server where they are cataloged and accessible via a lookup tool. Everything was working great until their FTP server went down and they didn't realize it for 14 days. This post outlines how to set up audio conversion and FTP, and what was done to get the 14 days of recordings moved over to the archive server.  

Background....

The process for converting and sending call recordings to an archive server is pretty simple to get set up. The first step is to setup the FTP path and credentials in the astguiclient.conf file: 

# vi /etc/astguiclient.conf

# FTP recording archive connection information

VARFTP_host => 192.168.1.10
VARFTP_user => ftpuser
VARFTP_pass => ftppass
VARFTP_port => 21
VARFTP_dir => RECORDINGS
VARHTTP_path => 192.168.1.10


Once the configuration file is updated all that is needed is to edit the crontab to convert the .wav files to .mp3 and ftp them to the archive server.  

# crontab - e

### 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_mix.pl --MIX
#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 --MP3
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 --MP3


Uncomment the lines as above and add the —MP3 flag to the “AST_CRON_audio_2_compress.pl"  and “AST_CRON_audio_3_ftp.pl"  lines.

Save the changes and the server is now set up to convert the recordings to mp3 and FTP the files to your archive server every 3 min. 

Now to the Fix.... 

This process was working great for years until the FTP server went down.  The Vicidial server still ran the cron processes to convert and ftp the files over, but the files were not able to be moved.  

Once I discovered the FTP server was down I started it back up and ran the ./AST_CRON_audio_3_ftp.pl —MP3 —debugX command thinking it would pickup the files that were not FTP’ed to the archive server and send them on their way.  Unfortunately this was not the case.  

I took a look at the code in the AST_CRON_audio_3_ftp.pl file and discovered that it moves files from /var/spool/asterisk/monitorDONE/MP3 directory to the /var/spool/asterisk/monitorDONE/FTP directory regardless of wether or not the FTP transfer was successful or not.   

The solution was to move the 14 days worth of MP3 files back over to the MP3 directory and then run the ./AST_CRON_audio_3_fto.pl —MP3 --debugX  command.   

The command to get the files moved from the FTP directory back to the MP3 directory is:

# find /var/spool/asterisk/monitorDONE/FTP/ -type f -mtime -14 -name “*.mp3” -exec mv {} /var/spool/asterisk/monitorDONE/MP3/ \;

To set the number of days change the  “-mtime” value to the days needed.  In my case it was 14.  

now run: 

/usr/share/astguiclient/AST_CRON_audio_3_ftp.pl --MP3 --debugX

You should see the files being sent to your FTP server. 
 


Add Comment