<p>Frederic LE FOLL has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19489">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Dialing API: Cancel a running async thread, may not cancel all calls<br><br>race condition: ast_dial_join() may not cancel outgoing call, if<br>function is called just after called party answer and before<br>application execution (bit is_running_app not yet set).<br><br>This fix adds ast_softhangup() calls in addition to existing<br>pthread_kill() when is_running_app is not set.<br><br>ASTERISK-30258<br><br>Change-Id: Idbdd5c15122159661aa8e996a42d5800083131e4<br>---<br>M main/dial.c<br>1 file changed, 27 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/89/19489/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/dial.c b/main/dial.c</span><br><span>index 944207c..3906bd0 100644</span><br><span>--- a/main/dial.c</span><br><span>+++ b/main/dial.c</span><br><span>@@ -1043,8 +1043,17 @@</span><br><span>                      ast_channel_unlock(chan);</span><br><span>            }</span><br><span>    } else {</span><br><span style="color: hsl(120, 100%, 40%);">+              struct ast_dial_channel *channel = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>           /* Now we signal it with SIGURG so it will break out of it's waitfor */</span><br><span>          pthread_kill(thread, SIGURG);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+               /* pthread_kill may not be enough, if outgoing channel has already got an answer (no more in waitfor) but is not yet running an application. Force soft hangup. */</span><br><span style="color: hsl(120, 100%, 40%);">+            AST_LIST_TRAVERSE(&dial->channels, channel, list) {</span><br><span style="color: hsl(120, 100%, 40%);">+                    if (channel->owner) {</span><br><span style="color: hsl(120, 100%, 40%);">+                              ast_softhangup(channel->owner, AST_SOFTHANGUP_EXPLICIT);</span><br><span style="color: hsl(120, 100%, 40%);">+                   }</span><br><span style="color: hsl(120, 100%, 40%);">+             }</span><br><span>    }</span><br><span>    AST_LIST_UNLOCK(&dial->channels);</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19489">change 19489</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/+/19489"/><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: Idbdd5c15122159661aa8e996a42d5800083131e4 </div>
<div style="display:none"> Gerrit-Change-Number: 19489 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Frederic LE FOLL <frederic.lefoll@csgroup.eu> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>