How to automatically overwrite/delete old recordings to preserve disk space?

Hey guys!
I have a client who has a large volume of calls per day, and all of them are recorded via inbound and outbound routes.

Eventually the disk space becomes almost full, but we “fix” the problem by manually deleting the folder of the oldest day of recordings. Currently, with this volume of calls, the disk supports three months of recordings, which the customer agrees with and is not interested in increasing this space.

However, this method of checking the available space daily to prevent the server from crashing is a bit inconvenient - is there any way to make FreePBX automatically delete old recordings so that new ones have space?

Maybe something like setting a “maximum value” of space in the recordings folder, and when that volume is reached, delete the oldest ones?

Thanks!

Create a cron job (-mtime is days)

20 4 * * *  find /var/spool/asterisk/monitor/* -mtime +30 -delete  &&  find /var/spool/asterisk/monitor/*  -type d -empty -delete 

(this works with current debians, redhat used to need the ugly ‘-exec rm {} ;’ instead of -delete as it’s ‘find’ did not understand -delete )

2 Likes

The “Call Recordings Report” module has a settings tab where you can enable archiving/deleting according to your specifications.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.