diff options
author | Kevin Harwell <kharwell@digium.com> | 2013-03-04 20:18:36 +0000 |
---|---|---|
committer | Kevin Harwell <kharwell@digium.com> | 2013-03-04 20:18:36 +0000 |
commit | 933800754faf7bb5c08f2504e1358cb20fd7ad4d (patch) | |
tree | 932ba782b7240d8006f8aa7e5b4a08a537e8844c /apps | |
parent | a4f45a2c959e67f90ea3b44f2a0226292dd61163 (diff) |
Confbridge CLI new record file name check.
This fix checks to make sure that if a confbridge record start command is issued
from the CLI it will always use the file name given on the CLI even if it
changes between start/stop records for a conference. Previously it had been
reusing the same file between start/stops even if a new filename was given.
(issue AST-1088)
Reported by: John Bigelow
........
Merged revisions 382385 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382386 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_confbridge.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index dfa4a0a95..5f48740ca 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -596,13 +596,13 @@ static struct ast_channel *rec_request(const char *type, struct ast_format_cap * return tmp; } -static void set_rec_filename(struct conference_bridge *bridge, struct ast_str **filename) +static void set_rec_filename(struct conference_bridge *bridge, struct ast_str **filename, int is_new) { char *rec_file = bridge->b_profile.rec_file; time_t now; char *ext; - if (ast_str_strlen(*filename) && ast_test_flag(&bridge->b_profile, BRIDGE_OPT_RECORD_FILE_APPEND)) { + if (ast_str_strlen(*filename) && ast_test_flag(&bridge->b_profile, BRIDGE_OPT_RECORD_FILE_APPEND) && !is_new) { return; } @@ -627,12 +627,28 @@ static void set_rec_filename(struct conference_bridge *bridge, struct ast_str ** } } +static int is_new_rec_file(const char *rec_file, struct ast_str **orig_rec_file) +{ + if (!ast_strlen_zero(rec_file)) { + if (!*orig_rec_file) { + *orig_rec_file = ast_str_create(PATH_MAX); + } + + if (strcmp(ast_str_buffer(*orig_rec_file), rec_file)) { + ast_str_set(orig_rec_file, 0, "%s", rec_file); + return 1; + } + } + return 0; +} + static void *record_thread(void *obj) { struct conference_bridge *conference_bridge = obj; struct ast_app *mixmonapp = pbx_findapp("MixMonitor"); struct ast_channel *chan; struct ast_str *filename = ast_str_alloca(PATH_MAX); + struct ast_str *orig_rec_file = NULL; ast_mutex_lock(&conference_bridge->record_lock); if (!mixmonapp) { @@ -645,7 +661,8 @@ static void *record_thread(void *obj) /* XXX If we get an EXIT right here, START will essentially be a no-op */ while (conference_bridge->record_state != CONF_RECORD_EXIT) { - set_rec_filename(conference_bridge, &filename); + set_rec_filename(conference_bridge, &filename, + is_new_rec_file(conference_bridge->b_profile.rec_file, &orig_rec_file)); chan = ast_channel_ref(conference_bridge->record_chan); ast_answer(chan); pbx_exec(chan, mixmonapp, ast_str_buffer(filename)); @@ -655,6 +672,7 @@ static void *record_thread(void *obj) /* STOP has been called. Wait for either a START or an EXIT */ ast_cond_wait(&conference_bridge->record_cond, &conference_bridge->record_lock); } + ast_free(orig_rec_file); ast_mutex_unlock(&conference_bridge->record_lock); ao2_ref(conference_bridge, -1); return NULL; |