aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_voicemail.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-08-23 02:01:37 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-08-23 02:01:37 +0000
commit3f7567fe1548a9eae22c3d19233139ff219209c9 (patch)
treeef8b1f76138f699c92433aae52851f0ef78bcfdb /apps/app_voicemail.c
parentc456de4ee3b550a3ced714b3b0aa5e8eec2a999c (diff)
do expensive 'next message number' calculation before playing sounds (issue #4955)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6373 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_voicemail.c')
-rwxr-xr-xapps/app_voicemail.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 533335fdf..42b28206f 100755
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -2255,18 +2255,25 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
return ERROR_LOCK_PATH;
}
- 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, "");
- }
+ /*
+ * This operation can be very expensive if done say over NFS or if the mailbox has 100+ messages
+ * in the mailbox. So we should get this first so we don't cut off the first few seconds of the
+ * message.
+ */
do {
make_file(fn, sizeof(fn), dir, msgnum);
if (!EXISTS(dir,msgnum,fn,chan->language))
break;
msgnum++;
} 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) {
/* assign a variable with the name of the voicemail file */
pbx_builtin_setvar_helper(chan, "VM_MESSAGEFILE", fn);