FOOD FOR THOUGHT archiving recorded calls

Sam Sanders

New Member
Joined
Jul 23, 2014
Messages
6
Reaction score
0
lqqqqqqqqqqqqqqqqqqqqqqqqSYSTEM INFORMATIONqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x Asterisk = ONLINE | Dahdi = ONLINE | MySQL = ONLINE x
x SSH = ONLINE | Apache = ONLINE | Iptables = ONLINE x
x Fail2ban = ONLINE | Internet = ONLINE | Ip6Tables = ONLINE x
x Disk Free = ADEQUATE| Mem Free = ADEQUATE| NTPD = ONLINE x
x SendMail = ONLINE | Samba = ONLINE | Webmin = ONLINE x
x Ethernet0 = ONLINE | Ethernet1 = N/A | Wlan0 = N/A x
x x
x PIAF Installed Version = 2.0.6.4 under *VMWARE* x
x FreePBX Version = 2.11.0.37 x
x 2.11 x
x Running Asterisk Version = 11.5.1 x
x Asterisk Source Version = 11.5.1 x
x Dahdi Source Version = 2.7.0.1 x
x Libpri Source Version = 1.4.14 x
x Operating System = CentOS release 6.4 (Final) x
x Kernel Version = 2.6.32-358.6.2.el6.i686 - 32 Bit x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

It's running on a ESXi 5.0 hyper visor;
with 2G Memory, and 1 CPU allocated to it.

I'm looking for suggestions on how to automate the archiving of the recorded calls. The requirement is to keep all calls for 7 years or more. I installed the PBXinaFlash system about 10 months ago now. It's been a pleasure to work with compared to the Cisco CUCM that it replaced. :) After the first week I tossed together a solution, I think was hacky.

I enabled Samba to share the /monitor directory. Then I wrote a scheduled task in windows that runs every night, to use robocopy to copy all the new files in /monitor to a windows share. Then I manually check the disk space left on the PBXinaFlash server, with it get low I delete off the oldest call recording. Then if anyone needs a recording, they just email me and I look it up for them.

The problem with that is I have to be involved in the process, now I have showed my coworkers how to do this, but I would rather not have any manually processes. It would be nice if the users could look at the archive files, from the Users Web Interface from PBXinaFlash. The only thing I could think of was to write my own web app to search all at the archive files.

Also it would be nice if I could re-code the audio files with a GSM after say a year of being recorded.
 

AndyInNYC

Active Member
Joined
May 23, 2013
Messages
772
Reaction score
124
Since you have the ability to write a web app, why not create a cron job to copy all new recordings every X minutes (not sure if files are put in monitor while the call is ongoing) to a larger/non-PIAF drive.

Then your app need only look at the non-PIAF drive at all times (less the instant a call ends). The file names include all the info you would use to add to your index (in/out, date, time, etc.) so you can use the files copied to add to your lookup.

Probably easier than trying to hack a solution that looks at both the PIAF directories and your offline version.

You could also, rather than copy, look to see if the filename exists on the target and do your recoding when you move it over (assumes your machine has enough horsepower) or move to a temp directory on the new machine and have those files transcoded then deleted before hitting the permanent directory.

You could then have a separate cron job checking available disk space and delete files older than X. I know this can be done, but I haven't a clue how to do this.

Good luck with the project.
 

Sam Sanders

New Member
Joined
Jul 23, 2014
Messages
6
Reaction score
0
Thanks for the reply,
I'll give that some thought.

Yesterday I found SOX a sound file converter.
http://sox.sourceforge.net/
I was able to reduce the file size by ~90% with this command.

Code:
sox PIAF.wav -e gsm-full-rate outfile.wav

If you get a dll library for mp3 from the files...
libmad-0.dll
libmp3lame-0.dll

You can use this command to reduce the file size by ~95%.

Code:
sox PIAF.wav outfile.mp3
 

Sam Sanders

New Member
Joined
Jul 23, 2014
Messages
6
Reaction score
0
Well I got mostly working, I found an API for WinSCP that work with .net that was very handy, it lets you work with SFTP. It took about a week to convert all those WAV to mp3. I found out if you run that sync function from WinSCP it will sometimes see WAV files that the PBX only temperately created causing an error, so I think it's better to just keep the update time a 1 a day.
 
Joined
Oct 5, 2010
Messages
188
Reaction score
38
You could also take a look at the call recording commercial module that will setup archive functionality.
 

ou812

Guru
Joined
Oct 18, 2007
Messages
479
Reaction score
79
I put together a script for converting wav files to mp3 and ftp them to an off site server, replace the XXXX's with your settings, writing scripts is not really my thing so if anyone can improve this please do.
This script has worked very well for me on a server running Asterisk11 & freepbx11. I place this in /usr/src/ make it executable and call it from a cron job.

#!/bin/bash
# name of this script: mp3andftprecordings
# wav to mp3 and ftp the results to: Your ftp server
# No Warranty implied, No warranty given, Use at own risk

year=$(date +%Y)
month=$(date +%m)
day=$(date +%d)
USERNAME="XXXX"
PASSWORD="XXXX"
SERVER="XXX.XXX.XXX.XXX"

# Directory where file is located
DIR="/var/spool/asterisk/monitor/$year/$month/$day/"
# Filename of backup file to be transfered
FILE="*.mp3"

cd $DIR
for i in *.wav; do
if [ -e "$i" ]; then
file=`basename "$i" .wav`
lame -h -b 64 "$i" "$file.mp3"
rm "$file.wav"
fi
done

# login to ftp server and transfer file
cd $DIR
ftp -n -p -i $SERVER <<EOF
user $USERNAME $PASSWORD
binary
mput $FILE


quit
EOF

rm $DIR*.mp3

Gary
 

Dave Gray

Guru
Joined
May 22, 2013
Messages
150
Reaction score
60
From experience, be sure you check the lame command ran *before* you delete the .wav file!

Something like lame -h -b 64 "$i" "$file.mp3" && rm "$file.wav"

Or get fancier, check to see the file exists and isn't 0 length, etc. (No idea if lame sets the return code correctly, and can't be bothered now to go check.)
 

Members online

No members online now.

Forum statistics

Threads
25,819
Messages
167,800
Members
19,247
Latest member
abuhyder
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top