[Asterisk-Users] "Defragmenting" mailboxes
Chris Albertson
chrisalbertson90278 at yahoo.com
Tue Oct 21 10:14:04 MST 2003
--- Jared Smith <jsmith at drgutah.com> wrote:
> On Tue, 2003-10-21 at 09:44, Ryan Tucker wrote:
> > Does anyone have a quick and dirty script for defragmenting
> mailboxes?
> [snip]
> >
> > Note the gap between 0003 and 0009. This is caused by a somewhat
> common
> > situation, and it tends to bite us somewhat often. :-)
> >
> > If not, if I get a chance, I'll whip something up. -rt
>
> Yes, the gaps in the numbering get really annoying. Unfortunately,
> it's
> a little bit risky to go moving files around without stopping
> asterisk
> first, or you might just contribute to the problem instead of helping
> it. (For example, if someone is leaving a message while you are
> renumbering the files.)
>
> I think the best long-term solution is to
> [ask|beg|pay|coerce|convince]
> someone to fix the way voicemail messages are numbered to avoid race
> conditions.
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.
"defragmenting is a rather poor "band aid" type fix. Think about the
case where the defragmentor is runnig while multiple inbound callers
are all leaving voicemail while at the same time the user
is listening to his voise mail. Yes this can happen on a "popular"
mailbox. Oh and then there is the case where a voicemail file was
e-mailed and now the user wants to find the voicemail file that matchs
the one he was e-mailed. No, don't go changing file names.
Ideally this kind of stuff would go into a DBMS. That would not
only fix any race condition but also allow software other then
Asterisk to safely access the data.
=====
Chris Albertson
Home: 310-376-1029 chrisalbertson90278 at yahoo.com
Cell: 310-990-7550
Office: 310-336-5189 Christopher.J.Albertson at aero.org
KG6OMK
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
More information about the asterisk-users
mailing list