[asterisk-commits] mmichelson: branch group/CCSS r224849 - /team/group/CCSS/main/ccss.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Oct 20 16:32:02 CDT 2009
Author: mmichelson
Date: Tue Oct 20 16:31:58 2009
New Revision: 224849
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=224849
Log:
Skeleton for CLI command stuff.
It just prints "HELLO!" right now. We'll need to
get it updated to print detailed information about
the call.
Modified:
team/group/CCSS/main/ccss.c
Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=224849&r1=224848&r2=224849
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Tue Oct 20 16:31:58 2009
@@ -33,6 +33,7 @@
#include "asterisk/event.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
+#include "asterisk/cli.h"
/*** DOCUMENTATION
<application name="CallCompletionRequest" language="en_US">
@@ -2723,6 +2724,44 @@
return;
}
+static int cc_cli_output_status(void *data)
+{
+ int cli_fd = *(int *)data;
+
+ ast_cli(cli_fd, "HELLO!\n");
+ ast_free(data);
+ return 0;
+}
+
+static char *handle_cc_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ int *cli_fd;
+
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "cc report status";
+ e->usage =
+ "Usage: cc report status\n"
+ " Report the current status of any ongoing CC transactions\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 3) {
+ return CLI_SHOWUSAGE;
+ }
+
+ cli_fd = ast_malloc(sizeof(*cli_fd));
+ *cli_fd = a->fd;
+ ast_taskprocessor_push(cc_core_taskprocessor, cc_cli_output_status, cli_fd);
+ return CLI_SUCCESS;
+}
+
+static struct ast_cli_entry cc_cli[] = {
+ AST_CLI_DEFINE(handle_cc_status, "Reports CC stats"),
+};
+
int ast_cc_init(void)
{
int res;
@@ -2766,6 +2805,7 @@
return -1;
}
ast_log(LOG_NOTICE, "Successfully created the root CC monitor\n");
+ ast_cli_register_multiple(cc_cli, ARRAY_LEN(cc_cli));
/* FOR THE LOVE OF GOD DO NOT SET root_monitor TO NULL HERE */
cc_unref(root_monitor, "Unref root monitor from allocation");
dialed_cc_interface_counter = 1;
More information about the asterisk-commits
mailing list