]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_confbridge: Add talking indicator for ConfBridgeList AMI response
authorWilliam McCall <william.mccall@gmail.com>
Tue, 29 May 2018 00:17:52 +0000 (00:17 +0000)
committerWilliam McCall <william.mccall@gmail.com>
Fri, 1 Jun 2018 05:34:06 +0000 (05:34 +0000)
When an AMI client connects, it cannot determine if a user was talking
prior to a transition in the user speaking state (which would generate
a ConfbridgeTalking event). This patch causes app_confbridge to track the
talking state and make this state available via ConfBridgeList.

ASTERISK-27877 #close

Change-Id: I19b5284f34966c3fda94f5b99a7e40e6b89767c6

CHANGES
apps/app_confbridge.c
apps/confbridge/include/confbridge.h

diff --git a/CHANGES b/CHANGES
index 4bb273790fdf7c11968b2c4128750bda7d7dc7a7..a02cd8aeba9df029c120aeae39e92bd306bc904e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -28,6 +28,12 @@ app_sendtext
     Content-Type of a message.  Since you can now set Content-Type, other
     text/* content types are now valid.
 
+app_confbridge
+------------------
+  * ConfbridgeList now shows talking status. This utilizes the same voice
+    detection as the ConfbridgeTalking event, so bridges must be configured
+    with "talk_detection_events=yes" for this flag to have meaning.
+
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 13.20.0 to Asterisk 13.21.0 ----------
 ------------------------------------------------------------------------------
index df932151e775871422320d2280689f2384c5ad6c..ebeef92019f422eccbf85dab3c6c67613a4e8ee9 100644 (file)
@@ -278,6 +278,13 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                                                <enum name="No"/>
                                        </enumlist>
                                </parameter>
+                               <parameter name="Talking">
+                                       <para>Is this user talking?</para>
+                                       <enumlist>
+                                               <enum name="Yes"/>
+                                               <enum name="No"/>
+                                       </enumlist>
+                               </parameter>
                                <parameter name="AnsweredTime">
                                        <para>The number of seconds the channel has been up.</para>
                                </parameter>
@@ -2085,7 +2092,7 @@ static int play_sound_number(struct confbridge_conference *conference, int say_n
 
 static int conf_handle_talker_cb(struct ast_bridge_channel *bridge_channel, void *hook_pvt, int talking)
 {
-       const struct confbridge_user *user = hook_pvt;
+       struct confbridge_user *user = hook_pvt;
        RAII_VAR(struct confbridge_conference *, conference, NULL, ao2_cleanup);
        struct ast_json *talking_extras;
 
@@ -2095,6 +2102,10 @@ static int conf_handle_talker_cb(struct ast_bridge_channel *bridge_channel, void
                return -1;
        }
 
+       ao2_lock(conference);
+       user->talking = talking;
+       ao2_unlock(conference);
+
        talking_extras = ast_json_pack("{s: s, s: b}",
                "talking_status", talking ? "on" : "off",
                "admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN));
@@ -3526,6 +3537,7 @@ static int action_confbridgelist_item(struct mansession *s, const char *id_text,
                "EndMarked: %s\r\n"
                "Waiting: %s\r\n"
                "Muted: %s\r\n"
+               "Talking: %s\r\n"
                "AnsweredTime: %d\r\n"
                "%s"
                "\r\n",
@@ -3537,6 +3549,7 @@ static int action_confbridgelist_item(struct mansession *s, const char *id_text,
                AST_YESNO(ast_test_flag(&user->u_profile, USER_OPT_ENDMARKED)),
                AST_YESNO(waiting),
                AST_YESNO(user->muted),
+               AST_YESNO(user->talking),
                ast_channel_get_up_time(user->chan),
                ast_str_buffer(snap_str));
 
index e59400c3ec8b2f1ed2e71caf3243576e9a4abd9b..a1f9f4a087099a6f45654792c8d412f95e191c99 100644 (file)
@@ -254,6 +254,7 @@ struct confbridge_user {
        unsigned int muted:1;                        /*!< Has the user requested to be muted? */
        unsigned int kicked:1;                       /*!< User has been kicked from the conference */
        unsigned int playing_moh:1;                  /*!< MOH is currently being played to the user */
+       unsigned int talking:1;                      /*!< User is currently talking */
        AST_LIST_HEAD_NOLOCK(, post_join_action) post_join_list; /*!< List of sounds to play after joining */;
        AST_LIST_ENTRY(confbridge_user) list;        /*!< Linked list information */
 };