aboutsummaryrefslogtreecommitdiffstats
path: root/main/cdr.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-11 19:03:06 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-11 19:03:06 +0000
commit13b9c5237c9f5b8b3d72634d575665b1d1147ba3 (patch)
tree44dcb2c14abed6932db4f248b17626a01a38f59b /main/cdr.c
parenta8506328befc2a11643cea88772609610ec11c33 (diff)
Merge a ton of NEW_CLI conversions. Thanks to everyone that helped out! :)
(closes issue #10724) Reported by: eliel Patches: chan_skinny.c.patch uploaded by eliel (license 64) chan_oss.c.patch uploaded by eliel (license 64) chan_mgcp.c.patch2 uploaded by eliel (license 64) pbx_config.c.patch uploaded by seanbright (license 71) iax2-provision.c.patch uploaded by eliel (license 64) chan_gtalk.c.patch uploaded by eliel (license 64) pbx_ael.c.patch uploaded by seanbright (license 71) file.c.patch uploaded by seanbright (license 71) image.c.patch uploaded by seanbright (license 71) cli.c.patch uploaded by moy (license 222) astobj2.c.patch uploaded by moy (license 222) asterisk.c.patch uploaded by moy (license 222) res_limit.c.patch uploaded by seanbright (license 71) res_convert.c.patch uploaded by seanbright (license 71) res_crypto.c.patch uploaded by seanbright (license 71) app_osplookup.c.patch uploaded by seanbright (license 71) app_rpt.c.patch uploaded by seanbright (license 71) app_mixmonitor.c.patch uploaded by seanbright (license 71) channel.c.patch uploaded by seanbright (license 71) translate.c.patch uploaded by seanbright (license 71) udptl.c.patch uploaded by seanbright (license 71) threadstorage.c.patch uploaded by seanbright (license 71) db.c.patch uploaded by seanbright (license 71) cdr.c.patch uploaded by moy (license 222) pbd_dundi.c.patch uploaded by moy (license 222) app_osplookup-rev83558.patch uploaded by moy (license 222) res_clioriginate.c.patch uploaded by moy (license 222) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@85460 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/cdr.c')
-rw-r--r--main/cdr.c72
1 files changed, 41 insertions, 31 deletions
diff --git a/main/cdr.c b/main/cdr.c
index 12d1e37fd..3c28b1cbd 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -1225,64 +1225,74 @@ static void *do_cdr(void *data)
return NULL;
}
-static int handle_cli_status(int fd, int argc, char *argv[])
+static char *handle_cli_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct ast_cdr_beitem *beitem=NULL;
int cnt=0;
long nextbatchtime=0;
- if (argc > 2)
- return RESULT_SHOWUSAGE;
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "cdr status";
+ e->usage =
+ "Usage: cdr status\n"
+ " Displays the Call Detail Record engine system status.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
- ast_cli(fd, "CDR logging: %s\n", enabled ? "enabled" : "disabled");
- ast_cli(fd, "CDR mode: %s\n", batchmode ? "batch" : "simple");
+ if (a->argc > 2)
+ 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");
if (enabled) {
if (batchmode) {
if (batch)
cnt = batch->size;
if (cdr_sched > -1)
nextbatchtime = ast_sched_when(sched, cdr_sched);
- ast_cli(fd, "CDR safe shut down: %s\n", batchsafeshutdown ? "enabled" : "disabled");
- ast_cli(fd, "CDR batch threading model: %s\n", batchscheduleronly ? "scheduler only" : "scheduler plus separate threads");
- ast_cli(fd, "CDR current batch size: %d record%s\n", cnt, ESS(cnt));
- ast_cli(fd, "CDR maximum batch size: %d record%s\n", batchsize, ESS(batchsize));
- ast_cli(fd, "CDR maximum batch time: %d second%s\n", batchtime, ESS(batchtime));
- ast_cli(fd, "CDR next scheduled batch processing time: %ld second%s\n", nextbatchtime, ESS(nextbatchtime));
+ 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_RWLIST_RDLOCK(&be_list);
AST_RWLIST_TRAVERSE(&be_list, beitem, list) {
- ast_cli(fd, "CDR registered backend: %s\n", beitem->name);
+ ast_cli(a->fd, "CDR registered backend: %s\n", beitem->name);
}
AST_RWLIST_UNLOCK(&be_list);
}
- return 0;
+ return CLI_SUCCESS;
}
-static int handle_cli_submit(int fd, int argc, char *argv[])
+static char *handle_cli_submit(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- if (argc > 2)
- return RESULT_SHOWUSAGE;
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "cdr submit";
+ e->usage =
+ "Usage: cdr submit\n"
+ " Posts all pending batched CDR data to the configured CDR backend engine modules.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+ if (a->argc > 2)
+ return CLI_SHOWUSAGE;
submit_unscheduled_batch();
- ast_cli(fd, "Submitted CDRs to backend engines for processing. This may take a while.\n");
+ ast_cli(a->fd, "Submitted CDRs to backend engines for processing. This may take a while.\n");
- return 0;
+ return CLI_SUCCESS;
}
-static struct ast_cli_entry cli_submit = {
- { "cdr", "submit", NULL },
- handle_cli_submit, "Posts all pending batched CDR data",
- "Usage: cdr submit\n"
- " Posts all pending batched CDR data to the configured CDR backend engine modules.\n"
-};
-
-static struct ast_cli_entry cli_status = {
- { "cdr", "status", NULL },
- handle_cli_status, "Display the CDR status",
- "Usage: cdr status\n"
- " Displays the Call Detail Record engine system status.\n"
-};
+static struct ast_cli_entry cli_submit = NEW_CLI(handle_cli_submit, "Posts all pending batched CDR data");
+static struct ast_cli_entry cli_status = NEW_CLI(handle_cli_status, "Display the CDR status");
static int do_reload(int reload)
{