[Asterisk-Users] "Defragmenting" mailboxes

Andrew Kohlsmith akohlsmith-asterisk at benshaw.com
Tue Oct 21 10:37:03 MST 2003


> There is a C Library function that will return a unique
> file name. (see man mkstemp)
> That's the best way to go.  It is generally a
> bad design to encode any information in a file name.  Better to
> simply use the file's date/time stamp to order the messages.

I was speaking with tclark on IRC about this this past weekend.

What is wrong with using Maildir/ type interfaces for voicemail?  

Maildir is a very straightforward, scalable and distributable way of storing 
things like email (and voicemail).  Each mailbox has this format:

./
tmp/
cur/
new/

When a new voicemail is created, you mkstemp in tmp/ and create the file.  
Once it's done, you mv it to /new.  When it's listened to or otherwise 
accessed, it's mv'd to cur where it stays until deletion.

So to recap:  create and manipulate in tmp/, move to new/ once done.  When 
no longer new, move to cur/ and leave there.  No funky locking, totally NFS 
safe and very fast, since each voicemail is just a file.

There's no patents or any kind of software encumberances to this technique, 
either.

Regards,
Andrew



More information about the asterisk-users mailing list