<p>N A has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19056">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_confbridge: Add end_marked_any option.<br><br>Adds the end_marked_any option, which can be used<br>to kick a user from a conference if any marked user<br>leaves.<br><br>ASTERISK-30211 #close<br><br>Change-Id: I9e8da7ccb892e522546c0f2b5476d172e022c2f5<br>---<br>M apps/app_confbridge.c<br>M apps/confbridge/conf_config_parser.c<br>M apps/confbridge/conf_state_multi_marked.c<br>M apps/confbridge/include/confbridge.h<br>M configs/samples/confbridge.conf.sample<br>A doc/CHANGES-staging/app_confbridge_marked_any.txt<br>6 files changed, 62 insertions(+), 27 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/56/19056/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c</span><br><span>index ea206bf..dd683d3 100644</span><br><span>--- a/apps/app_confbridge.c</span><br><span>+++ b/apps/app_confbridge.c</span><br><span>@@ -4022,6 +4022,7 @@</span><br><span>               "MarkedUser: %s\r\n"</span><br><span>               "WaitMarked: %s\r\n"</span><br><span>               "EndMarked: %s\r\n"</span><br><span style="color: hsl(120, 100%, 40%);">+         "EndMarkedAny: %s\r\n"</span><br><span>             "Waiting: %s\r\n"</span><br><span>          "Muted: %s\r\n"</span><br><span>            "Talking: %s\r\n"</span><br><span>@@ -4034,6 +4035,7 @@</span><br><span>          AST_YESNO(ast_test_flag(&user->u_profile, USER_OPT_MARKEDUSER)),</span><br><span>              AST_YESNO(ast_test_flag(&user->u_profile, USER_OPT_WAITMARKED)),</span><br><span>              AST_YESNO(ast_test_flag(&user->u_profile, USER_OPT_ENDMARKED)),</span><br><span style="color: hsl(120, 100%, 40%);">+                AST_YESNO(ast_test_flag(&user->u_profile, USER_OPT_ENDMARKEDANY)),</span><br><span>            AST_YESNO(waiting),</span><br><span>          AST_YESNO(user->muted),</span><br><span>           AST_YESNO(user->talking),</span><br><span>diff --git a/apps/confbridge/conf_config_parser.c b/apps/confbridge/conf_config_parser.c</span><br><span>index d04bcf9..56b196d 100644</span><br><span>--- a/apps/confbridge/conf_config_parser.c</span><br><span>+++ b/apps/confbridge/conf_config_parser.c</span><br><span>@@ -120,6 +120,9 @@</span><br><span>                              <configOption name="end_marked"></span><br><span>                                     <synopsis>Kick the user from the conference when the last marked user leaves</synopsis></span><br><span>                          </configOption></span><br><span style="color: hsl(120, 100%, 40%);">+                         <configOption name="end_marked_any"></span><br><span style="color: hsl(120, 100%, 40%);">+                                  <synopsis>Kick the user from the conference when any last marked user leaves</synopsis></span><br><span style="color: hsl(120, 100%, 40%);">+                           </configOption></span><br><span>                                <configOption name="talk_detection_events"></span><br><span>                                  <synopsis>Set whether or not notifications of when a user begins and ends talking should be sent out as events over AMI</synopsis></span><br><span>                               </configOption></span><br><span>@@ -1581,9 +1584,12 @@</span><br><span>       ast_cli(a->fd,"Wait Marked:             %s\n",</span><br><span>          u_profile.flags & USER_OPT_WAITMARKED ?</span><br><span>          "enabled" : "disabled");</span><br><span style="color: hsl(0, 100%, 40%);">-    ast_cli(a->fd,"END Marked:              %s\n",</span><br><span style="color: hsl(120, 100%, 40%);">+   ast_cli(a->fd,"END Marked (All):        %s\n",</span><br><span>          u_profile.flags & USER_OPT_ENDMARKED ?</span><br><span>           "enabled" : "disabled");</span><br><span style="color: hsl(120, 100%, 40%);">+  ast_cli(a->fd,"END Marked (Any):        %s\n",</span><br><span style="color: hsl(120, 100%, 40%);">+           u_profile.flags & USER_OPT_ENDMARKEDANY ?</span><br><span style="color: hsl(120, 100%, 40%);">+         "enabled" : "disabled");</span><br><span>         ast_cli(a->fd,"Drop_silence:            %s\n",</span><br><span>          u_profile.flags & USER_OPT_DROP_SILENCE ?</span><br><span>                "enabled" : "disabled");</span><br><span>@@ -2407,6 +2413,7 @@</span><br><span>         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);</span><br><span>    aco_option_register(&cfg_info, "wait_marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_WAITMARKED);</span><br><span>      aco_option_register(&cfg_info, "end_marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ENDMARKED);</span><br><span style="color: hsl(120, 100%, 40%);">+ 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);</span><br><span>         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);</span><br><span>         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);</span><br><span>  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);</span><br><span>diff --git a/apps/confbridge/conf_state_multi_marked.c b/apps/confbridge/conf_state_multi_marked.c</span><br><span>index 3932edc..ef3c4b3 100644</span><br><span>--- a/apps/confbridge/conf_state_multi_marked.c</span><br><span>+++ b/apps/confbridge/conf_state_multi_marked.c</span><br><span>@@ -82,37 +82,39 @@</span><br><span> </span><br><span>  conf_remove_user_marked(user->conference, user);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (user->conference->markedusers == 0) {</span><br><span style="color: hsl(0, 100%, 40%);">-         AST_LIST_TRAVERSE_SAFE_BEGIN(&user->conference->active_list, user_iter, list) {</span><br><span style="color: hsl(0, 100%, 40%);">-                       /* Kick ENDMARKED cbu_iters */</span><br><span style="color: hsl(0, 100%, 40%);">-                  if (ast_test_flag(&user_iter->u_profile, USER_OPT_ENDMARKED) && !user_iter->kicked) {</span><br><span style="color: hsl(0, 100%, 40%);">-                         if (ast_test_flag(&user_iter->u_profile, USER_OPT_WAITMARKED)</span><br><span style="color: hsl(0, 100%, 40%);">-                                    && !ast_test_flag(&user_iter->u_profile, USER_OPT_MARKEDUSER)) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                 AST_LIST_REMOVE_CURRENT(list);</span><br><span style="color: hsl(0, 100%, 40%);">-                                  user_iter->conference->activeusers--;</span><br><span style="color: hsl(0, 100%, 40%);">-                                     AST_LIST_INSERT_TAIL(&user_iter->conference->waiting_list, user_iter, list);</span><br><span style="color: hsl(0, 100%, 40%);">-                                  user_iter->conference->waitingusers++;</span><br><span style="color: hsl(0, 100%, 40%);">-                            }</span><br><span style="color: hsl(0, 100%, 40%);">-                               user_iter->kicked = 1;</span><br><span style="color: hsl(0, 100%, 40%);">-                               pbx_builtin_setvar_helper(user_iter->chan, "CONFBRIDGE_RESULT", "ENDMARKED");</span><br><span style="color: hsl(0, 100%, 40%);">-                            ast_bridge_remove(user_iter->conference->bridge, user_iter->chan);</span><br><span style="color: hsl(0, 100%, 40%);">-                     } else if (ast_test_flag(&user_iter->u_profile, USER_OPT_WAITMARKED)</span><br><span style="color: hsl(0, 100%, 40%);">-                             && !ast_test_flag(&user_iter->u_profile, USER_OPT_MARKEDUSER)) {</span><br><span style="color: hsl(0, 100%, 40%);">-                         need_prompt = 1;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+      /* If all marked users have left, or we're set to kick if any marked user leaves, then boot everyone */</span><br><span style="color: hsl(120, 100%, 40%);">+   AST_LIST_TRAVERSE_SAFE_BEGIN(&user->conference->active_list, user_iter, list) {</span><br><span style="color: hsl(120, 100%, 40%);">+             if (user->conference->markedusers > 0 && !ast_test_flag(&user_iter->u_profile, USER_OPT_ENDMARKEDANY)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      continue;</span><br><span style="color: hsl(120, 100%, 40%);">+             }</span><br><span style="color: hsl(120, 100%, 40%);">+             /* Kick ENDMARKED cbu_iters */</span><br><span style="color: hsl(120, 100%, 40%);">+                if ((ast_test_flag(&user_iter->u_profile, USER_OPT_ENDMARKED) || ast_test_flag(&user_iter->u_profile, USER_OPT_ENDMARKEDANY)) && !user_iter->kicked) {</span><br><span style="color: hsl(120, 100%, 40%);">+                       if (ast_test_flag(&user_iter->u_profile, USER_OPT_WAITMARKED)</span><br><span style="color: hsl(120, 100%, 40%);">+                          && (!ast_test_flag(&user_iter->u_profile, USER_OPT_MARKEDUSER) || ast_test_flag(&user_iter->u_profile, USER_OPT_ENDMARKEDANY))) {</span><br><span>                              AST_LIST_REMOVE_CURRENT(list);</span><br><span>                               user_iter->conference->activeusers--;</span><br><span>                          AST_LIST_INSERT_TAIL(&user_iter->conference->waiting_list, user_iter, list);</span><br><span>                               user_iter->conference->waitingusers++;</span><br><span style="color: hsl(0, 100%, 40%);">-                    } else {</span><br><span style="color: hsl(0, 100%, 40%);">-                                /* User is neither wait_marked nor end_marked; however, they</span><br><span style="color: hsl(0, 100%, 40%);">-                             * should still hear the prompt.</span><br><span style="color: hsl(0, 100%, 40%);">-                                 */</span><br><span style="color: hsl(0, 100%, 40%);">-                             need_prompt = 1;</span><br><span>                     }</span><br><span style="color: hsl(120, 100%, 40%);">+                     user_iter->kicked = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+                     pbx_builtin_setvar_helper(user_iter->chan, "CONFBRIDGE_RESULT", "ENDMARKED");</span><br><span style="color: hsl(120, 100%, 40%);">+                  ast_bridge_remove(user_iter->conference->bridge, user_iter->chan);</span><br><span style="color: hsl(120, 100%, 40%);">+           } else if (ast_test_flag(&user_iter->u_profile, USER_OPT_WAITMARKED)</span><br><span style="color: hsl(120, 100%, 40%);">+                   && !ast_test_flag(&user_iter->u_profile, USER_OPT_MARKEDUSER)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                       need_prompt = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                    AST_LIST_REMOVE_CURRENT(list);</span><br><span style="color: hsl(120, 100%, 40%);">+                        user_iter->conference->activeusers--;</span><br><span style="color: hsl(120, 100%, 40%);">+                   AST_LIST_INSERT_TAIL(&user_iter->conference->waiting_list, user_iter, list);</span><br><span style="color: hsl(120, 100%, 40%);">+                        user_iter->conference->waitingusers++;</span><br><span style="color: hsl(120, 100%, 40%);">+          } else {</span><br><span style="color: hsl(120, 100%, 40%);">+                      /* User is neither wait_marked nor end_marked nor end_marked_any; however, they</span><br><span style="color: hsl(120, 100%, 40%);">+                        * should still hear the prompt.</span><br><span style="color: hsl(120, 100%, 40%);">+                       */</span><br><span style="color: hsl(120, 100%, 40%);">+                   need_prompt = 1;</span><br><span>             }</span><br><span style="color: hsl(0, 100%, 40%);">-               AST_LIST_TRAVERSE_SAFE_END;</span><br><span>  }</span><br><span style="color: hsl(120, 100%, 40%);">+     AST_LIST_TRAVERSE_SAFE_END;</span><br><span> </span><br><span>      switch (user->conference->activeusers) {</span><br><span>       case 0:</span><br><span>diff --git a/apps/confbridge/include/confbridge.h b/apps/confbridge/include/confbridge.h</span><br><span>index f90f185..a6fdbb4 100644</span><br><span>--- a/apps/confbridge/include/confbridge.h</span><br><span>+++ b/apps/confbridge/include/confbridge.h</span><br><span>@@ -71,6 +71,7 @@</span><br><span>     USER_OPT_TEXT_MESSAGING = (1 << 19), /*!< Send text messages to the user */</span><br><span>         USER_OPT_ANSWER_CHANNEL = (1 << 20), /*!< Sets if the channel should be answered if currently unanswered */</span><br><span>         USER_OPT_HEAR_OWN_JOIN_SOUND  = (1 << 21), /*!< Set if the caller should hear the join sound */</span><br><span style="color: hsl(120, 100%, 40%);">+      USER_OPT_ENDMARKEDANY = (1 << 22), /*!< Set if the user should be kicked after any marked user exits */</span><br><span> };</span><br><span> </span><br><span> enum bridge_profile_flags {</span><br><span>diff --git a/configs/samples/confbridge.conf.sample b/configs/samples/confbridge.conf.sample</span><br><span>index ed4c72b..f582323 100644</span><br><span>--- a/configs/samples/confbridge.conf.sample</span><br><span>+++ b/configs/samples/confbridge.conf.sample</span><br><span>@@ -58,8 +58,11 @@</span><br><span>                           ; when a channel enters a empty conference.  On by default.</span><br><span> ;wait_marked=yes   ; Sets if the user must wait for a marked user to enter before</span><br><span>                    ; joining the conference. Off by default.</span><br><span style="color: hsl(0, 100%, 40%);">-;end_marked=yes ; This option will kick every user with this option set in their</span><br><span style="color: hsl(0, 100%, 40%);">-                ; user profile after the last Marked user exists the conference.</span><br><span style="color: hsl(120, 100%, 40%);">+;end_marked=yes ; This option will kick every non-marked user with this option set in their</span><br><span style="color: hsl(120, 100%, 40%);">+                ; user profile after the last marked user exits the conference.</span><br><span style="color: hsl(120, 100%, 40%);">+;end_marked_any=no ; This option will kick every user with this option set in</span><br><span style="color: hsl(120, 100%, 40%);">+                   ; their user profile after any marked user exits the conference.</span><br><span style="color: hsl(120, 100%, 40%);">+                   ; Additionally, note that unlike end_marked, this includes marked users.</span><br><span> </span><br><span> ;dsp_drop_silence=yes  ; This option drops what Asterisk detects as silence from</span><br><span>                        ; entering into the bridge.  Enabling this option will drastically</span><br><span>diff --git a/doc/CHANGES-staging/app_confbridge_marked_any.txt b/doc/CHANGES-staging/app_confbridge_marked_any.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..cbc1bbf</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/app_confbridge_marked_any.txt</span><br><span>@@ -0,0 +1,5 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: app_confbridge</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Adds the end_marked_any option which can be used</span><br><span style="color: hsl(120, 100%, 40%);">+to kick users from a conference after any</span><br><span style="color: hsl(120, 100%, 40%);">+marked user leaves (including marked users).</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19056">change 19056</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/19056"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I9e8da7ccb892e522546c0f2b5476d172e022c2f5 </div>
<div style="display:none"> Gerrit-Change-Number: 19056 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>