aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-19 13:30:01 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-19 13:30:01 +0000
commit66c8214ea3070cbd9714dc380b8ae06a3d6481a9 (patch)
tree02696c4f2d6e5a36c333fa900482e48aa4a6cd37 /main
parent1f4e716e9052770a0ffd8bb4e6c536ab4cd5583b (diff)
Extend manager show connected with additional information.
(closes issue #10757) Reported by: outtolunc Patches: manager.c.sessionstart.diff uploaded by outtolunc (license 237) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@83073 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/manager.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/main/manager.c b/main/manager.c
index 55113db81..91fd022a3 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -147,6 +147,7 @@ struct mansession {
int needdestroy; /*!< Whether an HTTP session should be destroyed */
pthread_t waiting_thread; /*!< Sleeping thread using this descriptor */
unsigned long managerid; /*!< Unique manager identifier, 0 for AMI sessions */
+ time_t sessionstart; /*!< Session start time */
time_t sessiontimeout; /*!< Session timeout if HTTP */
char username[80]; /*!< Logged in username */
char challenge[10]; /*!< Authentication challenge */
@@ -658,7 +659,9 @@ static char *handle_showmancmds(struct ast_cli_entry *e, int cmd, struct ast_cli
static char *handle_showmanconn(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct mansession *s;
- static const char *format = " %-15.15s %-15.15s\n";
+ time_t now = time(NULL);
+ static const char *format = " %-15.15s %-15.15s %-10.10s %-10.10s %-8.8s %-8.8s %-5.5s %-5.5s\n";
+ static const char *format2 = " %-15.15s %-15.15s %-10d %-10d %-8d %-8d %-5.5d %-5.5d\n";
int count = 0;
switch (cmd) {
case CLI_INIT:
@@ -671,11 +674,12 @@ static char *handle_showmanconn(struct ast_cli_entry *e, int cmd, struct ast_cli
case CLI_GENERATE:
return NULL;
}
- ast_cli(a->fd, format, "Username", "IP Address");
+
+ ast_cli(a->fd, format, "Username", "IP Address", "Start", "Elapsed", "FileDes", "HttpCnt", "Read", "Write");
AST_LIST_LOCK(&sessions);
AST_LIST_TRAVERSE(&sessions, s, list) {
- ast_cli(a->fd, format,s->username, ast_inet_ntoa(s->sin.sin_addr));
+ ast_cli(a->fd, format2, s->username, ast_inet_ntoa(s->sin.sin_addr), (int)(s->sessionstart), (int)(now - s->sessionstart), s->fd, s->inuse, s->readperm, s->writeperm);
count++;
}
AST_LIST_UNLOCK(&sessions);
@@ -1100,6 +1104,7 @@ static int authenticate(struct mansession *s, const struct message *m)
ast_copy_string(s->username, user, sizeof(s->username));
s->readperm = readperm;
s->writeperm = writeperm;
+ s->sessionstart = time(NULL);
set_eventmask(s, astman_get_header(m, "Events"));
return 0;
}