]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_confbridge: Add the Muted header to ConfbridgeJoin AMI event.
authorRichard Mudgett <rmudgett@digium.com>
Wed, 31 Jan 2018 21:45:42 +0000 (15:45 -0600)
committerRichard Mudgett <rmudgett@digium.com>
Mon, 5 Feb 2018 19:48:00 +0000 (13:48 -0600)
ASTERISK-27651

Change-Id: Idef2ca54d242d1b894efd3fc7b360bc6fd5bdc34

CHANGES
apps/app_confbridge.c
apps/confbridge/confbridge_manager.c

diff --git a/CHANGES b/CHANGES
index e582152b719dafb39c8331dd19254b31bcfdd322..1fc2a7f395afef8e975c016184a13d37de06f175 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -8,6 +8,15 @@
 ===
 ==============================================================================
 
+------------------------------------------------------------------------------
+--- Functionality changes from Asterisk 13.18-cert2 to Asterisk 13.18-cert3 --
+------------------------------------------------------------------------------
+
+app_confbridge
+------------------
+ * Added the Muted header to the ConfbridgeJoin AMI event to indicate the
+   participant's starting mute status.
+
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 13.17.0 to Asterisk 13.18.0 ----------
 ------------------------------------------------------------------------------
index 3ea336a84c4cfc84e0e80085a5ae19dfda6a84e9..afeac48cb1f84830f6580953194020687bbf9046 100644 (file)
@@ -528,9 +528,9 @@ static void send_join_event(struct confbridge_user *user, struct confbridge_conf
 {
        struct ast_json *json_object;
 
-       json_object = ast_json_pack("{s: b}",
-               "admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN)
-       );
+       json_object = ast_json_pack("{s: b, s: b}",
+               "admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN),
+               "muted", user->muted);
        if (!json_object) {
                return;
        }
index bca854ed9b32c552d83a7e200857d5a58e1bd83e..9ac0d55a434a071e82d205000e4f470bb53ee64b 100644 (file)
@@ -83,6 +83,13 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                                                <enum name="No"/>
                                        </enumlist>
                                </parameter>
+                               <parameter name="Muted">
+                                       <para>The joining mute status.</para>
+                                       <enumlist>
+                                               <enum name="Yes"/>
+                                               <enum name="No"/>
+                                       </enumlist>
+                               </parameter>
                        </syntax>
                        <see-also>
                                <ref type="managerEvent">ConfbridgeLeave</ref>
@@ -254,20 +261,33 @@ static void confbridge_publish_manager_event(
                "%s",
                conference_name,
                ast_str_buffer(bridge_text),
-               S_COR(channel_text, ast_str_buffer(channel_text), ""),
-               S_COR(extra_text, ast_str_buffer(extra_text), ""));
+               channel_text ? ast_str_buffer(channel_text) : "",
+               extra_text ? ast_str_buffer(extra_text) : "");
 }
 
-static int get_admin_header(struct ast_str **extra_text, struct stasis_message *message)
+static int get_bool_header(struct ast_str **extra_text, struct stasis_message *message,
+       const char *json_key, const char *ami_header)
 {
        const struct ast_bridge_blob *blob = stasis_message_data(message);
-       const struct ast_json *admin = ast_json_object_get(blob->blob, "admin");
-       if (!admin) {
+       const struct ast_json *obj;
+
+       obj = ast_json_object_get(blob->blob, json_key);
+       if (!obj) {
                return -1;
        }
 
-       return ast_str_append_event_header(extra_text, "Admin",
-               S_COR(ast_json_is_true(admin), "Yes", "No"));
+       return ast_str_append_event_header(extra_text, ami_header,
+               AST_YESNO(ast_json_is_true(obj)));
+}
+
+static int get_admin_header(struct ast_str **extra_text, struct stasis_message *message)
+{
+       return get_bool_header(extra_text, message, "admin", "Admin");
+}
+
+static int get_muted_header(struct ast_str **extra_text, struct stasis_message *message)
+{
+       return get_bool_header(extra_text, message, "muted", "Muted");
 }
 
 static void confbridge_start_cb(void *data, struct stasis_subscription *sub,
@@ -298,7 +318,8 @@ static void confbridge_join_cb(void *data, struct stasis_subscription *sub,
 {
        struct ast_str *extra_text = NULL;
 
-       if (!get_admin_header(&extra_text, message)) {
+       if (!get_admin_header(&extra_text, message)
+               && !get_muted_header(&extra_text, message)) {
                confbridge_publish_manager_event(message, "ConfbridgeJoin", extra_text);
        }
        ast_free(extra_text);