* Added the following flags to the CLI "confbridge list <conference>" output:
A - The user is an admin
M - The user is a marked user
W - The user must wait for a marked user to join
E - The user will be kicked after the last marked user leaves the conference
w - The user is waiting for a marked user to join
* Added the following header to the AMI ConfbridgeList events:
WaitMarked, EndMarked, and Waiting.
(closes issue AST-1101)
Reported by: John Bigelow
Patches:
confbridge-show-admin3.txt (license #5091) patch uploaded by John Bigelow
Modified
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381644
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
-static void handle_cli_confbridge_list_item(struct ast_cli_args *a, struct conference_bridge_user *participant)
+static void handle_cli_confbridge_list_item(struct ast_cli_args *a, struct conference_bridge_user *participant, int waiting)
+ char flag_str[5 + 1];/* Max flags + terminator */
+ int pos = 0;
+
+ /* Build flags column string. */
+ if (ast_test_flag(&participant->u_profile, USER_OPT_ADMIN)) {
+ flag_str[pos++] = 'A';
+ }
+ if (ast_test_flag(&participant->u_profile, USER_OPT_MARKEDUSER)) {
+ flag_str[pos++] = 'M';
+ }
+ if (ast_test_flag(&participant->u_profile, USER_OPT_WAITMARKED)) {
+ flag_str[pos++] = 'W';
+ }
+ if (ast_test_flag(&participant->u_profile, USER_OPT_ENDMARKED)) {
+ flag_str[pos++] = 'E';
+ }
+ if (waiting) {
+ flag_str[pos++] = 'w';
+ }
+ flag_str[pos] = '\0';
+
ast_cli(a->fd, "%-29s ", ast_channel_name(participant->chan));
ast_cli(a->fd, "%-29s ", ast_channel_name(participant->chan));
+ ast_cli(a->fd, "%-5s ", flag_str);
ast_cli(a->fd, "%-17s", participant->u_profile.name);
ast_cli(a->fd, "%-17s", participant->b_profile.name);
ast_cli(a->fd, "%-17s", participant->menu_name);
ast_cli(a->fd, "%-17s", participant->u_profile.name);
ast_cli(a->fd, "%-17s", participant->b_profile.name);
ast_cli(a->fd, "%-17s", participant->menu_name);
e->command = "confbridge list";
e->usage =
"Usage: confbridge list [<name>]\n"
e->command = "confbridge list";
e->usage =
"Usage: confbridge list [<name>]\n"
- " Lists all currently active conference bridges.\n";
+ " Lists all currently active conference bridges or a specific conference bridge.\n"
+ "\n"
+ " When a conference bridge name is provided, flags may be shown for users. Below\n"
+ " are the flags and what they represent.\n"
+ "\n"
+ " Flags:\n"
+ " A - The user is an admin\n"
+ " M - The user is a marked user\n"
+ " W - The user must wait for a marked user to join\n"
+ " E - The user will be kicked after the last marked user leaves the conference\n"
+ " w - The user is waiting for a marked user to join\n";
return NULL;
case CLI_GENERATE:
if (a->pos == 2) {
return NULL;
case CLI_GENERATE:
if (a->pos == 2) {
ast_cli(a->fd, "No conference bridge named '%s' found!\n", a->argv[2]);
return CLI_SUCCESS;
}
ast_cli(a->fd, "No conference bridge named '%s' found!\n", a->argv[2]);
return CLI_SUCCESS;
}
- ast_cli(a->fd, "Channel User Profile Bridge Profile Menu CallerID\n");
- ast_cli(a->fd, "============================= ================ ================ ================ ================\n");
+ ast_cli(a->fd, "Channel Flags User Profile Bridge Profile Menu CallerID\n");
+ ast_cli(a->fd, "============================= ===== ================ ================ ================ ================\n");
ao2_lock(bridge);
AST_LIST_TRAVERSE(&bridge->active_list, participant, list) {
ao2_lock(bridge);
AST_LIST_TRAVERSE(&bridge->active_list, participant, list) {
- handle_cli_confbridge_list_item(a, participant);
+ handle_cli_confbridge_list_item(a, participant, 0);
}
AST_LIST_TRAVERSE(&bridge->waiting_list, participant, list) {
}
AST_LIST_TRAVERSE(&bridge->waiting_list, participant, list) {
- handle_cli_confbridge_list_item(a, participant);
+ handle_cli_confbridge_list_item(a, participant, 1);
}
ao2_unlock(bridge);
ao2_ref(bridge, -1);
}
ao2_unlock(bridge);
ao2_ref(bridge, -1);
.read = func_confbridge_info,
};
.read = func_confbridge_info,
};
-static void action_confbridgelist_item(struct mansession *s, const char *id_text, struct conference_bridge *bridge, struct conference_bridge_user *participant)
+static void action_confbridgelist_item(struct mansession *s, const char *id_text, struct conference_bridge *bridge, struct conference_bridge_user *participant, int waiting)
{
astman_append(s,
"Event: ConfbridgeList\r\n"
{
astman_append(s,
"Event: ConfbridgeList\r\n"
"Channel: %s\r\n"
"Admin: %s\r\n"
"MarkedUser: %s\r\n"
"Channel: %s\r\n"
"Admin: %s\r\n"
"MarkedUser: %s\r\n"
+ "WaitMarked: %s\r\n"
+ "EndMarked: %s\r\n"
+ "Waiting: %s\r\n"
"\r\n",
id_text,
bridge->name,
"\r\n",
id_text,
bridge->name,
S_COR(ast_channel_caller(participant->chan)->id.name.valid, ast_channel_caller(participant->chan)->id.name.str, "<no name>"),
ast_channel_name(participant->chan),
ast_test_flag(&participant->u_profile, USER_OPT_ADMIN) ? "Yes" : "No",
S_COR(ast_channel_caller(participant->chan)->id.name.valid, ast_channel_caller(participant->chan)->id.name.str, "<no name>"),
ast_channel_name(participant->chan),
ast_test_flag(&participant->u_profile, USER_OPT_ADMIN) ? "Yes" : "No",
- ast_test_flag(&participant->u_profile, USER_OPT_MARKEDUSER) ? "Yes" : "No");
+ ast_test_flag(&participant->u_profile, USER_OPT_MARKEDUSER) ? "Yes" : "No",
+ ast_test_flag(&participant->u_profile, USER_OPT_WAITMARKED) ? "Yes" : "No",
+ ast_test_flag(&participant->u_profile, USER_OPT_ENDMARKED) ? "Yes" : "No",
+ waiting ? "Yes" : "No");
}
static int action_confbridgelist(struct mansession *s, const struct message *m)
{
const char *actionid = astman_get_header(m, "ActionID");
const char *conference = astman_get_header(m, "Conference");
}
static int action_confbridgelist(struct mansession *s, const struct message *m)
{
const char *actionid = astman_get_header(m, "ActionID");
const char *conference = astman_get_header(m, "Conference");
- struct conference_bridge_user *participant = NULL;
- struct conference_bridge *bridge = NULL;
+ struct conference_bridge_user *participant;
+ struct conference_bridge *bridge;
struct conference_bridge tmp;
struct conference_bridge tmp;
if (!ast_strlen_zero(actionid)) {
snprintf(id_text, sizeof(id_text), "ActionID: %s\r\n", actionid);
}
if (!ast_strlen_zero(actionid)) {
snprintf(id_text, sizeof(id_text), "ActionID: %s\r\n", actionid);
}
ao2_lock(bridge);
AST_LIST_TRAVERSE(&bridge->active_list, participant, list) {
total++;
ao2_lock(bridge);
AST_LIST_TRAVERSE(&bridge->active_list, participant, list) {
total++;
- action_confbridgelist_item(s, id_text, bridge, participant);
+ action_confbridgelist_item(s, id_text, bridge, participant, 0);
}
AST_LIST_TRAVERSE(&bridge->waiting_list, participant, list) {
total++;
}
AST_LIST_TRAVERSE(&bridge->waiting_list, participant, list) {
total++;
- action_confbridgelist_item(s, id_text, bridge, participant);
+ action_confbridgelist_item(s, id_text, bridge, participant, 1);
}
ao2_unlock(bridge);
ao2_ref(bridge, -1);
}
ao2_unlock(bridge);
ao2_ref(bridge, -1);