[Asterisk-cvs] asterisk cli.c,1.66,1.67

markster at lists.digium.com markster at lists.digium.com
Sun Dec 26 06:13:25 CST 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv30113

Modified Files:
	cli.c 
Log Message:
Fix CLI to report "N/A" when appropriate for time, chan_features updates, ALSA and OSS codec fixes (bug #3145)


Index: cli.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cli.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- cli.c	14 Dec 2004 23:36:29 -0000	1.66
+++ cli.c	26 Dec 2004 11:08:34 -0000	1.67
@@ -633,6 +633,7 @@
 	struct ast_channel *c=NULL;
 	struct timeval now;
 	char buf[1024];
+	char cdrtime[256];
 	long elapsed_seconds=0;
 	int hour=0, min=0, sec=0;
 	if (argc != 3)
@@ -646,7 +647,9 @@
 				hour = elapsed_seconds / 3600;
 				min = (elapsed_seconds % 3600) / 60;
 				sec = elapsed_seconds % 60;
-			}
+				snprintf(cdrtime, sizeof(cdrtime), "%dh%dm%ds", hour, min, sec);
+			} else
+				strncpy(cdrtime, "N/A", sizeof(cdrtime) -1);
 			ast_cli(fd, 
 	" -- General --\n"
 	"           Name: %s\n"
@@ -664,7 +667,7 @@
 	"      Frames in: %d%s\n"
 	"     Frames out: %d%s\n"
 	" Time to Hangup: %ld\n"
-	"   Elapsed Time: %dh%dm%ds\n"
+	"   Elapsed Time: %s\n"
 	" --   PBX   --\n"
 	"        Context: %s\n"
 	"      Extension: %s\n"
@@ -680,7 +683,7 @@
 	(c->cid.cid_dnid ? c->cid.cid_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,
-	hour, min, sec, 
+	cdrtime,
 	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)"),
 	(ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)"));




More information about the svn-commits mailing list