[Asterisk-code-review] stasis: Call callbacks when imparting fails (...asterisk[16])

Friendly Automation asteriskteam at digium.com
Fri May 3 10:13:17 CDT 2019


Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/11254 )

Change subject: stasis: Call callbacks when imparting fails
......................................................................

stasis: Call callbacks when imparting fails

After a bridge has been deleted the stasis control will depart
the channel and might attempt to re-add it to the dial bridge.

The later can fail and this can lead to a situation that the stasis
control is unlinked but the after_bridge_cb_failed cb is executed trying
to access a dangling control object.

Fix it by calling the after_cb's before bridge_channel_impart_signal.

ASTERISK-26718

Change-Id: Ib4e8f70d7a21bd54afe3cb51cc6717ef7c355496
---
M include/asterisk/bridge.h
M main/bridge.c
2 files changed, 4 insertions(+), 0 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/include/asterisk/bridge.h b/include/asterisk/bridge.h
index dc8ebe5..13fa191 100644
--- a/include/asterisk/bridge.h
+++ b/include/asterisk/bridge.h
@@ -594,6 +594,9 @@
  * it were placed into the bridge by ast_bridge_join().
  * Channels placed into a bridge by ast_bridge_join() are
  * removed by a third party using ast_bridge_remove().
+ *
+ * \note Any callbacks on the channel will be invoked on failure
+ * with the reason as AST_BRIDGE_AFTER_CB_REASON_IMPART_FAILED.
  */
 int ast_bridge_impart(struct ast_bridge *bridge,
 	struct ast_channel *chan,
diff --git a/main/bridge.c b/main/bridge.c
index f3c34d1..9c53cfb 100644
--- a/main/bridge.c
+++ b/main/bridge.c
@@ -1953,6 +1953,7 @@
 	res = bridge_impart_internal(bridge, chan, swap, features, flags, &cond);
 	if (res) {
 		/* Impart failed.  Signal any other waiting impart threads */
+		ast_bridge_discard_after_callback(chan, AST_BRIDGE_AFTER_CB_REASON_IMPART_FAILED);
 		bridge_channel_impart_signal(chan);
 	}
 

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11254
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Ib4e8f70d7a21bd54afe3cb51cc6717ef7c355496
Gerrit-Change-Number: 11254
Gerrit-PatchSet: 3
Gerrit-Owner: Holger Hans Peter Freyther <automatic at freyther.de>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Holger Hans Peter Freyther <automatic at freyther.de>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190503/b5192720/attachment.html>


More information about the asterisk-code-review mailing list