[asterisk-commits] tilghman: trunk r89541 - in /trunk: ./ apps/app_voicemail.c main/app.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Nov 24 00:24:46 CST 2007


Author: tilghman
Date: Sat Nov 24 00:24:46 2007
New Revision: 89541

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89541
Log:
Merged revisions 89540 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r89540 | tilghman | 2007-11-24 00:19:23 -0600 (Sat, 24 Nov 2007) | 9 lines

Currently, zero-length voicemail messages cause a hangup in VoicemailMain.
This change fixes the problem, with a multi-faceted approach.  First, we
do our best to avoid these messages from being created in the first place,
and second, if that fails, we detect when the voicemail message is
zero-length and avoid exiting at that point.
Reported by: dtyoo
Patch by: gkloepfer,tilghman
(Closes issue #11083)

........

Modified:
    trunk/   (props changed)
    trunk/apps/app_voicemail.c
    trunk/main/app.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=89541&r1=89540&r2=89541
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Sat Nov 24 00:24:46 2007
@@ -4851,7 +4851,10 @@
 	if (!res) {
 		make_file(vms->fn, sizeof(vms->fn), vms->curdir, vms->curmsg);
 		vms->heard[vms->curmsg] = 1;
-		res = wait_file(chan, vms, vms->fn);
+		if ((res = wait_file(chan, vms, vms->fn)) < 0) {
+			ast_log(LOG_WARNING, "Playback of message %s failed\n", vms->fn);
+			res = 0;
+		}
 	}
 	DISPOSE(vms->curdir, vms->curmsg);
 	return res;

Modified: trunk/main/app.c
URL: http://svn.digium.com/view/asterisk/trunk/main/app.c?view=diff&rev=89541&r1=89540&r2=89541
==============================================================================
--- trunk/main/app.c (original)
+++ trunk/main/app.c Sat Nov 24 00:24:46 2007
@@ -743,8 +743,6 @@
 		} else {
 			ast_frfree(f);
 		}
-		if (end == start)
-			end = time(NULL);
 	} else {
 		ast_log(LOG_WARNING, "Error creating writestream '%s', format '%s'\n", recordfile, sfmt[x]);
 	}
@@ -753,7 +751,17 @@
 		if (silgen)
 			ast_channel_stop_silence_generator(chan, silgen);
 	}
-	*duration = end - start;
+
+	/*!\note
+	 * Instead of asking how much time passed (end - start), calculate the number
+	 * of seconds of audio which actually went into the file.  This fixes a
+	 * problem where audio is stopped up on the network and never gets to us.
+	 *
+	 * Note that we still want to use the number of seconds passed for the max
+	 * message, otherwise we could get a situation where this stream is never
+	 * closed (which would create a resource leak).
+	 */
+	*duration = ast_tellstream(others[0]) / 8000;
 
 	if (!prepend) {
 		for (x = 0; x < fmtcnt; x++) {




More information about the asterisk-commits mailing list