@ -822,6 +822,8 @@ struct ast_bridge *bridge_base_init(struct ast_bridge *self, uint32_t capabiliti
}
}
self - > creationtime = ast_tvnow ( ) ;
return self ;
}
@ -5051,8 +5053,8 @@ static char *complete_bridge_live(const char *word)
static char * handle_bridge_show_all ( struct ast_cli_entry * e , int cmd , struct ast_cli_args * a )
{
# define FORMAT_HDR "%-36s %5s %-15s % s\n"
# define FORMAT_ROW "%-36s %5u %-15s % s\n"
# define FORMAT_HDR "%-36s %5s %-15s % -15s % s\n"
# define FORMAT_ROW "%-36s %5u %-15s % -15s % s\n"
struct ao2_iterator iter ;
struct ast_bridge * bridge ;
@ -5068,18 +5070,22 @@ static char *handle_bridge_show_all(struct ast_cli_entry *e, int cmd, struct ast
return NULL ;
}
ast_cli ( a - > fd , FORMAT_HDR , " Bridge-ID " , " Chans " , " Type " , " Technology " );
ast_cli ( a - > fd , FORMAT_HDR , " Bridge-ID " , " Chans " , " Type " , " Technology " , " Duration " );
iter = ao2_iterator_init ( bridges , 0 ) ;
for ( ; ( bridge = ao2_iterator_next ( & iter ) ) ; ao2_ref ( bridge , - 1 ) ) {
struct ast_bridge_snapshot * snapshot = ast_bridge_get_snapshot ( bridge ) ;
char print_time [ 32 ] ;
ast_format_duration_hh_mm_ss ( ast_tvnow ( ) . tv_sec - snapshot - > creationtime . tv_sec , print_time , sizeof ( print_time ) ) ;
if ( snapshot ) {
ast_cli ( a - > fd , FORMAT_ROW ,
snapshot - > uniqueid ,
snapshot - > num_channels ,
S_OR ( snapshot - > subclass , " <unknown> " ) ,
S_OR ( snapshot - > technology , " <unknown> " ) ) ;
S_OR ( snapshot - > technology , " <unknown> " ) ,
print_time ) ;
ao2_ref ( snapshot , - 1 ) ;
}
}
@ -5112,6 +5118,7 @@ static int bridge_show_specific_print_channel(void *obj, void *arg, int flags)
static char * handle_bridge_show_specific ( struct ast_cli_entry * e , int cmd , struct ast_cli_args * a )
{
struct ast_bridge_snapshot * snapshot ;
char print_time [ 32 ] ;
switch ( cmd ) {
case CLI_INIT :
@ -5136,10 +5143,19 @@ static char *handle_bridge_show_specific(struct ast_cli_entry *e, int cmd, struc
ast_cli ( a - > fd , " Bridge '%s' not found \n " , a - > argv [ 2 ] ) ;
return CLI_SUCCESS ;
}
ast_format_duration_hh_mm_ss ( ast_tvnow ( ) . tv_sec - snapshot - > creationtime . tv_sec , print_time , sizeof ( print_time ) ) ;
ast_cli ( a - > fd , " Id: %s \n " , snapshot - > uniqueid ) ;
ast_cli ( a - > fd , " Type: %s \n " , S_OR ( snapshot - > subclass , " <unknown> " ) ) ;
ast_cli ( a - > fd , " Technology: %s \n " , S_OR ( snapshot - > technology , " <unknown> " ) ) ;
ast_cli ( a - > fd , " Subclass: %s \n " , snapshot - > subclass ) ;
ast_cli ( a - > fd , " Creator: %s \n " , snapshot - > creator ) ;
ast_cli ( a - > fd , " Name: %s \n " , snapshot - > name ) ;
ast_cli ( a - > fd , " Video-Source-Id: %s \n " , snapshot - > video_source_id ) ;
ast_cli ( a - > fd , " Num-Channels: %u \n " , snapshot - > num_channels ) ;
ast_cli ( a - > fd , " Num-Active: %u \n " , snapshot - > num_active ) ;
ast_cli ( a - > fd , " Duration: %s \n " , print_time ) ;
ao2_callback ( snapshot - > channels , OBJ_NODATA , bridge_show_specific_print_channel , a ) ;
ao2_ref ( snapshot , - 1 ) ;