Does FusionPBX have built-in retention limit options for call recordings?

Status
Not open for further replies.

PBXMePlz

Member
Mar 1, 2019
102
10
18
32
Subject says most of it, if I need to I can probably shell script my way to victory here but wanted to stay within the confines of FusionPBX if I could help it.
EDIT: Although to clarify what I mean by retention limits, I'm specifically thinking retain recordings for X days and then delete everything after.

Thanks!
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,498
413
83
There is a shell script on here that does what you ask, I think @DigitalDaz wrote it. I couldn't find it this morning so below is my maintenance shell script, it may help you.

Code:
#!/bin/sh

#settings
export PGPASSWORD="xxxxxxxxxxxxxxxxxxxxx"
db_host=127.0.0.1
db_port=5432

#set the date
now=$(date +%Y-%m-%d)

#show message to the console
echo "Maintenance Started"

echo "deleting freeswitch logs older 7 days"
/usr/bin/find /var/log/freeswitch/freeswitch.log.* -mtime +7 -exec rm {} \;

echo "deleting fax files older than 30 days"
/usr/bin/find /var/lib/freeswitch/storage/fax/*  -name '*.tif' -mtime +30 -exec rm {} \;
/usr/bin/find /var/lib/freeswitch/storage/fax/*  -name '*.pdf' -mtime +30 -exec rm {} \;

echo "deleting fax files from from the database older than 30 days"
psql --host=127.0.0.1 --username=fusionpbx -c "delete from v_fax_files WHERE fax_date < NOW() - INTERVAL '30 days'"
echo "deleting fax logs from from the database older than 30 days"
psql --host=127.0.0.1 --username=fusionpbx -c "delete from v_fax_logs WHERE fax_date < NOW() - INTERVAL '30 days'"

echo "deleting voicemail files older than 30 days"
/usr/bin/find /var/lib/freeswitch/storage/voicemail/*  -name 'msg_*.wav' -mtime +30 -exec rm {} \;
/usr/bin/find /var/lib/freeswitch/storage/voicemail/*  -name 'msg_*.mp3' -mtime +30 -exec rm {} \;

echo "deleting voicemails from database older than 30 days"
psql --host=127.0.0.1 --username=fusionpbx -c "delete from v_voicemail_messages WHERE to_timestamp(created_epoch) < NOW() - INTERVAL '30 days'"

echo "deleting recordings files older than 30 days"
/usr/bin/find /var/lib/freeswitch/recordings/*/archive -type f -mtime +30 -exec rm -rf {} \;

echo "deleting call detail records older 30 days"
psql --host=127.0.0.1 --username=fusionpbx -c "delete from v_xml_cdr WHERE to_timestamp(start_epoch) < NOW() - INTERVAL '30 days'"

echo "Maintenance Completed";
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,498
413
83
I set up my own crontab entries so I control exactly when the jobs are run. I believe, on a default install a FusionPBX entry(s) is put into /etc/cron.daily.
 
Status
Not open for further replies.