summaryrefslogtreecommitdiff
path: root/res/res_agi.c
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2015-11-25 15:26:35 -0600
committerKevin Harwell <kharwell@digium.com>2015-11-25 15:26:35 -0600
commit9014f1f4a52dce9acbc2d1d1e7fdbb00f2a52154 (patch)
treee4ee2829568e40fa7dfc1d6bea600c5602bd1392 /res/res_agi.c
parente4ba64691754c7873fba52e36c74cfc71e0a053c (diff)
fastagi: record file closed after sending result
The fastagi record-file testsuite test sometimes fails reporting an empty recorded file. This was happening because Asterisk was sending the agi result notification prior to actually closing the file and the data, being buffered, had not been written to the file yet when the test attempts to check the file size. This patch makes it so the record file stream is closed prior to sending the agi result notification. ASTERISK-25593 #close Change-Id: I6b2b3be3ae37f7c7b18e672c419a89b3b8513cde
Diffstat (limited to 'res/res_agi.c')
-rw-r--r--res/res_agi.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/res/res_agi.c b/res/res_agi.c
index 1dc6d4040..f6ce74960 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -2630,8 +2630,8 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, const
}
f = ast_read(chan);
if (!f) {
- ast_agi_send(agi->fd, chan, "200 result=%d (hangup) endpos=%ld\n", -1, sample_offset);
ast_closestream(fs);
+ ast_agi_send(agi->fd, chan, "200 result=%d (hangup) endpos=%ld\n", -1, sample_offset);
if (sildet)
ast_dsp_free(sildet);
return RESULT_FAILURE;
@@ -2645,8 +2645,8 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, const
ast_stream_rewind(fs, 200);
ast_truncstream(fs);
sample_offset = ast_tellstream(fs);
- ast_agi_send(agi->fd, chan, "200 result=%d (dtmf) endpos=%ld\n", f->subclass.integer, sample_offset);
ast_closestream(fs);
+ ast_agi_send(agi->fd, chan, "200 result=%d (dtmf) endpos=%ld\n", f->subclass.integer, sample_offset);
ast_frfree(f);
if (sildet)
ast_dsp_free(sildet);
@@ -2690,8 +2690,8 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, const
ast_truncstream(fs);
sample_offset = ast_tellstream(fs);
}
- ast_agi_send(agi->fd, chan, "200 result=%d (timeout) endpos=%ld\n", res, sample_offset);
ast_closestream(fs);
+ ast_agi_send(agi->fd, chan, "200 result=%d (timeout) endpos=%ld\n", res, sample_offset);
}
if (silence > 0) {