Summary:ASTERISK-10316: [patch] Move deleted messages to a Deleted Folder
Reporter:Russell Brown (ruffle)Labels:
Date Opened:2007-09-17 07:51:57Date Closed:2008-01-14 16:17:18.000-0600
Versions:Frequency of
Environment:Attachments:( 0) 10740-voicemail.diff
( 1) 20080113_bug10740.diff.txt
( 2) app_voicemail.diff
Description:This patch provides an option (movetodeleted) to make Comedian Mail move deleted messages to the users Deleted folder instead of consigning them to oblivion.

The Deleted folder isn't accessable from within Comedian Mail, it's designed to be accessed by an external program (aka the Sys Admin) that will allow the retrieval of the CEO's very important message that he didn't actually mean to delete.
Comments:By: Tilghman Lesher (tilghman) 2007-09-17 11:37:19

If we add something like that, I'd prefer that it be builtin to voicemail to automatically clear out old deleted messages after a set timeframe.  It seems potentially dangerous to keep old messages forever, with no intervention.  If you create something to check the dates on old messages and delete them after a certain period of time (adjustable via config), then this would be more acceptable.

By: Jason Parker (jparker) 2007-09-17 15:33:39

How about a maxdeletedmsgs option, similar to maxmsgs?  If you set it to 10, and it tries to put an 11th in there, it will delete the oldest.

By: Russell Brown (ruffle) 2007-09-18 09:39:11

Hmmm... not so sure about just deleting the oldest. That would result in 'the dratted phone system' 'deleting' people's voicemail; something I'm trying to help folk avoid :-)

Might I suggest that should maxdeletedmsgs be reached, app_voicemail should simply not delete anything from live folders until the Deleted folder has been cleared out? (with suitable warnings in the logs).

Or I'd be very happy to provide a shell script to seek and destroy voicemail lookalike files (msgXXXX.XXXX) in the AST_SPOOL_DIR/voicemail/<context>/Deleted folders.  Where would that live in the source tree though? There's no scripts directory.

By: Jason Parker (jparker) 2007-09-18 14:55:24

Well, if you were to set it to 0, the "dratted phone system" wouldn't delete them. :)

I think this is a good way to go - and a limit of 0 would essentially turn this behavior off.

By: Jason Parker (jparker) 2007-09-19 16:47:54

Give this a try.  The option is named backupdeleted.  Valid values are yes/true, no/false, 0-9999

1-9999 is the maximum number of messages that can be saved.  If the newest deleted message is above this, then message 0 gets deleted, and all the rest get pushed up.
No/0 turns the option off, and no messages get saved.
Yes is the same as 100 (by default)

By: Russell Brown (ruffle) 2007-09-20 03:10:39

That looks spiffing :-) I'll test this evening when folk have stopped using the system.

Thanks for improving my crude hack.

BTW - here's a suggestion for the sample voicemail.conf:

; Maximum number of messages allowed in the 'Deleted' folder. If set to 0
; or no then no deleted messages will be moved. If non-zero (max 9999) then up
; to this number of messages will be automagically saved when they are
; 'deleted' on a FIFO basis.

By: Jason Parker (jparker) 2007-10-30 15:04:30

Have you been able to test this?

By: Leif Madsen (lmadsen) 2007-11-01 09:52:20

OK, I tested this patch, and it looks good.

Set backupdeleted=3, left 4 voicemails, deleted 3, checked the files in the Deleted folder, then deleted the 4th message and saw the first msg placed into the Deleted folder get removed and everything pushed up.

Then I switched backupdeleted to value 0, left a voicemail, deleted it, and saw that nothing got put into the Deleted folder.

Looks good!

By: Michiel van Baak (mvanbaak) 2008-01-12 17:45:17.000-0600

new patch against trunk with suggested voicemail.conf option etc.

This works fine in our production setup with 45 voicemail boxen

By: Digium Subversion (svnbot) 2008-01-14 16:17:18.000-0600

Repository: asterisk
Revision: 98889

U   trunk/CHANGES
U   trunk/apps/app_voicemail.c
U   trunk/configs/voicemail.conf.sample

r98889 | qwell | 2008-01-14 16:17:17 -0600 (Mon, 14 Jan 2008) | 10 lines

Add backupdeleted option to app_voicemail

(closes issue ASTERISK-10316)
Reported by: ruffle
     app_voicemail.diff uploaded by ruffle (license 201)
     10740-voicemail.diff uploaded by qwell (license 4)
     20080113_bug10740.diff.txt uploaded by mvanbaak (license 7)
Tested by: blitzrage, mvanbaak, qwell