[asterisk-users] Call Recording and Posting

Ivan Stepaniuk ivan at albafotonica.com
Mon Oct 12 16:12:02 CDT 2009


Dan Journo wrote:
> Thank you for replying. I hadn't thought about the problem of simultaneous calls. It would be a problem if a number of calls ended at the same time.
>
> If you can post it, the script would really be helpful as I'm only a beginner with Linux
    The script is very simple and far from complete, it just moves the 
content into the mounted FTP directory. It has some verbose output as it 
is run from inside another script that redirects the output to a log file.
    The script has a password inside so remember to 'chown root' and 
'chmod 700' the file to protect it from other users.
    You have to set up a cron so the script is run every hour, normally 
putting the script or a link to it inside '/etc/cron.hourly' is enough. 
There is also a /etc/crontab file you can use to setup something more 
complicated if needed (ie: runing it every 2 hours, running at tea 
time...). read 'man cron', and 'man crontab'. 
    You also need to install the magic part, 'curlftps'. in Debian 
that's the name of the package too. I use version curlftpfs 0.9.1 
libcurl/7.18.2 fuse/2.5
    Be careful that in *nix, file.WAV and file.wav are different files.

Here is the script:

#!/bin/sh

MOUNT_POINT="/mnt/remote_ftp"
FTP_HOST="www.ftphost.com/htdocs/recordings"
FTP_USER="ftpusername:difficultpassword"
RECORDINGS="/var/spool/asterisk/monitor/upload"

echo "Starting upload `date` "
echo "Connecting to $FTP_HOST..."
curlftpfs -o user="$FTP_USER" "$FTP_HOST" "$MOUNT_POINT"

echo "Transfering `du -hc "$RECORDINGS"/*.wav | grep total` ..."
mv -vf "$RECORDINGS"/*.wav "$MOUNT_POINT"

echo "Disconnecting."
umount "$MOUNT_POINT"

exit 0

-- 
Iván Stepaniuk
Alba Fotónica S. L.
www.albafotonica.com




More information about the asterisk-users mailing list