<p>N A has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19419">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_dahdi: Fix unavailable channels returning busy.<br><br>This fixes dahdi_request to properly set the cause<br>code to CONGESTION instead of BUSY if no channels<br>were actually available.<br><br>Currently, the cause is erroneously set to busy<br>if the channel itself is found, regardless of its<br>current state. However, if the channel is not available<br>(e.g. T1 down, card not operable, etc.), then the<br>channel itself may not be in a functional state,<br>in which case CHANUNAVAIL is the correct cause to use.<br><br>This adds a simple check to ensure that busy tone<br>is only returned if a channel is encountered that<br>has an owner, since that is the only possible way<br>that a channel could actually be busy.<br><br>ASTERISK-30274 #close<br><br>Change-Id: Iad5870223c081240c925b19df8d6af136953b994<br>---<br>M channels/chan_dahdi.c<br>1 file changed, 33 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/19/19419/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c</span><br><span>index e952796..5607eb0 100644</span><br><span>--- a/channels/chan_dahdi.c</span><br><span>+++ b/channels/chan_dahdi.c</span><br><span>@@ -13652,6 +13652,7 @@</span><br><span>   struct ast_channel *tmp = NULL;</span><br><span>      struct dahdi_pvt *exitpvt;</span><br><span>   int channelmatched = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+       int foundowner = 0;</span><br><span>  int groupmatched = 0;</span><br><span> #if defined(HAVE_PRI) || defined(HAVE_SS7)</span><br><span>  int transcapdigital = 0;</span><br><span>@@ -13675,6 +13676,10 @@</span><br><span>          if (start.roundrobin)</span><br><span>                        round_robin[start.rr_starting_point] = p;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+         if (p->owner) {</span><br><span style="color: hsl(120, 100%, 40%);">+                    foundowner++;</span><br><span style="color: hsl(120, 100%, 40%);">+         }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>          if (is_group_or_channel_match(p, start.span, start.groupmatch, &groupmatched, start.channelmatch, &channelmatched)</span><br><span>                   && available(&p, channelmatched)) {</span><br><span>                      ast_debug(1, "Using channel %d\n", p->channel);</span><br><span>@@ -13793,7 +13798,7 @@</span><br><span>       ast_mutex_unlock(&iflock);</span><br><span>       restart_monitor();</span><br><span>   if (cause && !tmp) {</span><br><span style="color: hsl(0, 100%, 40%);">-            if (callwait || channelmatched) {</span><br><span style="color: hsl(120, 100%, 40%);">+             if (callwait || (channelmatched && foundowner)) {</span><br><span>                    *cause = AST_CAUSE_BUSY;</span><br><span>             } else if (groupmatched) {</span><br><span>                   *cause = AST_CAUSE_CONGESTION;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19419">change 19419</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/+/19419"/><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: Iad5870223c081240c925b19df8d6af136953b994 </div>
<div style="display:none"> Gerrit-Change-Number: 19419 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: N A <asterisk@phreaknet.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>