diff options
author | Matteo Brancaleoni <mbrancaleoni@espia.it> | 2003-02-21 06:00:08 +0000 |
---|---|---|
committer | Matteo Brancaleoni <mbrancaleoni@espia.it> | 2003-02-21 06:00:08 +0000 |
commit | 877a281b742fc0d7cda64f34aa633d8b3972da47 (patch) | |
tree | e9b36127b828a436a03798b80b303052f04145fb /manager.c | |
parent | 48130719cb745182878765357eed27d0a7256c98 (diff) |
Fri Feb 21 07:00:01 CET 2003
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@620 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'manager.c')
-rwxr-xr-x | manager.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -69,14 +69,39 @@ static int handle_showmancmds(int fd, int argc, char *argv[]) return RESULT_SUCCESS; } +static int handle_showmanconn(int fd, int argc, char *argv[]) +{ + struct mansession *s; + + ast_pthread_mutex_lock(&sessionlock); + s = sessions; + ast_cli(fd, " Username\tIP Address\n"); + while(s) { + ast_cli(fd, " %s\t\t%s\r\n",s->username, inet_ntoa(s->sin.sin_addr)); + s = s->next; + } + + ast_pthread_mutex_unlock(&sessionlock); + return RESULT_SUCCESS; +} + static char showmancmds_help[] = "Usage: show manager commands\n" " Prints a listing of all the available manager commands.\n"; +static char showmanconn_help[] = +"Usage: show manager connected\n" +" Prints a listing of the users that are connected to the\n" +"manager interface.\n"; + static struct ast_cli_entry show_mancmds_cli = { { "show", "manager", "commands", NULL }, handle_showmancmds, "Show manager commands", showmancmds_help }; +static struct ast_cli_entry show_manconn_cli = + { { "show", "manager", "connected", NULL }, + handle_showmanconn, "Show connected manager users", showmanconn_help }; + static void destroy_session(struct mansession *s) { struct mansession *cur, *prev = NULL; @@ -616,6 +641,7 @@ int init_manager(void) ast_manager_register( "Command", EVENT_FLAG_COMMAND, action_command, "Execute Command" ); ast_cli_register(&show_mancmds_cli); + ast_cli_register(&show_manconn_cli); registered = 1; } portno = DEFAULT_MANAGER_PORT; |