Issabel PBX, a popular open-source Unified Communication solution, saves call recordings in the directory /var/spool/asterisk/monitor/. Over time, these call recordings can consume significant disk space, leading to storage issues. To ensure your server continues to operate efficiently, it is necessary to manage and delete old or unnecessary call recordings periodically.
This article explains how to locate and delete Issabel call recording files safely.
1. Understanding the Default Location
By default, Issabel PBX stores all call recordings in the following directory:
/var/spool/asterisk/monitor/
Within this folder, call recordings are often saved with filenames containing the call date, time, and extension number. For example:
exten-101-107-20241211-122032-1733899832.3410.wav
2. Checking Disk Space Usage
Before deleting the files, it is good practice to check the amount of disk space occupied by call recordings. Use the following command to check the size of the monitor directory:
du -sh /var/spool/asterisk/monitor/
This will display the total size of the folder in human-readable format (e.g., 10G for 10 gigabytes).
3. Deleting Call Recording Files
a) Deleting Files Older Than a Specific Number of Days
To delete call recordings older than a certain number of days (e.g., 30 days), use the find command. Here is an example:
find /var/spool/asterisk/monitor/ -type f -name "*.wav" -mtime +30 -exec rm -f {} \;
/var/spool/asterisk/monitor/: The directory where recordings are stored.-type f: Specifies that we are looking for files (not directories).-name "*.wav": Filters files with a.wavextension (common format for call recordings).-mtime +30: Finds files older than 30 days.-exec rm -f {} \;: Deletes each file found.
Important Note: Always test the
findcommand without the-execoption first to verify which files will be deleted:find /var/spool/asterisk/monitor/ -type f -name "*.wav" -mtime +30
b) Deleting All Call Recordings
If you need to delete all call recordings in the directory, use the following command:
rm -f /var/spool/asterisk/monitor/*.wav
This will remove all .wav files in the monitor directory.
4. Automating Call Recording Cleanup
To automate the deletion of call recordings older than a certain number of days, you can set up a cron job.
- Open the crontab editor:
crontab -e - Add the following line to delete recordings older than 30 days every day at midnight:
0 0 * * * find /var/spool/asterisk/monitor/ -type f -name "*.wav" -mtime +30 -exec rm -f {} \;
0 0 * * *: Runs the command at midnight every day.find ...: Command to delete old recordings as explained earlier.
- Save and exit the crontab editor.
The cron job will now automatically clean up old recordings without manual intervention.
5. Monitoring Disk Usage After Cleanup
After deleting the files, check the disk space again to confirm the cleanup:
du -sh /var/spool/asterisk/monitor/
You should notice a reduction in the folder size.
6. Safety Tips
- Backup Important Recordings: If you need to retain specific recordings, back them up to another location before deletion.
- Test Commands Before Execution: Always test
findcommands to verify the files that will be deleted. - Use Automation: Setting up cron jobs helps maintain server storage without manual intervention.
- Monitor Disk Space: Use tools like
df -handduto monitor disk usage regularly.
Conclusion
Managing call recordings in Issabel PBX is crucial to ensure your server remains efficient and operational. By using the steps provided, you can easily delete unnecessary call recordings and automate the process for ongoing maintenance. Always take precautions when deleting files to avoid accidental data loss.
If you encounter any issues, feel free to consult Issabel documentation or seek help from system administrators.