<p>N A has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15930">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_confbridge: New ConfKick() application<br><br>Adds a new ConfKick() application, which may<br>be used to kick a specific channel, all channels,<br>or all non-admin channels from a specified<br>conference bridge, similar to existing CLI and<br>AMI commands.<br><br>ASTERISK-29446<br><br>Change-Id: I5d96b683880bfdd27b2ab1c3f2e897c5046ded9b<br>---<br>M apps/app_confbridge.c<br>A doc/CHANGES-staging/app_confkick.txt<br>2 files changed, 89 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/30/15930/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 457870a..f048d6c 100644</span><br><span>--- a/apps/app_confbridge.c</span><br><span>+++ b/apps/app_confbridge.c</span><br><span>@@ -126,6 +126,39 @@</span><br><span>                 </description></span><br><span>                 <see-also></span><br><span>                     <ref type="application">ConfBridge</ref></span><br><span style="color: hsl(120, 100%, 40%);">+                        <ref type="application">ConfKick</ref></span><br><span style="color: hsl(120, 100%, 40%);">+                  <ref type="function">CONFBRIDGE</ref></span><br><span style="color: hsl(120, 100%, 40%);">+                   <ref type="function">CONFBRIDGE_INFO</ref></span><br><span style="color: hsl(120, 100%, 40%);">+              </see-also></span><br><span style="color: hsl(120, 100%, 40%);">+     </application></span><br><span style="color: hsl(120, 100%, 40%);">+  <application name="ConfKick" language="en_US"></span><br><span style="color: hsl(120, 100%, 40%);">+              <synopsis></span><br><span style="color: hsl(120, 100%, 40%);">+                      Kicks channel(s) from the requested ConfBridge.</span><br><span style="color: hsl(120, 100%, 40%);">+               </synopsis></span><br><span style="color: hsl(120, 100%, 40%);">+             <syntax></span><br><span style="color: hsl(120, 100%, 40%);">+                        <parameter name="conference" required="true" /></span><br><span style="color: hsl(120, 100%, 40%);">+                     <parameter name="channel"></span><br><span style="color: hsl(120, 100%, 40%);">+                            <para>The channel to kick, <literal>all</literal></span><br><span style="color: hsl(120, 100%, 40%);">+                           to kick all users, or <literal>participants</literal></span><br><span style="color: hsl(120, 100%, 40%);">+                             to kick all non-admin participants. Default is all.</para></span><br><span style="color: hsl(120, 100%, 40%);">+                      </parameter></span><br><span style="color: hsl(120, 100%, 40%);">+            </syntax></span><br><span style="color: hsl(120, 100%, 40%);">+               <description></span><br><span style="color: hsl(120, 100%, 40%);">+                   <para>Kicks the requested channel(s) from a conference bridge.</para></span><br><span style="color: hsl(120, 100%, 40%);">+                     <variablelist></span><br><span style="color: hsl(120, 100%, 40%);">+                          <variable name="CONFKICKSTATUS"></span><br><span style="color: hsl(120, 100%, 40%);">+                                      <value name="FAILURE"></span><br><span style="color: hsl(120, 100%, 40%);">+                                                Could not kick any users with the provided arguments.</span><br><span style="color: hsl(120, 100%, 40%);">+                                 </value></span><br><span style="color: hsl(120, 100%, 40%);">+                                        <value name="SUCCESS"></span><br><span style="color: hsl(120, 100%, 40%);">+                                                Successfully kicked users from specified conference bridge.</span><br><span style="color: hsl(120, 100%, 40%);">+                                   </value></span><br><span style="color: hsl(120, 100%, 40%);">+                                </variable></span><br><span style="color: hsl(120, 100%, 40%);">+                     </variablelist></span><br><span style="color: hsl(120, 100%, 40%);">+         </description></span><br><span style="color: hsl(120, 100%, 40%);">+          <see-also></span><br><span style="color: hsl(120, 100%, 40%);">+                      <ref type="application">ConfBridge</ref></span><br><span style="color: hsl(120, 100%, 40%);">+                        <ref type="application">ConfKick</ref></span><br><span>                         <ref type="function">CONFBRIDGE</ref></span><br><span>                  <ref type="function">CONFBRIDGE_INFO</ref></span><br><span>             </see-also></span><br><span>@@ -426,6 +459,7 @@</span><br><span>  */</span><br><span> </span><br><span> static const char app[] = "ConfBridge";</span><br><span style="color: hsl(120, 100%, 40%);">+static const char app2[] = "ConfKick";</span><br><span> </span><br><span> /*! Number of buckets our conference bridges container can have */</span><br><span> #define CONFERENCE_BRIDGE_BUCKETS 53</span><br><span>@@ -4220,6 +4254,53 @@</span><br><span>         return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static int confkick_exec(struct ast_channel *chan, const char *data)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+   char *parse;</span><br><span style="color: hsl(120, 100%, 40%);">+  struct confbridge_conference *conference;</span><br><span style="color: hsl(120, 100%, 40%);">+     int not_found;</span><br><span style="color: hsl(120, 100%, 40%);">+        </span><br><span style="color: hsl(120, 100%, 40%);">+      AST_DECLARE_APP_ARGS(args,</span><br><span style="color: hsl(120, 100%, 40%);">+            AST_APP_ARG(confbridge);</span><br><span style="color: hsl(120, 100%, 40%);">+              AST_APP_ARG(channel);</span><br><span style="color: hsl(120, 100%, 40%);">+ );</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  if (ast_strlen_zero(data)) {</span><br><span style="color: hsl(120, 100%, 40%);">+          ast_log(LOG_WARNING, "No conference bridge specified.\n");</span><br><span style="color: hsl(120, 100%, 40%);">+          pbx_builtin_setvar_helper(chan, "CONFKICKSTATUS", "FAILURE");</span><br><span style="color: hsl(120, 100%, 40%);">+             return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   parse = ast_strdupa(data);</span><br><span style="color: hsl(120, 100%, 40%);">+    AST_STANDARD_APP_ARGS(args, parse);</span><br><span style="color: hsl(120, 100%, 40%);">+   </span><br><span style="color: hsl(120, 100%, 40%);">+      conference = ao2_find(conference_bridges, args.confbridge, OBJ_KEY);</span><br><span style="color: hsl(120, 100%, 40%);">+  if (!conference) {</span><br><span style="color: hsl(120, 100%, 40%);">+            ast_log(LOG_WARNING, "No conference bridge named '%s' found!\n", args.confbridge);</span><br><span style="color: hsl(120, 100%, 40%);">+          pbx_builtin_setvar_helper(chan, "CONFKICKSTATUS", "FAILURE");</span><br><span style="color: hsl(120, 100%, 40%);">+             return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+     if (ast_strlen_zero(args.channel)) {</span><br><span style="color: hsl(120, 100%, 40%);">+          not_found = kick_conference_participant(conference, "all");</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+              not_found = kick_conference_participant(conference, args.channel);</span><br><span style="color: hsl(120, 100%, 40%);">+    }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   ao2_ref(conference, -1);</span><br><span style="color: hsl(120, 100%, 40%);">+      if (not_found) {</span><br><span style="color: hsl(120, 100%, 40%);">+              if (ast_strlen_zero(args.channel) || !strcasecmp("all", args.channel) || !strcasecmp("participants", args.channel)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                     ast_log(LOG_WARNING, "No participants found in conference bridge '%s'!\n", args.confbridge);</span><br><span style="color: hsl(120, 100%, 40%);">+                } else {</span><br><span style="color: hsl(120, 100%, 40%);">+                      ast_log(LOG_WARNING, "No participant named '%s' found in conference bridge '%s'!\n", args.channel, args.confbridge);</span><br><span style="color: hsl(120, 100%, 40%);">+                }</span><br><span style="color: hsl(120, 100%, 40%);">+             pbx_builtin_setvar_helper(chan, "CONFKICKSTATUS", "FAILURE");</span><br><span style="color: hsl(120, 100%, 40%);">+             return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+     ast_debug(1, "Kicked '%s' out of conference '%s'\n", args.channel, args.confbridge);</span><br><span style="color: hsl(120, 100%, 40%);">+        pbx_builtin_setvar_helper(chan, "CONFKICKSTATUS", "SUCCESS");</span><br><span style="color: hsl(120, 100%, 40%);">+     return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> void conf_add_user_active(struct confbridge_conference *conference, struct confbridge_user *user)</span><br><span> {</span><br><span>     AST_LIST_INSERT_TAIL(&conference->active_list, user, list);</span><br><span>@@ -4313,6 +4394,7 @@</span><br><span> static int unload_module(void)</span><br><span> {</span><br><span>    ast_unregister_application(app);</span><br><span style="color: hsl(120, 100%, 40%);">+      ast_unregister_application(app2);</span><br><span> </span><br><span>        ast_custom_function_unregister(&confbridge_function);</span><br><span>    ast_custom_function_unregister(&confbridge_info_function);</span><br><span>@@ -4383,6 +4465,7 @@</span><br><span>       res |= manager_confbridge_init();</span><br><span> </span><br><span>        res |= ast_register_application_xml(app, confbridge_exec);</span><br><span style="color: hsl(120, 100%, 40%);">+    res |= ast_register_application_xml(app2, confkick_exec);</span><br><span> </span><br><span>        res |= ast_custom_function_register_escalating(&confbridge_function, AST_CFE_WRITE);</span><br><span>     res |= ast_custom_function_register(&confbridge_info_function);</span><br><span>diff --git a/doc/CHANGES-staging/app_confkick.txt b/doc/CHANGES-staging/app_confkick.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..4250c7d</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/app_confkick.txt</span><br><span>@@ -0,0 +1,6 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: New ConfKick application</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Adds a ConfKick() application, which allows</span><br><span style="color: hsl(120, 100%, 40%);">+a specific channel, all users, or all non-admin</span><br><span style="color: hsl(120, 100%, 40%);">+users to be kicked from a conference bridge.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15930">change 15930</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/+/15930"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I5d96b683880bfdd27b2ab1c3f2e897c5046ded9b </div>
<div style="display:none"> Gerrit-Change-Number: 15930 </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>