aboutsummaryrefslogtreecommitdiffstats
path: root/main/app.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-24 06:24:46 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-24 06:24:46 +0000
commitcdbe5cdfb1fe658fc4f52d29c232e3df727b6c91 (patch)
tree61862754b1a4a8ccce61c0fb81e8c48e5ee82d37 /main/app.c
parent8b1450abe38f0bee1728a6bad165ee1edd1271f8 (diff)
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) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89541 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/app.c')
-rw-r--r--main/app.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/main/app.c b/main/app.c
index 68310d359..20064af14 100644
--- a/main/app.c
+++ b/main/app.c
@@ -743,8 +743,6 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
} 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 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
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++) {