res/res_stasis: Fix accidental subscription to 'all' bridge topic

When b99a705262 was merged, subscribing to a
NULL bridge will now cause app_subscribe_bridge to implicitly subscribe to
all bridges. Unfortunately, the res_stasis control loop did not check that
a bridge changing on a channel's control object was actually also non-NULL.
As a result, app_subscribe_bridge will be called with a NULL bridge when a
channel leaves a bridge. This causes a new subscription to be made to the
bridge. If an application has also subscribed to the bridge, the application
will now have two subscriptions:
(1) The explicit one created by the app
(2) The implicit one accidentally created by the control structure

As a result, the 'BridgeDestroyed' event can be sent multiple times. This
patch corrects the control loop such that it only subscribes an application
to a new bridge if the bridge pointer is non-NULL.

ASTERISK-24870

Change-Id: I3510e55f6bc36517c10597ead857b964463c9f4f
changes/32/1332/1
Matt Jordan 10 years ago
parent 41f856e5a2
commit 90165e306d

@ -1294,7 +1294,9 @@ int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc,
if (bridge != last_bridge) {
app_unsubscribe_bridge(app, last_bridge);
app_subscribe_bridge(app, bridge);
if (bridge) {
app_subscribe_bridge(app, bridge);
}
}
if (bridge) {

Loading…
Cancel
Save