]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_stasis: Don't unsubscribe from a NULL bridge. 34/4334/1
authorJoshua Colp <jcolp@digium.com>
Wed, 2 Nov 2016 15:52:13 +0000 (15:52 +0000)
committerJoshua Colp <jcolp@digium.com>
Thu, 3 Nov 2016 21:08:58 +0000 (21:08 +0000)
A NULL bridge has special meaning in res_stasis for
unsubscribing. It means that a subscription to ALL
bridges should be removed. This should not be done
as part of the normal subscription management in
the res_stasis channel loop.

ASTERISK-26468

Change-Id: I6d5bea8246dd13a22ef86b736aefbf2a39c15af0

res/res_stasis.c

index 1183f67b8a5683d46e645cfcaefeadff9169a6bb..19257e9ef8ac3b48bf3c799bf427f91504599e2e 100644 (file)
@@ -1315,7 +1315,9 @@ int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc,
                bridge = ao2_bump(stasis_app_get_bridge(control));
 
                if (bridge != last_bridge) {
-                       app_unsubscribe_bridge(app, last_bridge);
+                       if (last_bridge) {
+                               app_unsubscribe_bridge(app, last_bridge);
+                       }
                        if (bridge) {
                                app_subscribe_bridge(app, bridge);
                        }
@@ -1376,7 +1378,9 @@ int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc,
                ast_bridge_depart(chan);
        }
 
-       app_unsubscribe_bridge(app, stasis_app_get_bridge(control));
+       if (stasis_app_get_bridge(control)) {
+               app_unsubscribe_bridge(app, stasis_app_get_bridge(control));
+       }
        ao2_cleanup(bridge);
 
        /* Only publish a stasis_end event if it hasn't already been published */