From: Richard Mudgett Date: Wed, 31 Jan 2018 23:48:46 +0000 (-0600) Subject: app_confbridge: ConfbridgeList event has standard channel shapshot headers. X-Git-Tag: 13.20.0-rc1~37^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ff580bb2535d83f38f939e552874896dda190aa;p=thirdparty%2Fasterisk.git app_confbridge: ConfbridgeList event has standard channel shapshot headers. * Made the AMI ConfbridgeList action's ConfbridgeList events output all the standard channel snapshot headers instead of a few hand-coded channel snapshot headers. The benefit is that the CallerIDName gets disruptive characters like CR, LF, Tab, and a few others escaped. However, an empty CallerIDName is now output as "" instead of "". ASTERISK-27651 Change-Id: Iaf7d54a9d40194c2db060bc9b4979fab6720d977 --- diff --git a/CHANGES b/CHANGES index a6351be2a6..27cc326046 100644 --- a/CHANGES +++ b/CHANGES @@ -23,6 +23,12 @@ app_confbridge * Added the Muted header to the ConfbridgeJoin AMI event to indicate the participant's starting mute status. + * Made the AMI ConfbridgeList action's ConfbridgeList events output all + the standard channel snapshot headers instead of a few hand-coded channel + snapshot headers. The benefit is that the CallerIDName gets disruptive + characters like CR, LF, Tab, and a few others escaped. However, an empty + CallerIDName is now output as "" instead of "". + app_followme ------------------ * Added a new prompt, connecting-prompt, which will be played diff --git a/UPGRADE.txt b/UPGRADE.txt index 5d5cf8d0b3..630c69690f 100644 --- a/UPGRADE.txt +++ b/UPGRADE.txt @@ -23,6 +23,14 @@ From 13.19.0 to 13.20.0: +app_confbridge +------------------ + * Made the AMI ConfbridgeList action's ConfbridgeList events output all + the standard channel snapshot headers instead of a few hand-coded channel + snapshot headers. The benefit is that the CallerIDName gets disruptive + characters like CR, LF, Tab, and a few others escaped. However, an empty + CallerIDName is now output as "" instead of "". + res_pjsip ------------------ * Users who are matching endpoints by SIP header need to reevaluate their diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index 1f6ad171bb..df932151e7 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -69,6 +69,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/test.h" #include "asterisk/stasis.h" #include "asterisk/stasis_bridges.h" +#include "asterisk/stasis_channels.h" #include "asterisk/json.h" #include "asterisk/format_cache.h" #include "asterisk/taskprocessor.h" @@ -228,6 +229,62 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ConfbridgeListComplete. + + + Raised as part of the ConfbridgeList action response list. + + + The name of the Confbridge conference. + + + Identifies this user as an admin user. + + + + + + + Identifies this user as a marked user. + + + + + + + Must this user wait for a marked user to join? + + + + + + + Does this user get kicked after the last marked user leaves? + + + + + + + Is this user waiting for a marked user to join? + + + + + + + The current mute status. + + + + + + + The number of seconds the channel has been up. + + + + + List active conferences. @@ -3443,15 +3500,26 @@ static struct ast_custom_function confbridge_info_function = { .read = func_confbridge_info, }; -static void action_confbridgelist_item(struct mansession *s, const char *id_text, struct confbridge_conference *conference, struct confbridge_user *user, int waiting) +static int action_confbridgelist_item(struct mansession *s, const char *id_text, struct confbridge_conference *conference, struct confbridge_user *user, int waiting) { + struct ast_channel_snapshot *snapshot; + struct ast_str *snap_str; + + snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(user->chan)); + if (!snapshot) { + return 0; + } + + snap_str = ast_manager_build_channel_state_string(snapshot); + if (!snap_str) { + ao2_ref(snapshot, -1); + return 0; + } + astman_append(s, "Event: ConfbridgeList\r\n" "%s" "Conference: %s\r\n" - "CallerIDNum: %s\r\n" - "CallerIDName: %s\r\n" - "Channel: %s\r\n" "Admin: %s\r\n" "MarkedUser: %s\r\n" "WaitMarked: %s\r\n" @@ -3459,19 +3527,23 @@ static void action_confbridgelist_item(struct mansession *s, const char *id_text "Waiting: %s\r\n" "Muted: %s\r\n" "AnsweredTime: %d\r\n" + "%s" "\r\n", id_text, conference->name, - S_COR(ast_channel_caller(user->chan)->id.number.valid, ast_channel_caller(user->chan)->id.number.str, ""), - S_COR(ast_channel_caller(user->chan)->id.name.valid, ast_channel_caller(user->chan)->id.name.str, ""), - ast_channel_name(user->chan), - ast_test_flag(&user->u_profile, USER_OPT_ADMIN) ? "Yes" : "No", - ast_test_flag(&user->u_profile, USER_OPT_MARKEDUSER) ? "Yes" : "No", - ast_test_flag(&user->u_profile, USER_OPT_WAITMARKED) ? "Yes" : "No", - ast_test_flag(&user->u_profile, USER_OPT_ENDMARKED) ? "Yes" : "No", - waiting ? "Yes" : "No", - user->muted ? "Yes" : "No", - ast_channel_get_up_time(user->chan)); + AST_YESNO(ast_test_flag(&user->u_profile, USER_OPT_ADMIN)), + AST_YESNO(ast_test_flag(&user->u_profile, USER_OPT_MARKEDUSER)), + AST_YESNO(ast_test_flag(&user->u_profile, USER_OPT_WAITMARKED)), + AST_YESNO(ast_test_flag(&user->u_profile, USER_OPT_ENDMARKED)), + AST_YESNO(waiting), + AST_YESNO(user->muted), + ast_channel_get_up_time(user->chan), + ast_str_buffer(snap_str)); + + ast_free(snap_str); + ao2_ref(snapshot, -1); + + return 1; } static int action_confbridgelist(struct mansession *s, const struct message *m) @@ -3505,12 +3577,10 @@ static int action_confbridgelist(struct mansession *s, const struct message *m) ao2_lock(conference); AST_LIST_TRAVERSE(&conference->active_list, user, list) { - total++; - action_confbridgelist_item(s, id_text, conference, user, 0); + total += action_confbridgelist_item(s, id_text, conference, user, 0); } AST_LIST_TRAVERSE(&conference->waiting_list, user, list) { - total++; - action_confbridgelist_item(s, id_text, conference, user, 1); + total += action_confbridgelist_item(s, id_text, conference, user, 1); } ao2_unlock(conference); ao2_ref(conference, -1);