summaryrefslogtreecommitdiff
path: root/res/res_stasis.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2016-06-13 17:40:07 -0500
committerMark Michelson <mmichelson@digium.com>2016-06-20 09:41:26 -0500
commit11caa10cf5abae8abef91a887c30e81e8d38486a (patch)
treeb5d0f64742addfb0816bc0700e3c5fe99e32d157 /res/res_stasis.c
parent827c47b7461dc037c66cc3afb2db439daa98cd96 (diff)
ARI: Ensure announcer channels are destroyed.
Announcer channels were not being destroyed because the stasis_app_control structure that referenced them was not being destroyed. The control structure was not being destroyed because it was not being unlinked from its container. It was not being unlinked from its container because the after bridge callback for the announcer channel was not being run. The after bridge callback was not being run because the after bridge datastore was not being removed from the channel on destruction. The channel was not being destroyed because the hangup that used to destroy the channel was now only reducing the reference count to one. The reference count of the channel was only being reduced to one because the stasis_app_control structure was holding the final reference... The control structure used to not keep a reference to the channel, so that loop described above did not happen. The solution is to manually remove the control structure from its container when the playback on a bridge is complete. ASTERISK-26083 #close Reported by Joshua Colp Change-Id: I0ddc0f64484ea0016245800b409b567dfe85cfb4
Diffstat (limited to 'res/res_stasis.c')
-rw-r--r--res/res_stasis.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/res/res_stasis.c b/res/res_stasis.c
index e7e6bcaa3..464f7c42f 100644
--- a/res/res_stasis.c
+++ b/res/res_stasis.c
@@ -713,6 +713,22 @@ int stasis_app_bridge_playback_channel_add(struct ast_bridge *bridge,
return 0;
}
+void stasis_app_bridge_playback_channel_remove(char *bridge_id,
+ struct stasis_app_control *control)
+{
+ struct stasis_app_bridge_channel_wrapper *wrapper;
+
+ wrapper = ao2_find(app_bridges_playback, bridge_id, OBJ_SEARCH_KEY | OBJ_UNLINK);
+ if (wrapper) {
+ /* If wrapper is not found, then that means the after bridge callback has been
+ * called or is in progress. No need to unlink the control here since that has
+ * been done or is about to be done in the after bridge callback
+ */
+ ao2_unlink(app_controls, control);
+ ao2_ref(wrapper, -1);
+ }
+}
+
struct ast_channel *stasis_app_bridge_playback_channel_find(struct ast_bridge *bridge)
{
struct stasis_app_bridge_channel_wrapper *playback_wrapper;