From 4a56cc64010ef4ed0f881a28e5f32ca1d166f79f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 16 Mar 2017 19:06:06 -0500 Subject: [PATCH] FS-10146: [mod_conference] Completely setup conference member before adding them to the conference #resolve --- .../mod_conference/conference_member.c | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_member.c b/src/mod/applications/mod_conference/conference_member.c index cf73621b63..9f6ada1a6b 100644 --- a/src/mod/applications/mod_conference/conference_member.c +++ b/src/mod/applications/mod_conference/conference_member.c @@ -684,12 +684,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m switch_assert(conference != NULL); switch_assert(member != NULL); - switch_mutex_lock(conference->mutex); - switch_mutex_lock(member->audio_in_mutex); - switch_mutex_lock(member->audio_out_mutex); - lock_member(member); - switch_mutex_lock(conference->member_mutex); if (member->rec) { conference->recording_members++; @@ -697,7 +692,6 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m member->join_time = switch_epoch_time_now(NULL); member->conference = conference; - member->next = conference->members; member->energy_level = conference->energy_level; member->auto_energy_level = conference->auto_energy_level; member->max_energy_level = conference->max_energy_level; @@ -710,9 +704,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m switch_queue_create(&member->dtmf_queue, 100, member->pool); - conference->members = member; conference_utils_member_set_flag_locked(member, MFLAG_INTREE); - switch_mutex_unlock(conference->member_mutex); conference_cdr_add(member); conference_api_set_agc(member, NULL); @@ -735,8 +727,6 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m } } - conference_send_presence(conference); - channel = switch_core_session_get_channel(member->session); if (switch_true(switch_channel_get_variable_dup(member->channel, "video_second_screen", SWITCH_FALSE, -1))) { @@ -961,10 +951,6 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m } - unlock_member(member); - switch_mutex_unlock(member->audio_out_mutex); - switch_mutex_unlock(member->audio_in_mutex); - if (conference->la && member->channel) { if (!conference_utils_member_test_flag(member, MFLAG_SECOND_SCREEN)) { cJSON *dvars; @@ -1017,6 +1003,16 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m } + switch_mutex_lock(conference->member_mutex); + member->next = conference->members; + conference->members = member; + switch_mutex_unlock(conference->member_mutex); + switch_mutex_unlock(conference->mutex); + status = SWITCH_STATUS_SUCCESS; + + + conference_send_presence(conference); + if (conference_utils_test_flag(conference, CFLAG_POSITIONAL)) { conference_al_gen_arc(conference, NULL); @@ -1026,8 +1022,6 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m conference_event_send_rfc(conference); conference_event_send_json(conference); - switch_mutex_unlock(conference->mutex); - status = SWITCH_STATUS_SUCCESS; conference_video_find_floor(member, SWITCH_TRUE);