Pretty up the 'cdr show status' output.
authorSean Bright <sean@malleable.com>
Fri, 27 Jun 2008 23:29:56 +0000 (23:29 +0000)
committerSean Bright <sean@malleable.com>
Fri, 27 Jun 2008 23:29:56 +0000 (23:29 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@126115 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/cdr.c

index 9df8257..259328f 100644 (file)
@@ -1269,27 +1269,39 @@ static char *handle_cli_status(struct ast_cli_entry *e, int cmd, struct ast_cli_
        if (a->argc > 3)
                return CLI_SHOWUSAGE;
 
-       ast_cli(a->fd, "CDR logging: %s\n", enabled ? "enabled" : "disabled");
-       ast_cli(a->fd, "CDR mode: %s\n", batchmode ? "batch" : "simple");
+       ast_cli(a->fd, "\n");
+       ast_cli(a->fd, "Call Detail Record (CDR) settings\n");
+       ast_cli(a->fd, "----------------------------------\n");
+       ast_cli(a->fd, "  Logging:                    %s\n", enabled ? "Enabled" : "Disabled");
+       ast_cli(a->fd, "  Mode:                       %s\n", batchmode ? "Batch" : "Simple");
        if (enabled) {
-               ast_cli(a->fd, "CDR output unanswered calls: %s\n", unanswered ? "yes" : "no");
+               ast_cli(a->fd, "  Log unanswered calls:       %s\n\n", unanswered ? "Yes" : "No");
                if (batchmode) {
+                       ast_cli(a->fd, "* Batch Mode Settings\n");
+                       ast_cli(a->fd, "  -------------------\n");
                        if (batch)
                                cnt = batch->size;
                        if (cdr_sched > -1)
                                nextbatchtime = ast_sched_when(sched, cdr_sched);
-                       ast_cli(a->fd, "CDR safe shut down: %s\n", batchsafeshutdown ? "enabled" : "disabled");
-                       ast_cli(a->fd, "CDR batch threading model: %s\n", batchscheduleronly ? "scheduler only" : "scheduler plus separate threads");
-                       ast_cli(a->fd, "CDR current batch size: %d record%s\n", cnt, ESS(cnt));
-                       ast_cli(a->fd, "CDR maximum batch size: %d record%s\n", batchsize, ESS(batchsize));
-                       ast_cli(a->fd, "CDR maximum batch time: %d second%s\n", batchtime, ESS(batchtime));
-                       ast_cli(a->fd, "CDR next scheduled batch processing time: %ld second%s\n", nextbatchtime, ESS(nextbatchtime));
+                       ast_cli(a->fd, "  Safe shutdown:              %s\n", batchsafeshutdown ? "Enabled" : "Disabled");
+                       ast_cli(a->fd, "  Threading model:            %s\n", batchscheduleronly ? "Scheduler only" : "Scheduler plus separate threads");
+                       ast_cli(a->fd, "  Current batch size:         %d record%s\n", cnt, ESS(cnt));
+                       ast_cli(a->fd, "  Maximum batch size:         %d record%s\n", batchsize, ESS(batchsize));
+                       ast_cli(a->fd, "  Maximum batch time:         %d second%s\n", batchtime, ESS(batchtime));
+                       ast_cli(a->fd, "  Next batch processing time: %ld second%s\n\n", nextbatchtime, ESS(nextbatchtime));
                }
+               ast_cli(a->fd, "* Registered Backends\n");
+               ast_cli(a->fd, "  -------------------\n");
                AST_RWLIST_RDLOCK(&be_list);
-               AST_RWLIST_TRAVERSE(&be_list, beitem, list) {
-                       ast_cli(a->fd, "CDR registered backend: %s\n", beitem->name);
+               if (AST_RWLIST_EMPTY(&be_list)) {
+                       ast_cli(a->fd, "    (none)\n");
+               } else {
+                       AST_RWLIST_TRAVERSE(&be_list, beitem, list) {
+                               ast_cli(a->fd, "    %s\n", beitem->name);
+                       }
                }
                AST_RWLIST_UNLOCK(&be_list);
+               ast_cli(a->fd, "\n");
        }
 
        return CLI_SUCCESS;