summaryrefslogtreecommitdiff
path: root/main/channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/main/channel.c b/main/channel.c
index 287ed305e..8e9f13dc9 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -10217,12 +10217,14 @@ int ast_channel_is_leaving_bridge(struct ast_channel *chan)
{
int hangup_flags = ast_channel_softhangup_internal_flag(chan);
int hangup_test = hangup_flags & AST_SOFTHANGUP_ASYNCGOTO;
+ int unbridge = ast_channel_unbridged(chan);
- /* This function should only return true if only the ASYNCGOTO
- * is set. It should false if any other flag is set or if the
- * ASYNCGOTO flag is not set.
+ /* This function should only return true if either the unbridged flag or
+ * the ASYNCGOTO soft hangup flag is set and when no other soft hangup
+ * flags are set. Any other soft hangup flags being set should make it
+ * return false.
*/
- return (hangup_test && (hangup_test == hangup_flags));
+ return ((hangup_test || unbridge) && (hangup_test == hangup_flags));
}
struct ast_channel *ast_channel_bridge_peer(struct ast_channel *chan)