<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19329">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span></span><br></pre><div style="white-space:pre-wrap">Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">features: Add no answer option to Bridge.<br><br>Adds the n "no answer" option to the Bridge application<br>so that answer supervision can not automatically<br>be provided when Bridge is executed.<br><br>Additionally, a mechanism (dialplan variable)<br>is added to prevent bridge targets (typically the<br>target of a masquerade) from answering the channel<br>when they enter the bridge.<br><br>ASTERISK-30223 #close<br><br>Change-Id: I76f73fcd8e403bcd18f2abb40c658f537ac1ba6d<br>---<br>A doc/CHANGES-staging/features_bridge_noanswer.txt<br>M main/features.c<br>2 files changed, 49 insertions(+), 4 deletions(-)<br><br></pre>
<pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/doc/CHANGES-staging/features_bridge_noanswer.txt b/doc/CHANGES-staging/features_bridge_noanswer.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..7399ad1</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/features_bridge_noanswer.txt</span><br><span>@@ -0,0 +1,5 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: features</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+The Bridge application now has the n "no answer" option</span><br><span style="color: hsl(120, 100%, 40%);">+that can be used to prevent the channel from being</span><br><span style="color: hsl(120, 100%, 40%);">+automatically answered prior to bridging.</span><br><span>diff --git a/main/features.c b/main/features.c</span><br><span>index db584b5..39d8aab 100644</span><br><span>--- a/main/features.c</span><br><span>+++ b/main/features.c</span><br><span>@@ -164,6 +164,12 @@</span><br><span>                                                         </variable></span><br><span>                                            </variablelist></span><br><span>                                        </option></span><br><span style="color: hsl(120, 100%, 40%);">+                                       <option name="n"></span><br><span style="color: hsl(120, 100%, 40%);">+                                             <para>Do not answer the channel automatically before bridging.</para></span><br><span style="color: hsl(120, 100%, 40%);">+                                             <para>Additionally, to prevent a bridged channel (the target of the Bridge application)</span><br><span style="color: hsl(120, 100%, 40%);">+                                         from answering, the <literal>BRIDGE_NOANSWER</literal> variable can be set to inhibit</span><br><span style="color: hsl(120, 100%, 40%);">+                                             answering.</para></span><br><span style="color: hsl(120, 100%, 40%);">+                                       </option></span><br><span>                                      <option name="S(x)"></span><br><span>                                                 <para>Hang up the call after <replaceable>x</replaceable> seconds *after* the called party has answered the call.</para></span><br><span>                                     </option></span><br><span>@@ -525,7 +531,7 @@</span><br><span> }</span><br><span> </span><br><span> static int pre_bridge_setup(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config,</span><br><span style="color: hsl(0, 100%, 40%);">-             struct ast_bridge_features *chan_features, struct ast_bridge_features *peer_features)</span><br><span style="color: hsl(120, 100%, 40%);">+         struct ast_bridge_features *chan_features, struct ast_bridge_features *peer_features, int noanswer)</span><br><span> {</span><br><span>     int res;</span><br><span>     SCOPE_TRACE(1, "%s Peer: %s\n", ast_channel_name(chan), ast_channel_name(peer));</span><br><span>@@ -553,7 +559,10 @@</span><br><span> </span><br><span>        res = 0;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-    if (ast_channel_state(chan) != AST_STATE_UP) {</span><br><span style="color: hsl(120, 100%, 40%);">+        if (noanswer) {</span><br><span style="color: hsl(120, 100%, 40%);">+               ast_debug(1, "Skipping answer on %s due to no answer directive\n", ast_channel_name(chan));</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (ast_channel_state(chan) != AST_STATE_UP) {</span><br><span style="color: hsl(120, 100%, 40%);">+         ast_debug(1, "Answering channel for bridge: %s\n", ast_channel_name(chan));</span><br><span>                res = ast_raw_answer_with_stream_topology(chan, config->answer_topology);</span><br><span>                 if (res != 0) {</span><br><span>                      return -1;</span><br><span>@@ -627,6 +636,8 @@</span><br><span>     struct ast_bridge *bridge;</span><br><span>   struct ast_bridge_features chan_features;</span><br><span>    struct ast_bridge_features *peer_features;</span><br><span style="color: hsl(120, 100%, 40%);">+    const char *value;</span><br><span style="color: hsl(120, 100%, 40%);">+    int noanswer;</span><br><span>        SCOPE_TRACE(1, "%s Peer: %s\n", ast_channel_name(chan), ast_channel_name(peer));</span><br><span> </span><br><span>       /* Setup features. */</span><br><span>@@ -639,7 +650,12 @@</span><br><span>                 return -1;</span><br><span>   }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   if (pre_bridge_setup(chan, peer, config, &chan_features, peer_features)) {</span><br><span style="color: hsl(120, 100%, 40%);">+        ast_channel_lock(chan);</span><br><span style="color: hsl(120, 100%, 40%);">+       value = pbx_builtin_getvar_helper(chan, "BRIDGE_NOANSWER");</span><br><span style="color: hsl(120, 100%, 40%);">+ noanswer = !ast_strlen_zero(value) ? 1 : 0;</span><br><span style="color: hsl(120, 100%, 40%);">+   ast_channel_unlock(chan);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   if (pre_bridge_setup(chan, peer, config, &chan_features, peer_features, noanswer)) {</span><br><span>             ast_bridge_features_destroy(peer_features);</span><br><span>          ast_bridge_features_cleanup(&chan_features);</span><br><span>             bridge_failed_peer_goto(chan, peer);</span><br><span>@@ -848,6 +864,7 @@</span><br><span>   OPT_CALLER_PARK = (1 << 10),</span><br><span>   OPT_CALLEE_KILL = (1 << 11),</span><br><span>   OPT_CALLEE_GO_ON = (1 << 12),</span><br><span style="color: hsl(120, 100%, 40%);">+   OPT_NOANSWER = (1 << 13),</span><br><span> };</span><br><span> </span><br><span> enum {</span><br><span>@@ -866,6 +883,7 @@</span><br><span>    AST_APP_OPTION('k', OPT_CALLEE_PARK),</span><br><span>        AST_APP_OPTION('K', OPT_CALLER_PARK),</span><br><span>        AST_APP_OPTION_ARG('L', OPT_DURATION_LIMIT, OPT_ARG_DURATION_LIMIT),</span><br><span style="color: hsl(120, 100%, 40%);">+  AST_APP_OPTION('n', OPT_NOANSWER),</span><br><span>   AST_APP_OPTION_ARG('S', OPT_DURATION_STOP, OPT_ARG_DURATION_STOP),</span><br><span>   AST_APP_OPTION('t', OPT_CALLEE_TRANSFER),</span><br><span>    AST_APP_OPTION('T', OPT_CALLER_TRANSFER),</span><br><span>@@ -1012,6 +1030,7 @@</span><br><span>    struct ast_bridge_features *peer_features;</span><br><span>   struct ast_bridge *bridge;</span><br><span>   struct ast_features_xfer_config *xfer_cfg;</span><br><span style="color: hsl(120, 100%, 40%);">+    int noanswer;</span><br><span> </span><br><span>    AST_DECLARE_APP_ARGS(args,</span><br><span>           AST_APP_ARG(dest_chan);</span><br><span>@@ -1066,6 +1085,7 @@</span><br><span>              ast_set_flag(&(bconfig.features_callee), AST_FEATURE_PARKCALL);</span><br><span>  if (ast_test_flag(&opts, OPT_CALLER_PARK))</span><br><span>               ast_set_flag(&(bconfig.features_caller), AST_FEATURE_PARKCALL);</span><br><span style="color: hsl(120, 100%, 40%);">+   noanswer = ast_test_flag(&opts, OPT_NOANSWER);</span><br><span> </span><br><span>       /* Setup after bridge goto location. */</span><br><span>      if (ast_test_flag(&opts, OPT_CALLEE_GO_ON)) {</span><br><span>@@ -1096,7 +1116,7 @@</span><br><span>            goto done;</span><br><span>   }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   if (pre_bridge_setup(chan, current_dest_chan, &bconfig, &chan_features, peer_features)) {</span><br><span style="color: hsl(120, 100%, 40%);">+     if (pre_bridge_setup(chan, current_dest_chan, &bconfig, &chan_features, peer_features, noanswer)) {</span><br><span>          ast_bridge_features_destroy(peer_features);</span><br><span>          ast_bridge_features_cleanup(&chan_features);</span><br><span>             goto done;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19329">change 19329</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/+/19329"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 19 </div>
<div style="display:none"> Gerrit-Change-Id: I76f73fcd8e403bcd18f2abb40c658f537ac1ba6d </div>
<div style="display:none"> Gerrit-Change-Number: 19329 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>