[asterisk-users] Delete voicemails after X days
Anselm Martin Hoffmeister
anselm at hoffmeister-online.de
Wed May 23 03:28:00 MST 2007
Am Dienstag, den 22.05.2007, 20:37 -0500 schrieb Eric "ManxPower"
Wieling:
> David Florella wrote:
> > Thank you knox. Finally, I have chosen this solution : find
> > /var/spool/asterisk/voicemail/default/*/Old/ -atime -7|xargs rm –f, executed
> > every night by the CRON. However, I would have preferred this feature was
> > implemented in Astrisk.
>
> You should expect this to massively break voice mailboxes.
>
> Asterisk Voicemail requires that all messages are numbered sequentially
> starting at 0 (when using the filesystem, I don't know about RealTime or
> IMAP). If there is a break in the sequence, such as would be the case
> if your script deletes a message in the middle, then you should expect
> things to break. I think that higher numbered messages would simply not
> be accessible, but that is a guess.
Well, if you are sure that in the moment the cronjob runs at there will
be no recording happening, you could use some bash magic to rename the
files to number sequence again... something like
cd /var/spool/asterisk/voicemail/default/01/Old
export B=0
for A in *.wav ; do
C=`echo -n "0000${B}" | tail -c 4`
export D=`echo -n ${A} | sed -r "s/wav\$/txt/"`
mv ${A} msg${C}.wav 2>/dev/null
mv ${D} msg${C}.txt 2>/dev/null
B=$[${B} + 1]
done
(out of my head)
BR
Anselm
More information about the asterisk-users
mailing list