[Asterisk-code-review] app_mixmonitor: Add option to delete files on exit. (asterisk[20])

N A asteriskteam at digium.com
Tue Nov 8 07:09:31 CST 2022


N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19544 )


Change subject: app_mixmonitor: Add option to delete files on exit.
......................................................................

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
---
M apps/app_mixmonitor.c
A doc/CHANGES-staging/app_mixmonitor_delete.txt
2 files changed, 44 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/44/19544/1

diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c
index a0eb1db..e2b9e8c 100644
--- a/apps/app_mixmonitor.c
+++ b/apps/app_mixmonitor.c
@@ -90,6 +90,11 @@
 						<para>Play a periodic beep while this call is being recorded.</para>
 						<argument name="interval"><para>Interval, in seconds. Default is 15.</para></argument>
 					</option>
+					<option name="d">
+						<para>Delete the recording file as soon as MixMonitor is done with it.</para>
+						<para>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.</para>
+					</option>
 					<option name="v">
 						<para>Adjust the <emphasis>heard</emphasis> volume by a factor of <replaceable>x</replaceable>
 						(range <literal>-4</literal> to <literal>4</literal>)</para>
@@ -407,6 +412,7 @@
 	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_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 @@
 		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 0000000..924c9c0
--- /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.

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19544
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 20
Gerrit-Change-Id: Ida093679c67e300efc154a97b6d8ec0f104e581e
Gerrit-Change-Number: 19544
Gerrit-PatchSet: 1
Gerrit-Owner: N A <asterisk at phreaknet.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221108/de491727/attachment.html>


More information about the asterisk-code-review mailing list