From: Richard Mudgett Date: Wed, 31 Jan 2018 21:45:42 +0000 (-0600) Subject: app_confbridge: Add the Muted header to ConfbridgeJoin AMI event. X-Git-Tag: 15.3.0-rc1~44^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0ec3fcbaa4f3d249e18e65a551fd4f360d5e9b8;p=thirdparty%2Fasterisk.git app_confbridge: Add the Muted header to ConfbridgeJoin AMI event. ASTERISK-27651 Change-Id: Idef2ca54d242d1b894efd3fc7b360bc6fd5bdc34 --- diff --git a/CHANGES b/CHANGES index 3b2be7125b..c2956472fa 100644 --- a/CHANGES +++ b/CHANGES @@ -19,6 +19,11 @@ Core extension and include. These messages are no longer printed by the verbose loggers, they are now only logged as debug messages. +app_confbridge +------------------ + * Added the Muted header to the ConfbridgeJoin AMI event to indicate the + participant's starting mute status. + app_followme ------------------ * Added a new prompt, connecting-prompt, which will be played diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index f972e38b96..7ad73fdbe7 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -530,9 +530,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; } diff --git a/apps/confbridge/confbridge_manager.c b/apps/confbridge/confbridge_manager.c index e5db648da3..0f3c7fb17e 100644 --- a/apps/confbridge/confbridge_manager.c +++ b/apps/confbridge/confbridge_manager.c @@ -81,6 +81,13 @@ + + The joining mute status. + + + + + ConfbridgeLeave @@ -252,20 +259,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, @@ -296,7 +316,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);