]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_confbridge: Make sure name recordings are always removed from the filesystem
authorSergej Kasumovic <sergej@bicomsystems.com>
Fri, 14 Jul 2017 06:25:36 +0000 (08:25 +0200)
committerSergej Kasumovic <sergej@bicomsystems.com>
Fri, 14 Jul 2017 12:48:58 +0000 (07:48 -0500)
This commit fixes two possible scenarios:

* When recording name and if during recording you hangup, file is never
removed. This is due to the fact file location is nulled.
* When recording name and if you hangup during thank-you prompt, file
is never removed.

ASTERISK-27123 #close

Change-Id: I39b7271408b4b54ce880c5111a886aa8f28c2625

apps/app_confbridge.c

index e2a35ff3138bf5e033a5c11d4cb561edaa06a6f9..a33622f11774b364c5f9275284188e5abec19dd9 100644 (file)
@@ -2140,6 +2140,7 @@ static int conf_rec_name(struct confbridge_user *user, const char *conf_name)
        }
 
        if (res == -1) {
+               ast_filedelete(user->name_rec_location, NULL);
                user->name_rec_location[0] = '\0';
                return -1;
        }
@@ -2231,6 +2232,7 @@ static int confbridge_exec(struct ast_channel *chan, const char *data)
 {
        int res = 0, volume_adjustments[2];
        int quiet = 0;
+       int async_delete_task_pushed = 0;
        char *parse;
        const char *b_profile_name = NULL;
        const char *u_profile_name = NULL;
@@ -2476,6 +2478,7 @@ static int confbridge_exec(struct ast_channel *chan, const char *data)
                async_play_sound_file(conference,
                        conf_get_sound(CONF_SOUND_HAS_LEFT, conference->b_profile.sounds), NULL);
                async_delete_name_rec(conference, user.name_rec_location);
+               async_delete_task_pushed = 1;
        }
 
        /* play the leave sound */
@@ -2504,6 +2507,9 @@ static int confbridge_exec(struct ast_channel *chan, const char *data)
        }
 
 confbridge_cleanup:
+       if (!async_delete_task_pushed && !ast_strlen_zero(user.name_rec_location)) {
+               ast_filedelete(user.name_rec_location, NULL);
+       }
        ast_bridge_features_cleanup(&user.features);
        conf_bridge_profile_destroy(&user.b_profile);
        return res;