diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c
index a0eb1dbf5d..e2b9e8c148 100644
--- a/apps/app_mixmonitor.c
+++ b/apps/app_mixmonitor.c
@@ -90,6 +90,11 @@
Play a periodic beep while this call is being recorded.
Interval, in seconds. Default is 15.
+
+ Delete the recording file as soon as MixMonitor is done with it.
+ For example, if you use the m option to dispatch the recording to a voicemail box,
+ you can specify this option to delete the original copy of it afterwards.
+
Adjust the heard volume by a factor of x
(range -4 to 4 )
@@ -407,6 +412,7 @@ enum mixmonitor_flags {
MUXFLAG_BEEP_STOP = (1 << 13),
MUXFLAG_DEPRECATED_RWSYNC = (1 << 14),
MUXFLAG_NO_RWSYNC = (1 << 15),
+ MUXFLAG_AUTO_DELETE = (1 << 16),
};
enum mixmonitor_args {
@@ -427,6 +433,7 @@ AST_APP_OPTIONS(mixmonitor_opts, {
AST_APP_OPTION('a', MUXFLAG_APPEND),
AST_APP_OPTION('b', MUXFLAG_BRIDGED),
AST_APP_OPTION_ARG('B', MUXFLAG_BEEP, OPT_ARG_BEEP_INTERVAL),
+ AST_APP_OPTION('d', MUXFLAG_AUTO_DELETE),
AST_APP_OPTION('p', MUXFLAG_BEEP_START),
AST_APP_OPTION('P', MUXFLAG_BEEP_STOP),
AST_APP_OPTION_ARG('v', MUXFLAG_READVOLUME, OPT_ARG_READVOLUME),
@@ -860,6 +867,19 @@ static void *mixmonitor_thread(void *obj)
ast_debug(3, "No recipients to forward monitor to, moving on.\n");
}
+ if (ast_test_flag(mixmonitor, MUXFLAG_AUTO_DELETE)) {
+ ast_debug(3, "Deleting our copies of recording files\n");
+ if (!ast_strlen_zero(fs_ext)) {
+ ast_filedelete(mixmonitor->filename, fs_ext);
+ }
+ if (!ast_strlen_zero(fs_read_ext)) {
+ ast_filedelete(mixmonitor->filename_read, fs_ext);
+ }
+ if (!ast_strlen_zero(fs_write_ext)) {
+ ast_filedelete(mixmonitor->filename_write, fs_ext);
+ }
+ }
+
mixmonitor_free(mixmonitor);
ast_module_unref(ast_module_info->self);
diff --git a/doc/CHANGES-staging/app_mixmonitor_delete.txt b/doc/CHANGES-staging/app_mixmonitor_delete.txt
new file mode 100644
index 0000000000..924c9c08a1
--- /dev/null
+++ b/doc/CHANGES-staging/app_mixmonitor_delete.txt
@@ -0,0 +1,6 @@
+Subject: app_mixmonitor
+
+The d option for MixMonitor now allows deleting
+the original recording when MixMonitor exits,
+which can be useful when MixMonitor copies it
+somewhere else before exiting.