mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-17 15:29:05 +00:00
Bridging: Use a ref to bridge_channel's channel to prevent crash.
There's a race condition with bridging where a bridge can be torn down causing the bridge_channel's ast_channel to become NULL when it's still needed. This particular case happened with attended transfers, but the crash occurred when trying to publish a stasis message. Now, the bridge_channel is locked, a ref to the ast_channel is obtained, and that ref is passed down the chain. Change-Id: Ic48715c0c041615d17d286790ae3e8c61bb28814
This commit is contained in:
@@ -193,6 +193,20 @@ struct ast_bridge_channel {
|
||||
} stream_map;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Get a ref to the bridge_channel's ast_channel
|
||||
*
|
||||
* \param bridge_channel The bridge channel
|
||||
*
|
||||
* \note The returned channel NEEDS to be unref'd once you are done with it. In general, this
|
||||
* function is best used when accessing the bridge_channel chan from outside of a bridging
|
||||
* thread.
|
||||
*
|
||||
* \retval ref'd ast_channel on success
|
||||
* \retval NULL otherwise
|
||||
*/
|
||||
struct ast_channel *ast_bridge_channel_get_chan(struct ast_bridge_channel *bridge_channel);
|
||||
|
||||
/*!
|
||||
* \brief Try locking the bridge_channel.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user