diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index 01ae4256c6..e024059843 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -1992,7 +1992,7 @@ static int action_kick_last(struct confbridge_conference *conference, ast_stream_and_wait(bridge_channel->chan, conf_get_sound(CONF_SOUND_ERROR_MENU, user->b_profile.sounds), ""); - } else if (last_user) { + } else if (last_user && !last_user->kicked) { last_user->kicked = 1; pbx_builtin_setvar_helper(last_user->chan, "CONFBRIDGE_RESULT", "KICKED"); ast_bridge_remove(conference->bridge, last_user->chan); @@ -2179,7 +2179,7 @@ static int kick_conference_participant(struct confbridge_conference *conference, SCOPED_AO2LOCK(bridge_lock, conference); AST_LIST_TRAVERSE(&conference->active_list, user, list) { - if (!strcasecmp(ast_channel_name(user->chan), channel)) { + if (!strcasecmp(ast_channel_name(user->chan), channel) && !user->kicked) { user->kicked = 1; pbx_builtin_setvar_helper(user->chan, "CONFBRIDGE_RESULT", "KICKED"); ast_bridge_remove(conference->bridge, user->chan); @@ -2192,7 +2192,7 @@ static int kick_conference_participant(struct confbridge_conference *conference, } } AST_LIST_TRAVERSE(&conference->waiting_list, user, list) { - if (!strcasecmp(ast_channel_name(user->chan), channel)) { + if (!strcasecmp(ast_channel_name(user->chan), channel) && !user->kicked) { user->kicked = 1; pbx_builtin_setvar_helper(user->chan, "CONFBRIDGE_RESULT", "KICKED"); ast_bridge_remove(conference->bridge, user->chan); diff --git a/apps/confbridge/conf_state_multi_marked.c b/apps/confbridge/conf_state_multi_marked.c index 525cc4d5f7..42a8e7ea25 100644 --- a/apps/confbridge/conf_state_multi_marked.c +++ b/apps/confbridge/conf_state_multi_marked.c @@ -81,23 +81,16 @@ static void leave_active(struct confbridge_user *user) static void leave_marked(struct confbridge_user *user) { struct confbridge_user *user_iter; + int need_prompt = 0; conf_remove_user_marked(user->conference, user); if (user->conference->markedusers == 0) { - /* Play back the audio prompt saying the leader has left the conference */ - if (!ast_test_flag(&user->u_profile, USER_OPT_QUIET)) { - ao2_unlock(user->conference); - ast_autoservice_start(user->chan); - play_sound_file(user->conference, - conf_get_sound(CONF_SOUND_LEADER_HAS_LEFT, user->b_profile.sounds)); - ast_autoservice_stop(user->chan); - ao2_lock(user->conference); - } + need_prompt = 1; AST_LIST_TRAVERSE_SAFE_BEGIN(&user->conference->active_list, user_iter, list) { - /* Kick ENDMARKED user_iters */ - if (ast_test_flag(&user_iter->u_profile, USER_OPT_ENDMARKED)) { + /* Kick ENDMARKED cbu_iters */ + if (ast_test_flag(&user_iter->u_profile, USER_OPT_ENDMARKED) && !user_iter->kicked) { if (ast_test_flag(&user_iter->u_profile, USER_OPT_WAITMARKED) && !ast_test_flag(&user_iter->u_profile, USER_OPT_MARKEDUSER)) { AST_LIST_REMOVE_CURRENT(list); @@ -164,6 +157,18 @@ static void leave_marked(struct confbridge_user *user) break; /* Stay in marked */ } } + + if (need_prompt) { + /* Play back the audio prompt saying the leader has left the conference */ + if (!ast_test_flag(&user->u_profile, USER_OPT_QUIET)) { + ao2_unlock(user->conference); + ast_autoservice_start(user->chan); + play_sound_file(user->conference, + conf_get_sound(CONF_SOUND_LEADER_HAS_LEFT, user->b_profile.sounds)); + ast_autoservice_stop(user->chan); + ao2_lock(user->conference); + } + } } static void transition_to_marked(struct confbridge_user *user)