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
This commit is contained in:
Holger Hans Peter Freyther
2019-04-10 05:30:25 +01:00
committed by Joshua Colp
parent f2cb892d7c
commit f599ebd29e
2 changed files with 4 additions and 0 deletions

View File

@@ -1953,6 +1953,7 @@ int ast_bridge_impart(struct ast_bridge *bridge,
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);
}