summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2018-03-20 15:28:12 -0500
committerKevin Harwell <kharwell@digium.com>2018-03-20 14:34:11 -0600
commitcf73a4203f8a4a84e186dae525694250762c946a (patch)
treec0d95edfd2deaf1c82b339204d2fecb8bc639764
parentbfefde5b07579f8d075131bd1591ab7e7c0bcaf6 (diff)
bridge_softmix: Clear "talking" when a channel is put on hold
This patch clears the talking flag from the channel (if already set), and notifies listeners when that channel is put on hold. Note however, if the endpoint continues to send audio frames and these are received by the bridge then that channel will be put back into a "talking" state even though they are on hold. ASTERISK-27755 #close Change-Id: I930e16c4662810f9f02043d69062f88173c5e2ef
-rw-r--r--bridges/bridge_softmix.c48
1 files changed, 37 insertions, 11 deletions
diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c
index 9986d9c73..16e1fb897 100644
--- a/bridges/bridge_softmix.c
+++ b/bridges/bridge_softmix.c
@@ -956,6 +956,30 @@ static void softmix_bridge_write_voice(struct ast_bridge *bridge, struct ast_bri
/*!
* \internal
+ * \brief Clear talking flag, stop contributing to mixing and notify handlers.
+ * \since 13.21.0, 15.4.0
+ *
+ * \param bridge_channel Which channel's talking to clear
+ *
+ * \return Nothing
+ */
+static void clear_talking(struct ast_bridge_channel *bridge_channel)
+{
+ struct softmix_channel *sc = bridge_channel->tech_pvt;
+
+ if (sc->talking) {
+ ast_mutex_lock(&sc->lock);
+ ast_slinfactory_flush(&sc->factory);
+ sc->talking = 0;
+ ast_mutex_unlock(&sc->lock);
+
+ /* Notify that we are no longer talking. */
+ ast_bridge_channel_notify_talking(bridge_channel, 0);
+ }
+}
+
+/*!
+ * \internal
* \brief Check for voice status updates.
* \since 13.20.0
*
@@ -966,23 +990,14 @@ static void softmix_bridge_write_voice(struct ast_bridge *bridge, struct ast_bri
*/
static void softmix_bridge_check_voice(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
{
- struct softmix_channel *sc = bridge_channel->tech_pvt;
-
- if (sc->talking
- && bridge_channel->features->mute) {
+ if (bridge_channel->features->mute) {
/*
* We were muted while we were talking.
*
* Immediately stop contributing to mixing
* and report no longer talking.
*/
- ast_mutex_lock(&sc->lock);
- ast_slinfactory_flush(&sc->factory);
- sc->talking = 0;
- ast_mutex_unlock(&sc->lock);
-
- /* Notify that we are no longer talking. */
- ast_bridge_channel_notify_talking(bridge_channel, 0);
+ clear_talking(bridge_channel);
}
}
@@ -1113,6 +1128,17 @@ static int softmix_bridge_write_control(struct ast_bridge *bridge, struct ast_br
*/
switch (frame->subclass.integer) {
+ case AST_CONTROL_HOLD:
+ /*
+ * Doing anything for holds in a conference bridge could be considered a bit
+ * odd. That being said, in most cases one would probably want the talking
+ * flag cleared when 'hold' is pressed by the remote endpoint, so go ahead
+ * and do that here. However, that is all we'll do. Meaning if for some reason
+ * the endpoint continues to send audio frames despite pressing 'hold' talking
+ * will once again be detected for that channel.
+ */
+ clear_talking(bridge_channel);
+ break;
case AST_CONTROL_VIDUPDATE:
if (!bridge->softmix.video_mode.video_update_discard ||
ast_tvdiff_ms(ast_tvnow(), softmix_data->last_video_update) > bridge->softmix.video_mode.video_update_discard) {