Summary:ASTERISK-01674: [patch] Voicemail removal script deletes unheard voicemails
Reporter:grunky (grunky)Labels:
Date Opened:2004-05-21 17:12:50Date Closed:2004-09-25 02:42:31
Versions:Frequency of
Environment:Attachments:( 0) update.diff
( 1) update.diff
( 2) update.diff
Description:I'd like to propose a change to the voicemail removal script found in the contrib directory of the asterisk source

Currently the find command looks like so

system('find '.$dir.'/'.$context.' -name msg????.??? -mtime +'.$age.' -exec rm {} \; -exec echo Deleted {} \;');

I'd suggest it be changed to

system('find '.$dir.'/'.$context.'/*/Old -name msg????.??? -mtime +'.$age.' -exec rm {} \; -exec echo Deleted {} \;');

with the additional


The script will only delete messages that have been listened to and not new ones.

If you'd want to remove new unheard messages perhaps have 2 age variables, quickly delete old listened to messages and slowly delete - if at all - new unheard messages.

system('find '.$dir.'/'.$context.'/*/INBOX -name msg????.??? -mtime +'.$newage.' -exec rm {} \; -exec echo Deleted {} \;');
system('find '.$dir.'/'.$context.'/*/Old -name msg????.??? -mtime +'.$ageold.' -exec rm {} \; -exec echo Deleted {} \;');
Comments:By: Mark Spencer (markster) 2004-05-21 22:30:23

If you make it an option to the script then I'll apply the patch.

By: grunky (grunky) 2004-05-25 15:32:38

I really don't have enough perl knowledge to fix this myself.  I was able to look at the code and say - "hey here's how this is done" and thats about it.

Someone w/ more programming skill will have to do that.

By: screel (screel) 2004-05-25 23:33:03

You also have additional folders to worry about (Do you want to delete messages that users have saved, but are older than a certain age?).  We have people, as I'm sure everyone does, who will save a message in a folder, never listen to it again, and never delete it.  

At any rate, I'll add some provision for only deleting messages that have already been received by the caller (simply ignoring INBOX)

By: screel (screel) 2004-05-28 00:35:31

grunky - the diff will let you specify an age to delete (or 0 to never delete) unheard messages.  Let me know if that works for you

By: Mark Spencer (markster) 2004-06-21 14:51:14

the message checking regexp doesn't look right to me (msg*.* would mean ms followed by 0 or more g's followed by anything, right?)

By: screel (screel) 2004-06-22 10:46:30

Details, details... My bad, new diff is uploaded with old pattern matching (msg????.???)

By: Mark Spencer (markster) 2004-06-22 14:18:54

I'm not really sure the original was right either, but i'll go ahead and merge this in on the (hopefully valid) assumption that at least it can't make anything worse! :)