VoIP, Linux, Security & much more fun
If you need any help regarding these subjects do not hesitate about sending me a text

In my last article (time ago), I publish a way to keep FusionPBX on a diet (by safely deleting recordings and keeping the database with low disk use). But, what about the voicemails?

I will talk now how to delete safely the old voicemails within your policy.

First thing, you need to define a clear policy. In my case, I will delete all voicemails older than 360 days. I decided that the easiest way to do this is using the find command.

In my current deployment all voicemails are stored in /var/lib/freeswitch/storage/voicemail/default/. FusionPBX stores voicemails in a template path, VOICEMAIL_PATH/DOMAIN/END_POINT/msg_UUID.wav. You can find your VOICEMAIL_PATH by going into your Default Settings menu in your FusionPBX deployment. I have created this script:

#!/bin/sh
/usr/bin/find /var/lib/freeswitch/storage/voicemail/default/*/* -type f -regextype sed -regex '/var/lib/freeswitch/storage/voicemail/default/[a-z0-9\.]\+/[a-z0-9\.]\+/msg_[a-f0-9\-]\{36\}\.wav' -mtime +360 -exec /usr/bin/rm {} \;

You can put this in a crontab.

Enjoy!

blog comments powered by Disqus
If you need more help than the free one provided here...