From fadb5fe316d5ec52152ecc2ba7e7d594d34c42c4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 9 Oct 2013 02:42:14 +0500 Subject: [PATCH] FS-5857 --resolve --- .../mod_conference/mod_conference.c | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 6d5597efd9..265effdb2e 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -428,6 +428,7 @@ struct conference_member { switch_codec_t write_codec; char *rec_path; switch_time_t rec_time; + conference_record_t *rec; uint8_t *frame; uint8_t *last_frame; uint32_t frame_size; @@ -1216,7 +1217,7 @@ static conference_member_t *conference_member_get(conference_obj_t *conference, } /* stop the specified recording */ -static switch_status_t conference_record_stop(conference_obj_t *conference, char *path) +static switch_status_t conference_record_stop(conference_obj_t *conference, switch_stream_handle_t *stream, char *path) { conference_member_t *member = NULL; int count = 0; @@ -1225,10 +1226,21 @@ static switch_status_t conference_record_stop(conference_obj_t *conference, char switch_mutex_lock(conference->member_mutex); for (member = conference->members; member; member = member->next) { if (switch_test_flag(member, MFLAG_NOCHANNEL) && (!path || !strcmp(path, member->rec_path))) { + if (member->rec && member->rec->autorec) { + stream->write_function(stream, "Stopped AUTO recording file %s (Auto Recording Now Disabled)\n", member->rec_path); + conference->auto_record = 0; + } else { + stream->write_function(stream, "Stopped recording file %s\n", member->rec_path); + } + switch_clear_flag_locked(member, MFLAG_RUNNING); count++; + } } + + conference->record_count -= count; + switch_mutex_unlock(conference->member_mutex); return count; } @@ -3920,7 +3932,7 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th fh.samplerate = conference->rate; member->id = next_member_id(); member->pool = rec->pool; - + member->rec = rec; member->frame_size = SWITCH_RECOMMENDED_BUFFER_SIZE; member->frame = switch_core_alloc(member->pool, member->frame_size); member->mux_frame = switch_core_alloc(member->pool, member->frame_size); @@ -6219,8 +6231,9 @@ static switch_status_t conf_api_sub_record(conference_obj_t *conference, switch_ switch_assert(conference != NULL); switch_assert(stream != NULL); - if (argc <= 2) + if (argc <= 2) { return SWITCH_STATUS_GENERR; + } stream->write_function(stream, "Record file %s\n", argv[2]); conference->record_filename = switch_core_strdup(conference->pool, argv[2]); @@ -6231,7 +6244,7 @@ static switch_status_t conf_api_sub_record(conference_obj_t *conference, switch_ static switch_status_t conf_api_sub_norecord(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) { - int all; + int all, before = conference->record_count, ttl = 0; switch_event_t *event; switch_assert(conference != NULL); @@ -6241,15 +6254,10 @@ static switch_status_t conf_api_sub_norecord(conference_obj_t *conference, switc return SWITCH_STATUS_GENERR; all = (strcasecmp(argv[2], "all") == 0); - stream->write_function(stream, "Stop recording file %s\n", argv[2]); - if (!conference_record_stop(conference, all ? NULL : argv[2]) && !all) { + + if (!conference_record_stop(conference, stream, all ? NULL : argv[2]) && !all) { stream->write_function(stream, "non-existant recording '%s'\n", argv[2]); } else { - if (all) { - conference->record_count = 0; - } else { - conference->record_count--; - } if (test_eflag(conference, EFLAG_RECORD) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { conference_add_event_data(conference, event); @@ -6260,6 +6268,9 @@ static switch_status_t conf_api_sub_norecord(conference_obj_t *conference, switc } } + ttl = before - conference->record_count; + stream->write_function(stream, "Stopped recording %d file%s\n", ttl, ttl == 1 ? "" : "s"); + return SWITCH_STATUS_SUCCESS; } @@ -6311,7 +6322,7 @@ static switch_status_t conf_api_sub_recording(conference_obj_t *conference, swit switch_assert(conference != NULL); switch_assert(stream != NULL); - if (argc <= 3) { + if (argc > 2 && argc <= 3) { if (strcasecmp(argv[2], "stop") == 0 || strcasecmp(argv[2], "check") == 0) { argv[3] = "all"; argc++;