]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Make m option for mixmonitor delete the source file once it is finished copying to vm.
authorJonathan Rose <jrose@digium.com>
Tue, 3 Apr 2012 21:03:01 +0000 (21:03 +0000)
committerJonathan Rose <jrose@digium.com>
Tue, 3 Apr 2012 21:03:01 +0000 (21:03 +0000)
Review: https://reviewboard.asterisk.org/r/1842/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@361088 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_mixmonitor.c

index 7176de91a0016b5c10ba5327d8b4ab80dcb3345e..dbefb300ba4a26920c713b773d37918e79a161b4 100644 (file)
@@ -97,8 +97,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                                        </option>
                                        <option name="m">
                                                <argument name="mailbox" required="true" />
-                                               <para>Create a copy of the recording as a voicemail in the indicated <emphasis>mailbox</emphasis>(es)
+                                               <para>Create a copy of the recording as a voicemail in each indicated <emphasis>mailbox</emphasis>
                                                separated by commas eg. m(1111@default,2222@default,...)</para>
+                                               <note><para>The recording will be deleted once all the copies are made.</para></note>
                                        </option>
                                </optionlist>
                        </parameter>
@@ -390,6 +391,8 @@ static void copy_to_voicemail(struct mixmonitor *mixmonitor, char *ext)
 {
        struct vm_recipient *recipient = NULL;
        struct ast_vm_recording_data recording_data;
+       char filename[PATH_MAX];
+
        if (ast_string_field_init(&recording_data, 512)) {
                ast_log(LOG_ERROR, "Failed to string_field_init, skipping copy_to_voicemail\n");
                return;
@@ -415,6 +418,12 @@ static void copy_to_voicemail(struct mixmonitor *mixmonitor, char *ext)
                ast_app_copy_recording_to_vm(&recording_data);
        }
 
+       /* Delete the source file */
+       snprintf(filename, sizeof(filename), "%s.%s", mixmonitor->filename, ext);
+       if (remove(filename)) {
+               ast_log(LOG_ERROR, "Failed to delete recording source file %s\n", filename);
+       }
+
        /* Free the string fields for recording_data before exiting the function. */
        ast_string_field_free_memory(&recording_data);
 }