<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13554">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Sean Bright: Looks good to me, but someone else must approve
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">features.c: Make Bridge application tolerate unspecified channel.<br><br>The Bridge application was inconsistent if the channel to bridge with is<br>not specified.  If no parameters are given then a warning is issued and<br>the current channel is hung up.  If options are given but no channel is<br>specified then a warning is issued and the current channel is not hung up.<br><br>* Made the Bridge application give a verbose message instead of a warning<br>if the channel to bridge with is not specified and made not hang up the<br>current channel.  As a result dialplan no longer needs to check if a<br>channel name is passed before calling Bridge and simply needs to check the<br>BRIDGERESULT channel variable instead.  This is something you likely want<br>your dialplan to do anyway.<br><br>* Fixed up L() option warning message.  It is up to the caller to<br>determine if the channel is hung up because of the warning.  Dial() hangs<br>up the current channel while Bridge() does not.<br><br>Change-Id: I44349a8dc3912397f28852777de04f19e7bb9c73<br>---<br>M main/features.c<br>1 file changed, 15 insertions(+), 15 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/features.c b/main/features.c</span><br><span>index 21e6c22..d306a13 100644</span><br><span>--- a/main/features.c</span><br><span>+++ b/main/features.c</span><br><span>@@ -85,7 +85,9 @@</span><br><span>                </synopsis></span><br><span>            <syntax></span><br><span>                       <parameter name="channel" required="true"></span><br><span style="color: hsl(0, 100%, 40%);">-                            <para>The current channel is bridged to the specified <replaceable>channel</replaceable>.</para></span><br><span style="color: hsl(120, 100%, 40%);">+                              <para>The current channel is bridged to the channel</span><br><span style="color: hsl(120, 100%, 40%);">+                             identified by the channel name, channel name prefix, or channel</span><br><span style="color: hsl(120, 100%, 40%);">+                               uniqueid.</para></span><br><span>                       </parameter></span><br><span>                   <parameter name="options"></span><br><span>                           <optionlist></span><br><span>@@ -895,7 +897,7 @@</span><br><span>             config->warning_freq = atol(warnfreq_str);</span><br><span> </span><br><span>    if (!config->timelimit) {</span><br><span style="color: hsl(0, 100%, 40%);">-            ast_log(LOG_WARNING, "Bridge does not accept L(%s), hanging up.\n", limit_str);</span><br><span style="color: hsl(120, 100%, 40%);">+             ast_log(LOG_WARNING, "Bridge does not accept L(%s)\n", limit_str);</span><br><span>                 config->timelimit = config->play_warning = config->warning_freq = 0;</span><br><span>                config->warning_sound = NULL;</span><br><span>             return -1; /* error */</span><br><span>@@ -998,7 +1000,7 @@</span><br><span>  */</span><br><span> static int bridge_exec(struct ast_channel *chan, const char *data)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_channel *current_dest_chan;</span><br><span style="color: hsl(120, 100%, 40%);">+        struct ast_channel *current_dest_chan = NULL;</span><br><span>        char *tmp_data  = NULL;</span><br><span>      struct ast_flags opts = { 0, };</span><br><span>      struct ast_bridge_config bconfig = { { 0, }, };</span><br><span>@@ -1019,22 +1021,20 @@</span><br><span>            AST_APP_ARG(options);</span><br><span>        );</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  if (ast_strlen_zero(data)) {</span><br><span style="color: hsl(0, 100%, 40%);">-            ast_log(LOG_WARNING, "Bridge require at least 1 argument specifying the other end of the bridge\n");</span><br><span style="color: hsl(0, 100%, 40%);">-          return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+    tmp_data = ast_strdupa(data ?: "");</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_STANDARD_APP_ARGS(args, tmp_data);</span><br><span style="color: hsl(120, 100%, 40%);">+        if (!ast_strlen_zero(args.options)) {</span><br><span style="color: hsl(120, 100%, 40%);">+         ast_app_parse_options(bridge_exec_options, &opts, opt_args, args.options);</span><br><span>       }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   tmp_data = ast_strdupa(data);</span><br><span style="color: hsl(0, 100%, 40%);">-   AST_STANDARD_APP_ARGS(args, tmp_data);</span><br><span style="color: hsl(0, 100%, 40%);">-  if (!ast_strlen_zero(args.options))</span><br><span style="color: hsl(0, 100%, 40%);">-             ast_app_parse_options(bridge_exec_options, &opts, opt_args, args.options);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>       /* make sure we have a valid end point */</span><br><span style="color: hsl(0, 100%, 40%);">-       current_dest_chan = ast_channel_get_by_name_prefix(args.dest_chan,</span><br><span style="color: hsl(0, 100%, 40%);">-              strlen(args.dest_chan));</span><br><span style="color: hsl(120, 100%, 40%);">+      if (!ast_strlen_zero(args.dest_chan)) {</span><br><span style="color: hsl(120, 100%, 40%);">+               current_dest_chan = ast_channel_get_by_name_prefix(args.dest_chan,</span><br><span style="color: hsl(120, 100%, 40%);">+                    strlen(args.dest_chan));</span><br><span style="color: hsl(120, 100%, 40%);">+      }</span><br><span>    if (!current_dest_chan) {</span><br><span style="color: hsl(0, 100%, 40%);">-               ast_log(LOG_WARNING, "Bridge failed because channel %s does not exist\n",</span><br><span style="color: hsl(0, 100%, 40%);">-                     args.dest_chan);</span><br><span style="color: hsl(120, 100%, 40%);">+              ast_verb(4, "Bridge failed because channel '%s' does not exist\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                  args.dest_chan ?: "");</span><br><span>             pbx_builtin_setvar_helper(chan, "BRIDGERESULT", "NONEXISTENT");</span><br><span>          return 0;</span><br><span>    }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13554">change 13554</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/+/13554"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-Change-Id: I44349a8dc3912397f28852777de04f19e7bb9c73 </div>
<div style="display:none"> Gerrit-Change-Number: 13554 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.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-Reviewer: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>