<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/7251">View Change</a></p><div style="white-space:pre-wrap">Approvals:
George Joseph: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, approved
Joshua Colp: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">bridge_basic: Ignore answer from transfer target when they've timed out.<br><br>This is a fun one.<br><br>Given the following attended transfer scenario:<br><br>1. Transfer target is called<br>2. Transferer hangs up<br>3. Transfer target call attempt reaches timeout<br>4. Transfer target is told to hang up<br>5. Transfer target answers before channel is hung up<br>6. Transferer recall target is called<br><br>A crash would occur. This is because the transfer target call<br>attempt, despite being told to hang up, would raise a recall<br>target answer before the recall target had been answered. As it<br>had not answered there would be no recall target channel and it<br>would implode.<br><br>This change makes it so that if the transfer target has been<br>hung up we don't tell the attended transfer code that it has<br>answered. We also clear out the stimulus that the recall target<br>has been answered after telling the transfer target to hang up,<br>in case it was able to raise the information before we told it<br>to hangup.<br><br>ASTERISK-27361<br><br>Change-Id: Ifb8b255a9c4d2c5c1b8ad77bf54f659ed286df99<br>---<br>M main/bridge_basic.c<br>1 file changed, 23 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/bridge_basic.c b/main/bridge_basic.c<br>index b24df05..ef6d47c 100644<br>--- a/main/bridge_basic.c<br>+++ b/main/bridge_basic.c<br>@@ -1549,6 +1549,23 @@<br> ao2_unlock(props);<br> }<br> <br>+static void remove_attended_transfer_stimulus(struct attended_transfer_properties *props,<br>+ enum attended_transfer_stimulus stimulus)<br>+{<br>+ struct stimulus_list *list;<br>+<br>+ ao2_lock(props);<br>+ AST_LIST_TRAVERSE_SAFE_BEGIN(&props->stimulus_queue, list, next) {<br>+ if (list->stimulus == stimulus) {<br>+ AST_LIST_REMOVE_CURRENT(next);<br>+ ast_free(list);<br>+ break;<br>+ }<br>+ }<br>+ AST_LIST_TRAVERSE_SAFE_END;<br>+ ao2_unlock(props);<br>+}<br>+<br> /*!<br> * \brief Get a desired transfer party for a bridge the transferer is not in.<br> *<br>@@ -2341,6 +2358,10 @@<br> return TRANSFER_RESUME;<br> case STIMULUS_TIMEOUT:<br> ast_softhangup(props->recall_target, AST_SOFTHANGUP_EXPLICIT);<br>+ /* It is possible before we hung them up that they queued up a recall target answer<br>+ * so we remove it if present as it should not exist.<br>+ */<br>+ remove_attended_transfer_stimulus(props, STIMULUS_RECALL_TARGET_ANSWER);<br> case STIMULUS_RECALL_TARGET_HANGUP:<br> props->recall_target = ast_channel_unref(props->recall_target);<br> return TRANSFER_RECALLING;<br>@@ -2806,7 +2827,8 @@<br> <br> if (event == AST_FRAMEHOOK_EVENT_READ &&<br> frame && frame->frametype == AST_FRAME_CONTROL &&<br>- frame->subclass.integer == AST_CONTROL_ANSWER) {<br>+ frame->subclass.integer == AST_CONTROL_ANSWER &&<br>+ !ast_check_hangup(chan)) {<br> <br> ast_debug(1, "Detected an answer for recall attempt on attended transfer %p\n", props);<br> if (props->superstate == SUPERSTATE_TRANSFER) {<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7251">change 7251</a>. To unsubscribe, 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/7251"/><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-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ifb8b255a9c4d2c5c1b8ad77bf54f659ed286df99 </div>
<div style="display:none"> Gerrit-Change-Number: 7251 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>