aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-24 06:19:23 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-24 06:19:23 +0000
commite8b92d93519b84b9287ba0397f9923b77ff4d061 (patch)
treeaed6f84094cc59357d9f05f71f747170afdb8db1
parent2365edbc22fae38098a719d1502e57d190f2b625 (diff)
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/branches/1.4@89540 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--apps/app_voicemail.c5
-rw-r--r--main/app.c14
2 files changed, 15 insertions, 4 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index e333fb228..ccc6228b2 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -4611,7 +4611,10 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc
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;
diff --git a/main/app.c b/main/app.c
index 0b57784a3..5c348dc7f 100644
--- a/main/app.c
+++ b/main/app.c
@@ -689,8 +689,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]);
}
@@ -699,7 +697,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++) {