<p>Richard Mudgett has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8140">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_confbridge: Add the Muted header to ConfbridgeJoin AMI event.<br><br>ASTERISK-27651<br><br>Change-Id: Idef2ca54d242d1b894efd3fc7b360bc6fd5bdc34<br>---<br>M CHANGES<br>M apps/app_confbridge.c<br>M apps/confbridge/confbridge_manager.c<br>3 files changed, 39 insertions(+), 13 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/40/8140/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/CHANGES b/CHANGES<br>index b9d8032..f747e1e 100644<br>--- a/CHANGES<br>+++ b/CHANGES<br>@@ -74,6 +74,11 @@<br>    extension and include.  These messages are no longer printed by the<br>    verbose loggers, they are now only logged as debug messages.<br> <br>+app_confbridge<br>+------------------<br>+ * Added the Muted header to the ConfbridgeJoin AMI event to indicate the<br>+   participant's starting mute status.<br>+<br> app_followme<br> ------------------<br>  * Added a new prompt, connecting-prompt, which will be played<br>diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c<br>index 7e6f94c..e2b87ca 100644<br>--- a/apps/app_confbridge.c<br>+++ b/apps/app_confbridge.c<br>@@ -530,9 +530,9 @@<br> {<br>       struct ast_json *json_object;<br> <br>-     json_object = ast_json_pack("{s: b}",<br>-              "admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN)<br>-    );<br>+   json_object = ast_json_pack("{s: b s: b}",<br>+         "admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN),<br>+           "muted", user->muted);<br>   if (!json_object) {<br>           return;<br>       }<br>diff --git a/apps/confbridge/confbridge_manager.c b/apps/confbridge/confbridge_manager.c<br>index e5db648..0f3c7fb 100644<br>--- a/apps/confbridge/confbridge_manager.c<br>+++ b/apps/confbridge/confbridge_manager.c<br>@@ -81,6 +81,13 @@<br>                                                <enum name="No"/><br>                                     </enumlist><br>                             </parameter><br>+                           <parameter name="Muted"><br>+                                     <para>The joining mute status.</para><br>+                                    <enumlist><br>+                                             <enum name="Yes"/><br>+                                           <enum name="No"/><br>+                                    </enumlist><br>+                            </parameter><br>                    </syntax><br>                       <see-also><br>                              <ref type="managerEvent">ConfbridgeLeave</ref><br>@@ -252,20 +259,33 @@<br>           "%s",<br>               conference_name,<br>              ast_str_buffer(bridge_text),<br>-         S_COR(channel_text, ast_str_buffer(channel_text), ""),<br>-             S_COR(extra_text, ast_str_buffer(extra_text), ""));<br>+                channel_text ? ast_str_buffer(channel_text) : "",<br>+          extra_text ? ast_str_buffer(extra_text) : "");<br>+}<br>+<br>+static int get_bool_header(struct ast_str **extra_text, struct stasis_message *message,<br>+    const char *json_key, const char *ami_header)<br>+{<br>+    const struct ast_bridge_blob *blob = stasis_message_data(message);<br>+   const struct ast_json *obj;<br>+<br>+       obj = ast_json_object_get(blob->blob, json_key);<br>+  if (!obj) {<br>+          return -1;<br>+   }<br>+<br>+ return ast_str_append_event_header(extra_text, ami_header,<br>+           AST_YESNO(ast_json_is_true(obj)));<br> }<br> <br> static int get_admin_header(struct ast_str **extra_text, struct stasis_message *message)<br> {<br>-     const struct ast_bridge_blob *blob = stasis_message_data(message);<br>-   const struct ast_json *admin = ast_json_object_get(blob->blob, "admin");<br>-        if (!admin) {<br>-                return -1;<br>-   }<br>+    return get_bool_header(extra_text, message, "admin", "Admin");<br>+}<br> <br>-    return ast_str_append_event_header(extra_text, "Admin",<br>-            S_COR(ast_json_is_true(admin), "Yes", "No"));<br>+static int get_muted_header(struct ast_str **extra_text, struct stasis_message *message)<br>+{<br>+     return get_bool_header(extra_text, message, "muted", "Muted");<br> }<br> <br> static void confbridge_start_cb(void *data, struct stasis_subscription *sub,<br>@@ -296,7 +316,8 @@<br> {<br>     struct ast_str *extra_text = NULL;<br> <br>-        if (!get_admin_header(&extra_text, message)) {<br>+   if (!get_admin_header(&extra_text, message)<br>+              && !get_muted_header(&extra_text, message)) {<br>             confbridge_publish_manager_event(message, "ConfbridgeJoin", extra_text);<br>    }<br>     ast_free(extra_text);<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8140">change 8140</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/8140"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Idef2ca54d242d1b894efd3fc7b360bc6fd5bdc34 </div>
<div style="display:none"> Gerrit-Change-Number: 8140 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>