From 0249409306579cb980db0c8c3d156a2ca629b2a9 Mon Sep 17 00:00:00 2001 From: file Date: Fri, 13 Feb 2009 16:43:13 +0000 Subject: Merged revisions 175549 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r175549 | file | 2009-02-13 12:41:15 -0400 (Fri, 13 Feb 2009) | 4 lines Add an option to keep the recorded file upon hangup. (closes issue #14341) Reported by: fnordian ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@175550 f38db490-d61c-443f-a65b-d21fe96a405b --- apps/app_record.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'apps/app_record.c') diff --git a/apps/app_record.c b/apps/app_record.c index bef9f1a76..e295e07e8 100644 --- a/apps/app_record.c +++ b/apps/app_record.c @@ -36,7 +36,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/channel.h" #include "asterisk/dsp.h" /* use dsp routines for silence detection */ - static char *app = "Record"; static char *synopsis = "Record to a file"; @@ -51,6 +50,7 @@ static char *descrip = "or 0 there is no maximum.\n" "- 'options' may contain any of the following letters:\n" " 'a' : append to existing recording rather than replacing\n" +" 'k' : keep recorded file upon hangup\n" " 'n' : do not answer, but record anyway if line not yet answered\n" " 'q' : quiet (do not play a beep tone)\n" " 's' : skip recording if the line is not yet answered\n" @@ -72,11 +72,13 @@ enum { OPTION_SKIP = (1 << 3), OPTION_STAR_TERMINATE = (1 << 4), 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_OPTION('a', OPTION_APPEND), + AST_APP_OPTION('k', OPTION_KEEP), AST_APP_OPTION('n', OPTION_NOANSWER), AST_APP_OPTION('q', OPTION_QUIET), AST_APP_OPTION('s', OPTION_SKIP), @@ -325,7 +327,9 @@ static int record_exec(struct ast_channel *chan, void *data) if (!f) { ast_debug(1, "Got hangup\n"); res = -1; - ast_filedelete(args.filename, NULL); + if (!ast_test_flag(&flags, OPTION_KEEP)) { + ast_filedelete(args.filename, NULL); + } } if (gotsilence) { -- cgit v1.2.3