aboutsummaryrefslogtreecommitdiffstats
path: root/cli.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-12-26 11:08:34 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-12-26 11:08:34 +0000
commit9badca3f7251b93d97dd2dec08c80315484bf5e5 (patch)
tree38659793b4ad18983ea3cdb44dc66656106dccf1 /cli.c
parent1841112edc8b28c8121c24aab0be4c7bb2807497 (diff)
Fix CLI to report "N/A" when appropriate for time, chan_features updates, ALSA and OSS codec fixes (bug #3145)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4556 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cli.c')
-rwxr-xr-xcli.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/cli.c b/cli.c
index 8a99c6e4b..5571c6449 100755
--- a/cli.c
+++ b/cli.c
@@ -633,6 +633,7 @@ static int handle_showchan(int fd, int argc, char *argv[])
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 @@ static int handle_showchan(int fd, int argc, char *argv[])
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 @@ static int handle_showchan(int fd, int argc, char *argv[])
" 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 @@ static int handle_showchan(int fd, int argc, char *argv[])
(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)"));