do expensive 'next message number' calculation before playing sounds (issue #4955)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6373 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2-netsec
Kevin P. Fleming 20 years ago
parent fd781b3174
commit eb805b409f

@ -2255,18 +2255,25 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
return ERROR_LOCK_PATH; return ERROR_LOCK_PATH;
} }
if (res >= 0) { /*
/* Unless we're *really* silent, try to send the beep */ * This operation can be very expensive if done say over NFS or if the mailbox has 100+ messages
res = ast_streamfile(chan, "beep", chan->language); * in the mailbox. So we should get this first so we don't cut off the first few seconds of the
if (!res) * message.
res = ast_waitstream(chan, ""); */
}
do { do {
make_file(fn, sizeof(fn), dir, msgnum); make_file(fn, sizeof(fn), dir, msgnum);
if (!EXISTS(dir,msgnum,fn,chan->language)) if (!EXISTS(dir,msgnum,fn,chan->language))
break; break;
msgnum++; msgnum++;
} while (msgnum < vmu->maxmsg); } while (msgnum < vmu->maxmsg);
/* Now play the beep once we have the message number for our next message. */
if (res >= 0) {
/* Unless we're *really* silent, try to send the beep */
res = ast_streamfile(chan, "beep", chan->language);
if (!res)
res = ast_waitstream(chan, "");
}
if (msgnum < vmu->maxmsg) { if (msgnum < vmu->maxmsg) {
/* assign a variable with the name of the voicemail file */ /* assign a variable with the name of the voicemail file */
pbx_builtin_setvar_helper(chan, "VM_MESSAGEFILE", fn); pbx_builtin_setvar_helper(chan, "VM_MESSAGEFILE", fn);

Loading…
Cancel
Save