diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index 9fc3af3ad3..86051cb4a3 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -1961,7 +1961,7 @@ static int action_kick_last(struct conference_bridge *conference_bridge, ast_stream_and_wait(bridge_channel->chan, conf_get_sound(CONF_SOUND_ERROR_MENU, conference_bridge_user->b_profile.sounds), ""); - } else if (last_participant) { + } else if (last_participant && !last_participant->kicked) { last_participant->kicked = 1; ast_bridge_remove(conference_bridge->bridge, last_participant->chan); ao2_unlock(conference_bridge); @@ -2139,7 +2139,7 @@ static int kick_conference_participant(struct conference_bridge *bridge, const c ao2_lock(bridge); AST_LIST_TRAVERSE(&bridge->active_list, participant, list) { - if (!strcasecmp(ast_channel_name(participant->chan), channel)) { + if (!strcasecmp(ast_channel_name(participant->chan), channel) && !participant->kicked) { participant->kicked = 1; ast_bridge_remove(bridge->bridge, participant->chan); ao2_unlock(bridge); @@ -2147,7 +2147,7 @@ static int kick_conference_participant(struct conference_bridge *bridge, const c } } AST_LIST_TRAVERSE(&bridge->waiting_list, participant, list) { - if (!strcasecmp(ast_channel_name(participant->chan), channel)) { + if (!strcasecmp(ast_channel_name(participant->chan), channel) && !participant->kicked) { participant->kicked = 1; ast_bridge_remove(bridge->bridge, participant->chan); ao2_unlock(bridge); diff --git a/apps/confbridge/conf_state_multi_marked.c b/apps/confbridge/conf_state_multi_marked.c index 7e71086209..6089ac6f02 100644 --- a/apps/confbridge/conf_state_multi_marked.c +++ b/apps/confbridge/conf_state_multi_marked.c @@ -80,23 +80,16 @@ static void leave_active(struct conference_bridge_user *cbu) static void leave_marked(struct conference_bridge_user *cbu) { struct conference_bridge_user *cbu_iter; + int need_prompt = 0; conf_remove_user_marked(cbu->conference_bridge, cbu); if (cbu->conference_bridge->markedusers == 0) { - /* Play back the audio prompt saying the leader has left the conference */ - if (!ast_test_flag(&cbu->u_profile, USER_OPT_QUIET)) { - ao2_unlock(cbu->conference_bridge); - ast_autoservice_start(cbu->chan); - play_sound_file(cbu->conference_bridge, - conf_get_sound(CONF_SOUND_LEADER_HAS_LEFT, cbu->b_profile.sounds)); - ast_autoservice_stop(cbu->chan); - ao2_lock(cbu->conference_bridge); - } + need_prompt = 1; AST_LIST_TRAVERSE_SAFE_BEGIN(&cbu->conference_bridge->active_list, cbu_iter, list) { /* Kick ENDMARKED cbu_iters */ - if (ast_test_flag(&cbu_iter->u_profile, USER_OPT_ENDMARKED)) { + if (ast_test_flag(&cbu_iter->u_profile, USER_OPT_ENDMARKED) && !cbu_iter->kicked) { if (ast_test_flag(&cbu_iter->u_profile, USER_OPT_WAITMARKED) && !ast_test_flag(&cbu_iter->u_profile, USER_OPT_MARKEDUSER)) { AST_LIST_REMOVE_CURRENT(list); @@ -162,6 +155,18 @@ static void leave_marked(struct conference_bridge_user *cbu) break; /* Stay in marked */ } } + + if (need_prompt) { + /* Play back the audio prompt saying the leader has left the conference */ + if (!ast_test_flag(&cbu->u_profile, USER_OPT_QUIET)) { + ao2_unlock(cbu->conference_bridge); + ast_autoservice_start(cbu->chan); + play_sound_file(cbu->conference_bridge, + conf_get_sound(CONF_SOUND_LEADER_HAS_LEFT, cbu->b_profile.sounds)); + ast_autoservice_stop(cbu->chan); + ao2_lock(cbu->conference_bridge); + } + } } static void transition_to_marked(struct conference_bridge_user *cbu)