Index: apps/app_record.c =================================================================== --- apps/app_record.c (revision 169213) +++ apps/app_record.c (working copy) @@ -56,6 +56,7 @@ " 's' : skip recording if the line is not yet answered\n" " 't' : use alternate '*' terminator key (DTMF) instead of default '#'\n" " 'x' : ignore all terminator keys (DTMF) and keep recording until hangup\n" +" 'd' : delete recording on hangup\n" "\n" "If filename contains '%d', these characters will be replaced with a number\n" "incremented by one each time the file is recorded. A channel variable\n" @@ -72,7 +73,8 @@ OPTION_SKIP = (1 << 3), OPTION_STAR_TERMINATE = (1 << 4), OPTION_IGNORE_TERMINATE = (1 << 5), - FLAG_HAS_PERCENT = (1 << 6), + OPTION_DELETE_ON_HANGUP = (1 << 6), + FLAG_HAS_PERCENT = (1 << 7), }; AST_APP_OPTIONS(app_opts,{ @@ -82,6 +84,7 @@ AST_APP_OPTION('s', OPTION_SKIP), AST_APP_OPTION('t', OPTION_STAR_TERMINATE), AST_APP_OPTION('x', OPTION_IGNORE_TERMINATE), + AST_APP_OPTION('d', OPTION_DELETE_ON_HANGUP), }); static int record_exec(struct ast_channel *chan, void *data) @@ -322,7 +325,7 @@ } ast_frfree(f); } - if (!f) { + if (!f && ast_test_flag(&flags, OPTION_DELETE_ON_HANGUP)) { ast_debug(1, "Got hangup\n"); res = -1; ast_filedelete(args.filename, NULL);