<p>Jean Aunis - Prescom has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13306">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">ARI: Ability to inhibit COLP frames when adding channels to a bridge<br><br>This patch adds a new flag "inhibitCOLP" to the addChannel operation in the<br>Bridges REST API. When set, this flag avoids generating COLP frames when the<br>specified channels enter the bridge.<br><br>ASTERISK-28629<br><br>Change-Id: Ib995d4f0c6106279aa448b34b042b68f0f2ca5dc<br>---<br>M include/asterisk/bridge_features.h<br>M include/asterisk/stasis_app.h<br>M res/ari/resource_bridges.c<br>M res/ari/resource_bridges.h<br>M res/res_ari_bridges.c<br>M res/stasis/control.c<br>M rest-api/api-docs/bridges.json<br>7 files changed, 41 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/06/13306/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/asterisk/bridge_features.h b/include/asterisk/bridge_features.h</span><br><span>index f9af8fb..9b5f70f 100644</span><br><span>--- a/include/asterisk/bridge_features.h</span><br><span>+++ b/include/asterisk/bridge_features.h</span><br><span>@@ -277,6 +277,8 @@</span><br><span>        unsigned int mute:1;</span><br><span>         /*! TRUE if DTMF should be passed into the bridge tech.  */</span><br><span>  unsigned int dtmf_passthrough:1;</span><br><span style="color: hsl(120, 100%, 40%);">+      /*! TRUE to avoid generating COLP frames when joining the bridge */</span><br><span style="color: hsl(120, 100%, 40%);">+   unsigned int inhibit_colp:1;</span><br><span> };</span><br><span> </span><br><span> /*!</span><br><span>diff --git a/include/asterisk/stasis_app.h b/include/asterisk/stasis_app.h</span><br><span>index 01c7ff4..7c6f658 100644</span><br><span>--- a/include/asterisk/stasis_app.h</span><br><span>+++ b/include/asterisk/stasis_app.h</span><br><span>@@ -838,6 +838,15 @@</span><br><span>        struct stasis_app_control *control, int mute);</span><br><span> </span><br><span> /*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Set whether COLP frames should be generated when joining the bridge</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param control Control whose channel should have its audio muted when bridged</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param mute Whether COLP frames should be generated (0) or not (1).</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+void stasis_app_control_inhibit_colp_in_bridge(</span><br><span style="color: hsl(120, 100%, 40%);">+  struct stasis_app_control *control, int inhibit_colp);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span>  * \since 12</span><br><span>  * \brief Gets the bridge currently associated with a control object.</span><br><span>  *</span><br><span>diff --git a/res/ari/resource_bridges.c b/res/ari/resource_bridges.c</span><br><span>index 33e4cd1..369174d 100644</span><br><span>--- a/res/ari/resource_bridges.c</span><br><span>+++ b/res/ari/resource_bridges.c</span><br><span>@@ -221,6 +221,7 @@</span><br><span>              if (!stasis_app_control_bridge_features_init(list->controls[i])) {</span><br><span>                        stasis_app_control_absorb_dtmf_in_bridge(list->controls[i], args->absorb_dtmf);</span><br><span>                        stasis_app_control_mute_in_bridge(list->controls[i], args->mute);</span><br><span style="color: hsl(120, 100%, 40%);">+                       stasis_app_control_inhibit_colp_in_bridge(list->controls[i], args->inhibit_colp);</span><br><span>              }</span><br><span>    }</span><br><span> </span><br><span>diff --git a/res/ari/resource_bridges.h b/res/ari/resource_bridges.h</span><br><span>index 0d0286c..424ed8b 100644</span><br><span>--- a/res/ari/resource_bridges.h</span><br><span>+++ b/res/ari/resource_bridges.h</span><br><span>@@ -154,6 +154,8 @@</span><br><span>     int absorb_dtmf;</span><br><span>     /*! Mute audio from this channel, preventing it to pass through to the bridge */</span><br><span>     int mute;</span><br><span style="color: hsl(120, 100%, 40%);">+     /*! Do not generate COLP frames when joining the bridge */</span><br><span style="color: hsl(120, 100%, 40%);">+    int inhibit_colp;</span><br><span> };</span><br><span> /*!</span><br><span>  * \brief Body parsing function for /bridges/{bridgeId}/addChannel.</span><br><span>diff --git a/res/res_ari_bridges.c b/res/res_ari_bridges.c</span><br><span>index 7ef0f68..2cbf9c0 100644</span><br><span>--- a/res/res_ari_bridges.c</span><br><span>+++ b/res/res_ari_bridges.c</span><br><span>@@ -440,6 +440,10 @@</span><br><span>        if (field) {</span><br><span>                 args->mute = ast_json_is_true(field);</span><br><span>     }</span><br><span style="color: hsl(120, 100%, 40%);">+     field = ast_json_object_get(body, "inhibitCOLP");</span><br><span style="color: hsl(120, 100%, 40%);">+   if (field) {</span><br><span style="color: hsl(120, 100%, 40%);">+          args->inhibit_colp = ast_json_is_true(field);</span><br><span style="color: hsl(120, 100%, 40%);">+      }</span><br><span>    return 0;</span><br><span> }</span><br><span> </span><br><span>@@ -515,6 +519,9 @@</span><br><span>             if (strcmp(i->name, "mute") == 0) {</span><br><span>                     args.mute = ast_true(i->value);</span><br><span>           } else</span><br><span style="color: hsl(120, 100%, 40%);">+                if (strcmp(i->name, "inhibitCOLP") == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+                       args.inhibit_colp = ast_true(i->value);</span><br><span style="color: hsl(120, 100%, 40%);">+            } else</span><br><span>               {}</span><br><span>   }</span><br><span>    for (i = path_vars; i; i = i->next) {</span><br><span>diff --git a/res/stasis/control.c b/res/stasis/control.c</span><br><span>index 96ddf39..193fe6a 100644</span><br><span>--- a/res/stasis/control.c</span><br><span>+++ b/res/stasis/control.c</span><br><span>@@ -1285,6 +1285,7 @@</span><br><span> {</span><br><span>   int res;</span><br><span>     struct ast_bridge_features *features;</span><br><span style="color: hsl(120, 100%, 40%);">+ int flags = AST_BRIDGE_IMPART_CHAN_DEPARTABLE;</span><br><span> </span><br><span>   if (!control || !bridge) {</span><br><span>           return -1;</span><br><span>@@ -1332,6 +1333,9 @@</span><br><span>   /* Pull bridge features from the control */</span><br><span>  features = control->bridge_features;</span><br><span>      control->bridge_features = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+   if(features && features->inhibit_colp) {</span><br><span style="color: hsl(120, 100%, 40%);">+           flags |= AST_BRIDGE_IMPART_INHIBIT_JOIN_COLP;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span>        ast_assert(stasis_app_get_bridge(control) == NULL);</span><br><span>  /* We need to set control->bridge here since bridge_after_cb may be run</span><br><span>@@ -1349,7 +1353,7 @@</span><br><span>           chan,</span><br><span>                swap,</span><br><span>                features, /* features */</span><br><span style="color: hsl(0, 100%, 40%);">-                AST_BRIDGE_IMPART_CHAN_DEPARTABLE);</span><br><span style="color: hsl(120, 100%, 40%);">+           flags);</span><br><span>      if (res != 0) {</span><br><span>              /* ast_bridge_impart failed before it could spawn the depart</span><br><span>                  * thread.  The callbacks aren't called in this case.</span><br><span>@@ -1469,6 +1473,12 @@</span><br><span>   control->bridge_features->mute = mute;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+void stasis_app_control_inhibit_colp_in_bridge(</span><br><span style="color: hsl(120, 100%, 40%);">+        struct stasis_app_control *control, int inhibit_colp)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      control->bridge_features->inhibit_colp = inhibit_colp;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> void control_flush_queue(struct stasis_app_control *control)</span><br><span> {</span><br><span>       struct ao2_iterator iter;</span><br><span>diff --git a/rest-api/api-docs/bridges.json b/rest-api/api-docs/bridges.json</span><br><span>index 22743c3..29d8d16 100644</span><br><span>--- a/rest-api/api-docs/bridges.json</span><br><span>+++ b/rest-api/api-docs/bridges.json</span><br><span>@@ -191,6 +191,15 @@</span><br><span>                                                        "allowMultiple": false,</span><br><span>                                                    "dataType": "boolean",</span><br><span>                                                   "defaultValue": false</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%);">+                                                     "name": "inhibitCOLP",</span><br><span style="color: hsl(120, 100%, 40%);">+                                                    "description": "Do not generate COLP frames when joining the bridge",</span><br><span style="color: hsl(120, 100%, 40%);">+                                                     "paramType": "query",</span><br><span style="color: hsl(120, 100%, 40%);">+                                                     "required": false,</span><br><span style="color: hsl(120, 100%, 40%);">+                                                  "allowMultiple": false,</span><br><span style="color: hsl(120, 100%, 40%);">+                                                     "dataType": "boolean",</span><br><span style="color: hsl(120, 100%, 40%);">+                                                    "defaultValue": false</span><br><span>                                              }</span><br><span>                                    ],</span><br><span>                                   "errorResponses": [</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13306">change 13306</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/+/13306"/><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: Ib995d4f0c6106279aa448b34b042b68f0f2ca5dc </div>
<div style="display:none"> Gerrit-Change-Number: 13306 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Jean Aunis - Prescom <jean.aunis@prescom.fr> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>