<p>Kevin Harwell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8615">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">bridge_softmix: Clear "talking" when a channel is put on hold<br><br>This patch clears the talking flag from the channel (if already set), and<br>notifies listeners when that channel is put on hold. Note however, if the<br>endpoint continues to send audio frames and these are received by the bridge<br>then that channel will be put back into a "talking" state even though they<br>are on hold.<br><br>ASTERISK-27755 #close<br><br>Change-Id: I930e16c4662810f9f02043d69062f88173c5e2ef<br>---<br>M bridges/bridge_softmix.c<br>1 file changed, 37 insertions(+), 11 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/15/8615/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c<br>index 9986d9c..16e1fb8 100644<br>--- a/bridges/bridge_softmix.c<br>+++ b/bridges/bridge_softmix.c<br>@@ -956,6 +956,30 @@<br> <br> /*!<br>  * \internal<br>+ * \brief Clear talking flag, stop contributing to mixing and notify handlers.<br>+ * \since 13.21.0, 15.4.0<br>+ *<br>+ * \param bridge_channel Which channel's talking to clear<br>+ *<br>+ * \return Nothing<br>+ */<br>+static void clear_talking(struct ast_bridge_channel *bridge_channel)<br>+{<br>+  struct softmix_channel *sc = bridge_channel->tech_pvt;<br>+<br>+ if (sc->talking) {<br>+                ast_mutex_lock(&sc->lock);<br>+            ast_slinfactory_flush(&sc->factory);<br>+          sc->talking = 0;<br>+          ast_mutex_unlock(&sc->lock);<br>+<br>+               /* Notify that we are no longer talking. */<br>+          ast_bridge_channel_notify_talking(bridge_channel, 0);<br>+        }<br>+}<br>+<br>+/*!<br>+ * \internal<br>  * \brief Check for voice status updates.<br>  * \since 13.20.0<br>  *<br>@@ -966,23 +990,14 @@<br>  */<br> static void softmix_bridge_check_voice(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)<br> {<br>-   struct softmix_channel *sc = bridge_channel->tech_pvt;<br>-<br>- if (sc->talking<br>-           && bridge_channel->features->mute) {<br>+   if (bridge_channel->features->mute) {<br>           /*<br>             * We were muted while we were talking.<br>                *<br>             * Immediately stop contributing to mixing<br>             * and report no longer talking.<br>               */<br>-          ast_mutex_lock(&sc->lock);<br>-            ast_slinfactory_flush(&sc->factory);<br>-          sc->talking = 0;<br>-          ast_mutex_unlock(&sc->lock);<br>-<br>-               /* Notify that we are no longer talking. */<br>-          ast_bridge_channel_notify_talking(bridge_channel, 0);<br>+                clear_talking(bridge_channel);<br>        }<br> }<br> <br>@@ -1113,6 +1128,17 @@<br>       */<br> <br>        switch (frame->subclass.integer) {<br>+        case AST_CONTROL_HOLD:<br>+               /*<br>+            * Doing anything for holds in a conference bridge could be considered a bit<br>+          * odd. That being said, in most cases one would probably want the talking<br>+            * flag cleared when 'hold' is pressed by the remote endpoint, so go ahead<br>+            * and do that here. However, that is all we'll do. Meaning if for some reason<br>+            * the endpoint continues to send audio frames despite pressing 'hold' talking<br>+                * will once again be detected for that channel.<br>+              */<br>+          clear_talking(bridge_channel);<br>+               break;<br>        case AST_CONTROL_VIDUPDATE:<br>           if (!bridge->softmix.video_mode.video_update_discard ||<br>                    ast_tvdiff_ms(ast_tvnow(), softmix_data->last_video_update) > bridge->softmix.video_mode.video_update_discard) {<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8615">change 8615</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8615"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I930e16c4662810f9f02043d69062f88173c5e2ef </div>
<div style="display:none"> Gerrit-Change-Number: 8615 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>