FS-5857 --resolve

This commit is contained in:
Anthony Minessale 2013-10-09 02:42:14 +05:00
parent 8aff25e03d
commit 9d228e4fe9
1 changed files with 23 additions and 12 deletions

View File

@ -433,6 +433,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;
@ -1221,7 +1222,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;
@ -1230,10 +1231,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;
}
@ -3980,7 +3992,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);
@ -6292,8 +6304,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]);
@ -6304,7 +6317,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);
@ -6314,15 +6327,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);
@ -6333,6 +6341,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;
}
@ -6384,7 +6395,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++;