[Asterisk-cvs] asterisk cli.c,1.47,1.48 manager.c,1.65,1.66

markster at lists.digium.com markster at lists.digium.com
Tue Aug 3 14:02:16 CDT 2004


Update of /usr/cvsroot/asterisk
In directory localhost.localdomain:/tmp/cvs-serv6679

Modified Files:
	cli.c manager.c 
Log Message:
Merge nicolasg's manager/cli patch (bug #2207)


Index: cli.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cli.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- cli.c	14 Jul 2004 14:53:24 -0000	1.47
+++ cli.c	3 Aug 2004 17:48:18 -0000	1.48
@@ -523,11 +523,17 @@
 static int handle_showchan(int fd, int argc, char *argv[])
 {
 	struct ast_channel *c=NULL;
+	struct timeval now;
+	long elapsed_seconds=0;
 	if (argc != 3)
 		return RESULT_SHOWUSAGE;
+	gettimeofday(&now, NULL);
 	c = ast_channel_walk_locked(NULL);
 	while(c) {
 		if (!strcasecmp(c->name, argv[2])) {
+			if(c->cdr) {
+				elapsed_seconds = now.tv_sec - c->cdr->start.tv_sec;
+			}
 			ast_cli(fd, 
 	" -- General --\n"
 	"           Name: %s\n"
@@ -544,6 +550,7 @@
 	"      Frames in: %d%s\n"
 	"     Frames out: %d%s\n"
 	" Time to Hangup: %ld\n"
+	"Elapsed Seconds: %ld\n"
 	" --   PBX   --\n"
 	"        Context: %s\n"
 	"      Extension: %s\n"
@@ -559,6 +566,7 @@
 	(c->dnid ? c->dnid : "(N/A)" ), ast_state2str(c->_state), c->_state, c->rings, c->nativeformats, c->writeformat, c->readformat,
 	c->fds[0], c->fin & 0x7fffffff, (c->fin & 0x80000000) ? " (DEBUGGED)" : "",
 	c->fout & 0x7fffffff, (c->fout & 0x80000000) ? " (DEBUGGED)" : "", (long)c->whentohangup,
+	(long)elapsed_seconds, 
 	c->context, c->exten, c->priority, c->callgroup, c->pickupgroup, ( c->appl ? c->appl : "(N/A)" ),
 	( c-> data ? (!ast_strlen_zero(c->data) ? c->data : "(Empty)") : "(None)"),
 	c->stack, (c->blocking ? c->blockproc : "(Not Blocking)"));

Index: manager.c
===================================================================
RCS file: /usr/cvsroot/asterisk/manager.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- manager.c	30 Jul 2004 20:27:42 -0000	1.65
+++ manager.c	3 Aug 2004 17:48:18 -0000	1.66
@@ -649,6 +649,10 @@
 	char idText[256] = "";
 	struct ast_channel *c;
 	char bridge[256];
+	struct timeval now;
+	long elapsed_seconds=0;
+
+	gettimeofday(&now, NULL);
 	astman_send_ack(s, m, "Channel status will follow");
 	c = ast_channel_walk_locked(NULL);
         if (id && !ast_strlen_zero(id))
@@ -672,6 +676,9 @@
 		else
 			bridge[0] = '\0';
 		if (c->pbx) {
+			if (c->cdr) {
+				elapsed_seconds = now.tv_sec - c->cdr->start.tv_sec;
+			}
 			ast_cli(s->fd,
 			"Event: Status\r\n"
 			"Channel: %s\r\n"
@@ -681,6 +688,7 @@
 			"Context: %s\r\n"
 			"Extension: %s\r\n"
 			"Priority: %d\r\n"
+			"Seconds: %ld\r\n"
 			"%s"
 			"Uniqueid: %s\r\n"
 			"%s"
@@ -688,7 +696,7 @@
 			c->name, c->callerid ? c->callerid : "<unknown>", 
 			c->accountcode,
 			ast_state2str(c->_state), c->context,
-			c->exten, c->priority, bridge, c->uniqueid, idText);
+			c->exten, c->priority, (long)elapsed_seconds, bridge, c->uniqueid, idText);
 		} else {
 			ast_cli(s->fd,
 			"Event: Status\r\n"




More information about the svn-commits mailing list