summaryrefslogtreecommitdiff
path: root/apps/confbridge
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2016-08-23 05:54:18 -0500
committerJoshua Colp <jcolp@digium.com>2016-08-23 05:54:18 -0500
commitd5d7cbfcfb9502a03d3a6b5a69a796794770cd79 (patch)
treecf22ca3c03f4f9cf51240ae274dd473b7a32f754 /apps/confbridge
parent0cdeb2bfb0f4203384c08858951af3c77be8b9b3 (diff)
Revert "ConfBridge: Rework announcer channel methodology"
This reverts commit 0cdeb2bfb0f4203384c08858951af3c77be8b9b3. Change-Id: I18ba73b6d4dc0b994f4ffb01ae0b6cfad36ac636
Diffstat (limited to 'apps/confbridge')
-rw-r--r--apps/confbridge/conf_chan_announce.c30
-rw-r--r--apps/confbridge/include/confbridge.h12
2 files changed, 40 insertions, 2 deletions
diff --git a/apps/confbridge/conf_chan_announce.c b/apps/confbridge/conf_chan_announce.c
index 22ac4be39..ee4660687 100644
--- a/apps/confbridge/conf_chan_announce.c
+++ b/apps/confbridge/conf_chan_announce.c
@@ -143,6 +143,31 @@ struct ast_channel_tech *conf_announce_get_tech(void)
return &announce_tech;
}
+void conf_announce_channel_depart(struct ast_channel *chan)
+{
+ struct announce_pvt *p = ast_channel_tech_pvt(chan);
+
+ if (!p) {
+ return;
+ }
+
+ ao2_ref(p, +1);
+ ao2_lock(p);
+ if (!ast_test_flag(&p->base, AST_UNREAL_CARETAKER_THREAD)) {
+ ao2_unlock(p);
+ ao2_ref(p, -1);
+ return;
+ }
+ ast_clear_flag(&p->base, AST_UNREAL_CARETAKER_THREAD);
+ chan = p->base.chan;
+ ao2_unlock(p);
+ ao2_ref(p, -1);
+ if (chan) {
+ ast_bridge_depart(chan);
+ ast_channel_unref(chan);
+ }
+}
+
int conf_announce_channel_push(struct ast_channel *ast)
{
struct ast_bridge_features *features;
@@ -161,17 +186,20 @@ int conf_announce_channel_push(struct ast_channel *ast)
if (!chan) {
return -1;
}
+ ast_channel_ref(chan);
}
features = ast_bridge_features_new();
if (!features) {
+ ast_channel_unref(chan);
return -1;
}
ast_set_flag(&features->feature_flags, AST_BRIDGE_CHANNEL_FLAG_IMMOVABLE);
/* Impart the output channel into the bridge */
if (ast_bridge_impart(p->bridge, chan, NULL, features,
- AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) {
+ AST_BRIDGE_IMPART_CHAN_DEPARTABLE)) {
+ ast_channel_unref(chan);
return -1;
}
ao2_lock(p);
diff --git a/apps/confbridge/include/confbridge.h b/apps/confbridge/include/confbridge.h
index 451d81098..a1fa5a2b7 100644
--- a/apps/confbridge/include/confbridge.h
+++ b/apps/confbridge/include/confbridge.h
@@ -225,9 +225,9 @@ struct confbridge_conference {
struct ast_channel *record_chan; /*!< Channel used for recording the conference */
struct ast_str *record_filename; /*!< Recording filename. */
struct ast_str *orig_rec_file; /*!< Previous b_profile.rec_file. */
+ ast_mutex_t playback_lock; /*!< Lock used for playback channel */
AST_LIST_HEAD_NOLOCK(, confbridge_user) active_list; /*!< List of users participating in the conference bridge */
AST_LIST_HEAD_NOLOCK(, confbridge_user) waiting_list; /*!< List of users waiting to join the conference bridge */
- struct ast_taskprocessor *playback_queue; /*!< Queue for playing back bridge announcements and managing the announcer channel */
};
extern struct ao2_container *conference_bridges;
@@ -607,6 +607,16 @@ struct ast_channel_tech *conf_record_get_tech(void);
struct ast_channel_tech *conf_announce_get_tech(void);
/*!
+ * \brief Remove the announcer channel from the conference.
+ * \since 12.0.0
+ *
+ * \param chan Either channel in the announcer channel pair.
+ *
+ * \return Nothing
+ */
+void conf_announce_channel_depart(struct ast_channel *chan);
+
+/*!
* \brief Push the announcer channel into the conference.
* \since 12.0.0
*