I archive messages that haven’t been touched in <x> number
days and send the compilation of messages being archived to the
voicemailbox’s owner. You could modify to delete them and leave it at that.
Since I’m leaving newer messages in the directory, and Asterisk doesn’t like
nonsequential filenames – I renumber all the remaining files.
I also had an issue with abandoned voicemail – where the caller would hangup
at the exact right moment leaving a zero length message. The .txt file
would be created but none of the audio formats. It was a rare occurrence –
but the user was unable to fix it from the phone interface meaning I had to
manually correct it every time, so I automated it with a script and a
cronjob.
See also