From: agupta Date: Tue, 30 Apr 2019 14:21:46 +0000 (+0530) Subject: stasis: Only place stasis created and dialed channels into dial bridge. X-Git-Tag: 16.4.0-rc1~10^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39c5188becf105eacf58d19d876b9358b7a9f434;p=thirdparty%2Fasterisk.git stasis: Only place stasis created and dialed channels into dial bridge. The dial bridge is meant to hold channels which have been created and dialed in stasis. It handles the frames coming from them and raises the appropriate events. It was possible for the code to mistakenly place calls which came from the dialplan into the dial bridge if they were not in an answered state. These channels are not outgoing channels and should not be placed into the dial bridge. The code now checks to ensure that only stasis created channels are placed into the dial bridge by checking that a PBX does not exist on the channel. ASTERISK-27756 Change-Id: Ideee69ff06c9a0b31f7ed61165f5c055f51d21b6 --- diff --git a/res/stasis/control.c b/res/stasis/control.c index 866b58e899..3532324800 100644 --- a/res/stasis/control.c +++ b/res/stasis/control.c @@ -1085,7 +1085,11 @@ static int depart_channel(struct stasis_app_control *control, struct ast_channel { ast_bridge_depart(chan); - if (!ast_check_hangup(chan) && ast_channel_state(chan) != AST_STATE_UP) { + /* Channels which have a PBX are not ones that have been created and dialed from ARI. They + * have externally come in from the dialplan, and thus should not be placed into the dial + * bridge. Only channels which are created and dialed in ARI should go into the dial bridge. + */ + if (!ast_check_hangup(chan) && ast_channel_state(chan) != AST_STATE_UP && !ast_channel_pbx(chan)) { /* Channel is still being dialed, so put it back in the dialing bridge */ add_to_dial_bridge(control, chan); }