TRY THIS Removing 'old' recorded calls from spool

AndyInNYC

Active Member
Joined
May 23, 2013
Messages
772
Reaction score
124
My phone system is running PIAF Green. The system's SSD is getting full. I have recorded calls dating back to 2014. I'm copying the files in /var/spool/asterisk/monitor to my backup server (named BACKUP_SERVER).

the files are now in (pretend) /media/PHONE.

I know where to change the recording location in Settings/Advanced (haven't done that, not sure what to set it to - see below)

I have created a share in samba of /media/PHONE. It is shared as 'RECORDINGS'

What steps should I take for my recordings to live on BACKUP_SERVER and be live (ie show up in the CDR and get recorded there 'from now on')?

I think I need to mount the share on the PBX (backup server needs a name/password).
I may need to set the ownership of the Share? True?
I'll need the mount to be permanent - it's far more likely that the PBX will be down than the backup server.

Any suggestions on next steps to get this working correctly?

Thanks, all.

Andrew







Thanks.
 
Last edited:

mainenotarynet

Not really a Guru - Just a long time user
Joined
May 29, 2010
Messages
754
Reaction score
155
AndyinNYC, your subject line and request are a bit confusing. I'll address the subject as ostridge did -- the removing 'old' recordings from spool.

There is a script by Kyle95wm (March 26,2018 - script Updated April 2nd) that I use with tiny tweaking , as you may have more than one pbx to monitor [just he wording of the emails]) the post is here.

The script will delet all but the last 3 months (september 1st run deletes everything before June 1st) I set the cron to 3am on the first of every month.

If you already have a script to move the recordings to a different server automatically, then this script could purge them afterwards.


As for 'Rerouting the recordings so they end up on the backup, but can be accessed from the crd record, that is for another person to answer, sorry I can't be of more help there.
 

phonebuff

Guru
Joined
Feb 7, 2008
Messages
1,117
Reaction score
129
This is dated but it moved recordings to a NAS server for Archiving - You are welcome to copy / paste modify as needed.

Code:
#!/bin/sh
#
#  Script to move data to the Archive server from the Monitor directory.
#  Source Director is /var/spool/asterisk/monitor
#  Target Directory is new and name is Month + Year
#
#  mount -t cifs //w.x.y.z/voip -o username=voipuser,password=abc1234  /mnt/orafiles/
#
set -x

ArchMonth=$(date --date='1 month ago' +"%b")   # Past

ArchDir=$(date --date='1 month ago' +"%b%Y")

echo $ArchMonth
echo $ArchDir

if [ ! -d /mnt/orafiles/$ArchDir ]; then
      mkdir /mnt/orafiles/$ArchDir
fi

cd /var/spool/asterisk/monitor

ls -go | sed '/^d/ d'| awk -v select="$ArchMonth" '{if ($4 == select) print $7}' | xargs -i mv {} /mnt/orafiles/$ArchDir/.
 

krzykat

Telecom Strategist
Joined
Aug 2, 2008
Messages
3,145
Reaction score
1,235
I've got code that will purge oldest first until a certain percent of disk space is free. Loved the code, but we've now gone to writing monitor recordings to a remote server so that we'll never run out of disk space and can keep records MUCH longer. If you want the code, just yell.
 

AndyInNYC

Active Member
Joined
May 23, 2013
Messages
772
Reaction score
124
My initial title was incorrect - once I realized I could do what I really want.

I'd like to use a directory on the backup server to write to and store all calls so they are live forever.

Krzykat, given the directory and share on the remote server, what settings/mounts do I need to make on the PBX so that the new directory is used?

I assume I need
mkdir /allrecordings
in fstab, mount the share on backup to /allrecordings using the username and password
change the location in Settings/Advanced to /allrecordings

Anything else?

Andrew
 

krzykat

Telecom Strategist
Joined
Aug 2, 2008
Messages
3,145
Reaction score
1,235
Adjust the settings in FreePBX:

  1. Modify the following variables inside the '/etc/asterisk/asterisk.conf' file. This way FreePBX will cache the audio to avoid stale remote NAS behavior.
file.png

cache_record_files = yes
record_cache_dir = /var/spool/asterisk/monitor
  1. Modify the 'Override Call Recording Location' under 'Settings >> Advanced Settings' of the FreePBX menu and set it to '/remote_recordings' (as shown below)
DocsDisplay


then save and apply changes.

df -h should show /remote_recordings mapped for this to work.

FYI - we also have a script called mnt_chk - that verifies that the mount is loaded properly, and if not, it mounts it. Then this is run as a cronjob.
 

Members online

No members online now.

Forum statistics

Threads
25,811
Messages
167,759
Members
19,240
Latest member
nikko
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