Add an option to keep the recorded file upon hangup.

(closes issue #14341)
Reported by: fnordian


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@175549 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.2
Joshua Colp 17 years ago
parent 3854faf2d7
commit 0cfdaa2dc0

@ -75,6 +75,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
<option name="x"> <option name="x">
<para>Ignore all terminator keys (DTMF) and keep recording until hangup.</para> <para>Ignore all terminator keys (DTMF) and keep recording until hangup.</para>
</option> </option>
<option name="k">
<para>Keep recording if channel hangs up.</para>
</option>
</optionlist> </optionlist>
</parameter> </parameter>
</syntax> </syntax>
@ -112,11 +115,13 @@ enum {
OPTION_SKIP = (1 << 3), OPTION_SKIP = (1 << 3),
OPTION_STAR_TERMINATE = (1 << 4), OPTION_STAR_TERMINATE = (1 << 4),
OPTION_IGNORE_TERMINATE = (1 << 5), OPTION_IGNORE_TERMINATE = (1 << 5),
FLAG_HAS_PERCENT = (1 << 6), OPTION_KEEP = (1 << 6),
FLAG_HAS_PERCENT = (1 << 7),
}; };
AST_APP_OPTIONS(app_opts,{ AST_APP_OPTIONS(app_opts,{
AST_APP_OPTION('a', OPTION_APPEND), AST_APP_OPTION('a', OPTION_APPEND),
AST_APP_OPTION('k', OPTION_KEEP),
AST_APP_OPTION('n', OPTION_NOANSWER), AST_APP_OPTION('n', OPTION_NOANSWER),
AST_APP_OPTION('q', OPTION_QUIET), AST_APP_OPTION('q', OPTION_QUIET),
AST_APP_OPTION('s', OPTION_SKIP), AST_APP_OPTION('s', OPTION_SKIP),
@ -378,8 +383,10 @@ static int record_exec(struct ast_channel *chan, void *data)
ast_debug(1, "Got hangup\n"); ast_debug(1, "Got hangup\n");
res = -1; res = -1;
pbx_builtin_setvar_helper(chan, "RECORD_STATUS", "HANGUP"); pbx_builtin_setvar_helper(chan, "RECORD_STATUS", "HANGUP");
if (!ast_test_flag(&flags, OPTION_KEEP)) {
ast_filedelete(args.filename, NULL); ast_filedelete(args.filename, NULL);
} }
}
if (gotsilence) { if (gotsilence) {
ast_stream_rewind(s, silence - 1000); ast_stream_rewind(s, silence - 1000);

Loading…
Cancel
Save