Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv11322/apps

Modified Files:
        app_voicemail.c 
Log Message:
do expensive 'next message number' calculation before playing sounds (issue 
#4955)


Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.240
retrieving revision 1.241
diff -u -d -r1.240 -r1.241
--- app_voicemail.c     22 Aug 2005 22:43:47 -0000      1.240
+++ app_voicemail.c     23 Aug 2005 02:01:37 -0000      1.241
@@ -2255,18 +2255,25 @@
                                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);

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to