Skip to content

Commit 4fbaf86

Browse files
InterLinked1Friendly Automation
authored andcommitted
app_confbridge: Add end_marked_any option.
Adds the end_marked_any option, which can be used to kick a user from a conference if any marked user leaves. ASTERISK-30211 #close Change-Id: I9e8da7ccb892e522546c0f2b5476d172e022c2f5
1 parent 51e2a3a commit 4fbaf86

File tree

6 files changed

+47
-27
lines changed

6 files changed

+47
-27
lines changed

apps/app_confbridge.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4022,6 +4022,7 @@ static int action_confbridgelist_item(struct mansession *s, const char *id_text,
40224022
"MarkedUser: %s\r\n"
40234023
"WaitMarked: %s\r\n"
40244024
"EndMarked: %s\r\n"
4025+
"EndMarkedAny: %s\r\n"
40254026
"Waiting: %s\r\n"
40264027
"Muted: %s\r\n"
40274028
"Talking: %s\r\n"
@@ -4034,6 +4035,7 @@ static int action_confbridgelist_item(struct mansession *s, const char *id_text,
40344035
AST_YESNO(ast_test_flag(&user->u_profile, USER_OPT_MARKEDUSER)),
40354036
AST_YESNO(ast_test_flag(&user->u_profile, USER_OPT_WAITMARKED)),
40364037
AST_YESNO(ast_test_flag(&user->u_profile, USER_OPT_ENDMARKED)),
4038+
AST_YESNO(ast_test_flag(&user->u_profile, USER_OPT_ENDMARKEDANY)),
40374039
AST_YESNO(waiting),
40384040
AST_YESNO(user->muted),
40394041
AST_YESNO(user->talking),

apps/confbridge/conf_config_parser.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@
120120
<configOption name="end_marked">
121121
<synopsis>Kick the user from the conference when the last marked user leaves</synopsis>
122122
</configOption>
123+
<configOption name="end_marked_any">
124+
<synopsis>Kick the user from the conference when any marked user leaves</synopsis>
125+
</configOption>
123126
<configOption name="talk_detection_events">
124127
<synopsis>Set whether or not notifications of when a user begins and ends talking should be sent out as events over AMI</synopsis>
125128
</configOption>
@@ -1581,9 +1584,12 @@ static char *handle_cli_confbridge_show_user_profile(struct ast_cli_entry *e, in
15811584
ast_cli(a->fd,"Wait Marked: %s\n",
15821585
u_profile.flags & USER_OPT_WAITMARKED ?
15831586
"enabled" : "disabled");
1584-
ast_cli(a->fd,"END Marked: %s\n",
1587+
ast_cli(a->fd,"END Marked (All): %s\n",
15851588
u_profile.flags & USER_OPT_ENDMARKED ?
15861589
"enabled" : "disabled");
1590+
ast_cli(a->fd,"END Marked (Any): %s\n",
1591+
u_profile.flags & USER_OPT_ENDMARKEDANY ?
1592+
"enabled" : "disabled");
15871593
ast_cli(a->fd,"Drop_silence: %s\n",
15881594
u_profile.flags & USER_OPT_DROP_SILENCE ?
15891595
"enabled" : "disabled");
@@ -2407,6 +2413,7 @@ int conf_load_config(void)
24072413
aco_option_register(&cfg_info, "announce_only_user", ACO_EXACT, user_types, "yes", OPT_BOOLFLAG_T, 0, FLDSET(struct user_profile, flags), USER_OPT_NOONLYPERSON);
24082414
aco_option_register(&cfg_info, "wait_marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_WAITMARKED);
24092415
aco_option_register(&cfg_info, "end_marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ENDMARKED);
2416+
aco_option_register(&cfg_info, "end_marked_any", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ENDMARKEDANY);
24102417
aco_option_register(&cfg_info, "talk_detection_events", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_TALKER_DETECT);
24112418
aco_option_register(&cfg_info, "dtmf_passthrough", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_DTMF_PASS);
24122419
aco_option_register(&cfg_info, "announce_join_leave", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ANNOUNCE_JOIN_LEAVE);

apps/confbridge/conf_state_multi_marked.c

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -82,37 +82,39 @@ static void leave_marked(struct confbridge_user *user)
8282

8383
conf_remove_user_marked(user->conference, user);
8484

85-
if (user->conference->markedusers == 0) {
86-
AST_LIST_TRAVERSE_SAFE_BEGIN(&user->conference->active_list, user_iter, list) {
87-
/* Kick ENDMARKED cbu_iters */
88-
if (ast_test_flag(&user_iter->u_profile, USER_OPT_ENDMARKED) && !user_iter->kicked) {
89-
if (ast_test_flag(&user_iter->u_profile, USER_OPT_WAITMARKED)
90-
&& !ast_test_flag(&user_iter->u_profile, USER_OPT_MARKEDUSER)) {
91-
AST_LIST_REMOVE_CURRENT(list);
92-
user_iter->conference->activeusers--;
93-
AST_LIST_INSERT_TAIL(&user_iter->conference->waiting_list, user_iter, list);
94-
user_iter->conference->waitingusers++;
95-
}
96-
user_iter->kicked = 1;
97-
pbx_builtin_setvar_helper(user_iter->chan, "CONFBRIDGE_RESULT", "ENDMARKED");
98-
ast_bridge_remove(user_iter->conference->bridge, user_iter->chan);
99-
} else if (ast_test_flag(&user_iter->u_profile, USER_OPT_WAITMARKED)
100-
&& !ast_test_flag(&user_iter->u_profile, USER_OPT_MARKEDUSER)) {
101-
need_prompt = 1;
102-
85+
/* If all marked users have left, or we're set to kick if any marked user leaves, then boot everyone */
86+
AST_LIST_TRAVERSE_SAFE_BEGIN(&user->conference->active_list, user_iter, list) {
87+
if (user->conference->markedusers > 0 && !ast_test_flag(&user_iter->u_profile, USER_OPT_ENDMARKEDANY)) {
88+
continue;
89+
}
90+
/* Kick ENDMARKED cbu_iters */
91+
if ((ast_test_flag(&user_iter->u_profile, USER_OPT_ENDMARKED) || ast_test_flag(&user_iter->u_profile, USER_OPT_ENDMARKEDANY)) && !user_iter->kicked) {
92+
if (ast_test_flag(&user_iter->u_profile, USER_OPT_WAITMARKED)
93+
&& (!ast_test_flag(&user_iter->u_profile, USER_OPT_MARKEDUSER) || ast_test_flag(&user_iter->u_profile, USER_OPT_ENDMARKEDANY))) {
10394
AST_LIST_REMOVE_CURRENT(list);
10495
user_iter->conference->activeusers--;
10596
AST_LIST_INSERT_TAIL(&user_iter->conference->waiting_list, user_iter, list);
10697
user_iter->conference->waitingusers++;
107-
} else {
108-
/* User is neither wait_marked nor end_marked; however, they
109-
* should still hear the prompt.
110-
*/
111-
need_prompt = 1;
11298
}
99+
user_iter->kicked = 1;
100+
pbx_builtin_setvar_helper(user_iter->chan, "CONFBRIDGE_RESULT", "ENDMARKED");
101+
ast_bridge_remove(user_iter->conference->bridge, user_iter->chan);
102+
} else if (ast_test_flag(&user_iter->u_profile, USER_OPT_WAITMARKED)
103+
&& !ast_test_flag(&user_iter->u_profile, USER_OPT_MARKEDUSER)) {
104+
need_prompt = 1;
105+
106+
AST_LIST_REMOVE_CURRENT(list);
107+
user_iter->conference->activeusers--;
108+
AST_LIST_INSERT_TAIL(&user_iter->conference->waiting_list, user_iter, list);
109+
user_iter->conference->waitingusers++;
110+
} else {
111+
/* User is neither wait_marked nor end_marked nor end_marked_any; however, they
112+
* should still hear the prompt.
113+
*/
114+
need_prompt = 1;
113115
}
114-
AST_LIST_TRAVERSE_SAFE_END;
115116
}
117+
AST_LIST_TRAVERSE_SAFE_END;
116118

117119
switch (user->conference->activeusers) {
118120
case 0:

apps/confbridge/include/confbridge.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ enum user_profile_flags {
7171
USER_OPT_TEXT_MESSAGING = (1 << 19), /*!< Send text messages to the user */
7272
USER_OPT_ANSWER_CHANNEL = (1 << 20), /*!< Sets if the channel should be answered if currently unanswered */
7373
USER_OPT_HEAR_OWN_JOIN_SOUND = (1 << 21), /*!< Set if the caller should hear the join sound */
74+
USER_OPT_ENDMARKEDANY = (1 << 22), /*!< Set if the user should be kicked after any marked user exits */
7475
};
7576

7677
enum bridge_profile_flags {

configs/samples/confbridge.conf.sample

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ type=user
5858
; when a channel enters a empty conference. On by default.
5959
;wait_marked=yes ; Sets if the user must wait for a marked user to enter before
6060
; joining the conference. Off by default.
61-
;end_marked=yes ; This option will kick every user with this option set in their
62-
; user profile after the last Marked user exists the conference.
61+
;end_marked=yes ; This option will kick every non-marked user with this option set in their
62+
; user profile after the last marked user exits the conference.
63+
;end_marked_any=no ; This option will kick every user with this option set in
64+
; their user profile after any marked user exits the conference.
65+
; Additionally, note that unlike end_marked, this includes marked users.
6366

6467
;dsp_drop_silence=yes ; This option drops what Asterisk detects as silence from
6568
; entering into the bridge. Enabling this option will drastically
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Subject: app_confbridge
2+
3+
Adds the end_marked_any option which can be used
4+
to kick users from a conference after any
5+
marked user leaves (including marked users).

0 commit comments

Comments
 (0)