Skip to content

Delete Elastix old call recordings automatically

If you are using Elastix and Free PBX in your network, after a while, the size of call recording files will make your hard disk full. and it may lead to your PBX malfunctioning. for example, some of your extensions don’t ring and also you can’t log in to your management console anymore.

One solution is to check your elastic or free PBX hard disk capacity regularly and delete unnecessary and old voice recordings.

A better solution is to set a cron job in your Linux (Elastix and Free PBX are Web GUI of Asterisk which is a Linux appliance) to delete recording files that are older than a specific time. For example, set your Elastix or Free PBX to delete call recording files that are older than X days.

To Delete call recordings older than 90 days, follow these steps:

1- Login to your Linux via SSH

Not your Elastix! login name of your Linux is usually root. you can log in to your Linux SSH via PuTTY or any other SSH client.

2- Set the cron job

At your Linux prompt, type this:

crontab -e

Press Insert button and type this (or just paste):

30 8 * * * find /var/spool/asterisk/monitor/ -name "*.wav" -mtime +90 -delete

This will delete call recording files that are older than 90 days at 08:30 A.M. of every day.

To change the time of deletion change 2 first numbers 30 8 * * *

To change the number of days, change this number -mtime +90

To view your Linux and Elastix exact time, use this command: date

Important: In Linux, everything is case sensitive! If your recording files extension is WAV, change "*.wav" to "*.WAV"

If you have both file extensions in your call recordings, write 2 cron jobs.

Thanks to Sadjad Eiwaz

Published inLinuxVOIP

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Skip to toolbar