Skip to content

Commit 7e1340e

Browse files
InterLinked1Friendly Automation
authored andcommitted
app_mixmonitor: Add option to delete files on exit.
Adds an option that allows MixMonitor to delete its copy of any recording files before exiting. This can be handy in conjunction with options like m, which copy the file elsewhere, and the original files may no longer be needed. ASTERISK-30284 #close Change-Id: Ida093679c67e300efc154a97b6d8ec0f104e581e
1 parent 5e35862 commit 7e1340e

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

apps/app_mixmonitor.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@
9090
<para>Play a periodic beep while this call is being recorded.</para>
9191
<argument name="interval"><para>Interval, in seconds. Default is 15.</para></argument>
9292
</option>
93+
<option name="d">
94+
<para>Delete the recording file as soon as MixMonitor is done with it.</para>
95+
<para>For example, if you use the m option to dispatch the recording to a voicemail box,
96+
you can specify this option to delete the original copy of it afterwards.</para>
97+
</option>
9398
<option name="v">
9499
<para>Adjust the <emphasis>heard</emphasis> volume by a factor of <replaceable>x</replaceable>
95100
(range <literal>-4</literal> to <literal>4</literal>)</para>
@@ -407,6 +412,7 @@ enum mixmonitor_flags {
407412
MUXFLAG_BEEP_STOP = (1 << 13),
408413
MUXFLAG_DEPRECATED_RWSYNC = (1 << 14),
409414
MUXFLAG_NO_RWSYNC = (1 << 15),
415+
MUXFLAG_AUTO_DELETE = (1 << 16),
410416
};
411417

412418
enum mixmonitor_args {
@@ -427,6 +433,7 @@ AST_APP_OPTIONS(mixmonitor_opts, {
427433
AST_APP_OPTION('a', MUXFLAG_APPEND),
428434
AST_APP_OPTION('b', MUXFLAG_BRIDGED),
429435
AST_APP_OPTION_ARG('B', MUXFLAG_BEEP, OPT_ARG_BEEP_INTERVAL),
436+
AST_APP_OPTION('d', MUXFLAG_AUTO_DELETE),
430437
AST_APP_OPTION('p', MUXFLAG_BEEP_START),
431438
AST_APP_OPTION('P', MUXFLAG_BEEP_STOP),
432439
AST_APP_OPTION_ARG('v', MUXFLAG_READVOLUME, OPT_ARG_READVOLUME),
@@ -860,6 +867,19 @@ static void *mixmonitor_thread(void *obj)
860867
ast_debug(3, "No recipients to forward monitor to, moving on.\n");
861868
}
862869

870+
if (ast_test_flag(mixmonitor, MUXFLAG_AUTO_DELETE)) {
871+
ast_debug(3, "Deleting our copies of recording files\n");
872+
if (!ast_strlen_zero(fs_ext)) {
873+
ast_filedelete(mixmonitor->filename, fs_ext);
874+
}
875+
if (!ast_strlen_zero(fs_read_ext)) {
876+
ast_filedelete(mixmonitor->filename_read, fs_ext);
877+
}
878+
if (!ast_strlen_zero(fs_write_ext)) {
879+
ast_filedelete(mixmonitor->filename_write, fs_ext);
880+
}
881+
}
882+
863883
mixmonitor_free(mixmonitor);
864884

865885
ast_module_unref(ast_module_info->self);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Subject: app_mixmonitor
2+
3+
The d option for MixMonitor now allows deleting
4+
the original recording when MixMonitor exits,
5+
which can be useful when MixMonitor copies it
6+
somewhere else before exiting.

0 commit comments

Comments
 (0)