@ -2224,9 +2224,31 @@ static char *handle_cli_confbridge_kick(struct ast_cli_entry *e, int cmd, struct
return CLI_SUCCESS ;
}
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 , " %-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 ) ;
@ -2243,7 +2265,17 @@ static char *handle_cli_confbridge_list(struct ast_cli_entry *e, int cmd, struct
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 ) {
@ -2276,14 +2308,14 @@ static char *handle_cli_confbridge_list(struct ast_cli_entry *e, int cmd, struct
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 ) {
handle_cli_confbridge_list_item ( a , participant );
handle_cli_confbridge_list_item ( a , participant , 0 );
}
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 ) ;
@ -2582,7 +2614,7 @@ 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 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 "
@ -2593,6 +2625,9 @@ static void action_confbridgelist_item(struct mansession *s, const char *id_text
" 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 ,
@ -2600,19 +2635,23 @@ static void action_confbridgelist_item(struct mansession *s, const char *id_text
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 " ) ;
struct conference_bridge_user * participant = NULL ;
struct conference_bridge * bridge = NULL ;
struct conference_bridge_user * participant ;
struct conference_bridge * bridge ;
struct conference_bridge tmp ;
char id_text [ 80 ] = " " ;
char id_text [ 80 ] ;
int total = 0 ;
id_text [ 0 ] = ' \0 ' ;
if ( ! ast_strlen_zero ( actionid ) ) {
snprintf ( id_text , sizeof ( id_text ) , " ActionID: %s \r \n " , actionid ) ;
}
@ -2636,11 +2675,11 @@ static int action_confbridgelist(struct mansession *s, const struct message *m)
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 + + ;
action_confbridgelist_item ( s , id_text , bridge , participant );
action_confbridgelist_item ( s , id_text , bridge , participant , 1 );
}
ao2_unlock ( bridge ) ;
ao2_ref ( bridge , - 1 ) ;