mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
(closes issue #10695)
Reported by: junky Patches: count_showconn.diff uploaded by junky (license 177) Provide a count of connected users to manager. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82232 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -625,14 +625,19 @@ static int handle_showmanconn(int fd, int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
struct mansession *s;
|
struct mansession *s;
|
||||||
char *format = " %-15.15s %-15.15s\n";
|
char *format = " %-15.15s %-15.15s\n";
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
ast_cli(fd, format, "Username", "IP Address");
|
ast_cli(fd, format, "Username", "IP Address");
|
||||||
|
|
||||||
AST_LIST_LOCK(&sessions);
|
AST_LIST_LOCK(&sessions);
|
||||||
AST_LIST_TRAVERSE(&sessions, s, list)
|
AST_LIST_TRAVERSE(&sessions, s, list) {
|
||||||
ast_cli(fd, format,s->username, ast_inet_ntoa(s->sin.sin_addr));
|
ast_cli(fd, format,s->username, ast_inet_ntoa(s->sin.sin_addr));
|
||||||
|
count++;
|
||||||
|
}
|
||||||
AST_LIST_UNLOCK(&sessions);
|
AST_LIST_UNLOCK(&sessions);
|
||||||
|
|
||||||
|
ast_cli(fd, "%d users connected.\n", count);
|
||||||
|
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user