--- apps/app_confbridge.c.orig 2011-01-19 15:44:40.395558917 -0600 +++ apps/app_confbridge.c 2011-01-20 21:28:42.698066679 -0600 @@ -91,6 +91,16 @@ + + @@ -124,6 +134,8 @@ OPTION_MARKEDUSER = (1 << 6), /*!< Set if the caller is a marked user */ OPTION_WAITMARKED = (1 << 7), /*!< Set if the conference must wait for a marked user before starting */ OPTION_QUIET = (1 << 8), /*!< Set if no audio prompts should be played */ + OPTION_MARKEDEXIT = (1 << 9), /*!< Set if the conference should end when the last marked user disconnects */ + OPTION_NOLEADERHASLEFT = (1 << 10), /*!< Set if the "the leader has left the conference" sound file should not be played */ }; enum { @@ -142,6 +154,8 @@ AST_APP_OPTION('s', OPTION_MENU), AST_APP_OPTION('w', OPTION_WAITMARKED), AST_APP_OPTION('q', OPTION_QUIET), + AST_APP_OPTION('x', OPTION_MARKEDEXIT), + AST_APP_OPTION('Q', OPTION_NOLEADERHASLEFT), }); /* Maximum length of a conference bridge name */ @@ -513,7 +527,7 @@ } /* Play back the audio prompt saying the leader has left the conference */ - if (!ast_test_flag(&conference_bridge_user->flags, OPTION_QUIET)) { + if (!ast_test_flag(&conference_bridge_user->flags, OPTION_QUIET) && !ast_test_flag(&conference_bridge_user->flags, OPTION_NOLEADERHASLEFT)) { ao2_unlock(conference_bridge); ast_autoservice_start(conference_bridge_user->chan); play_sound_file(conference_bridge, "conf-leaderhasleft"); @@ -521,13 +535,22 @@ ao2_lock(conference_bridge); } - /* Now on to starting MOH if needed */ - AST_LIST_TRAVERSE(&conference_bridge->users_list, other_participant, list) { - if (ast_test_flag(&other_participant->flags, OPTION_MUSICONHOLD) && !ast_bridge_suspend(conference_bridge->bridge, other_participant->chan)) { - ast_moh_start(other_participant->chan, other_participant->opt_args[OPTION_MUSICONHOLD_CLASS], NULL); - ast_bridge_unsuspend(conference_bridge->bridge, other_participant->chan); - } - } + /* End the conference? */ + if (ast_test_flag(&conference_bridge_user->flags, OPTION_MARKEDEXIT)) { + ao2_lock(conference_bridge); + AST_LIST_TRAVERSE(&conference_bridge->users_list, other_participant, list) { + ast_bridge_remove(conference_bridge->bridge, other_participant->chan); + } + ao2_unlock(conference_bridge); + } else { + /* Now on to starting MOH if needed */ + AST_LIST_TRAVERSE(&conference_bridge->users_list, other_participant, list) { + if (ast_test_flag(&other_participant->flags, OPTION_MUSICONHOLD) && !ast_bridge_suspend(conference_bridge->bridge, other_participant->chan)) { + ast_moh_start(other_participant->chan, other_participant->opt_args[OPTION_MUSICONHOLD_CLASS], NULL); + ast_bridge_unsuspend(conference_bridge->bridge, other_participant->chan); + } + } + } } else if (conference_bridge->users == 1) { /* Of course if there is one other person in here we may need to start up MOH on them */ struct conference_bridge_user *first_participant = AST_LIST_FIRST(&conference_bridge->users_list);