[asterisk-commits] mvanbaak: branch mvanbaak/cli-command-audit r101579 - in /team/mvanbaak/cli-c...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 31 16:05:44 CST 2008


Author: mvanbaak
Date: Thu Jan 31 16:05:44 2008
New Revision: 101579

URL: http://svn.digium.com/view/asterisk?view=rev&rev=101579
Log:
add patches from mantis to this branch

(issue #8925)
Patches:
	20071110_8925_cdr.diff uploaded by mvanbaak (license 7)
	20071110_8925_asterisk.diff uploaded by mvanbaak (license 7)
	20071110_8925_res_agi.diff uploaded by mvanbaak (license 7)

Modified:
    team/mvanbaak/cli-command-audit/main/asterisk.c
    team/mvanbaak/cli-command-audit/main/cdr.c
    team/mvanbaak/cli-command-audit/res/res_agi.c

Modified: team/mvanbaak/cli-command-audit/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/cli-command-audit/main/asterisk.c?view=diff&rev=101579&r1=101578&r2=101579
==============================================================================
--- team/mvanbaak/cli-command-audit/main/asterisk.c (original)
+++ team/mvanbaak/cli-command-audit/main/asterisk.c Thu Jan 31 16:05:44 2008
@@ -1535,28 +1535,36 @@
 {
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "stop now";
+		e->command = "core stop now";
 		e->usage = 
-			"Usage: stop now\n"
+			"Usage: core stop now\n"
 			"       Shuts down a running Asterisk immediately, hanging up all active calls .\n";
 		return NULL;
 	case CLI_GENERATE:
 		return NULL;
 	}
 
-	if (a->argc != 2)
+	if (a->argc != 3)
 		return CLI_SHOWUSAGE;
 	quit_handler(0, 0 /* Not nice */, 1 /* safely */, 0 /* not restart */);
 	return CLI_SUCCESS;
 }
 
+static char *handle_stop_now_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	char *res = handle_stop_now(e, cmd, a);
+	if (cmd == CLI_INIT)
+		e->command = "stop now";
+	return res;
+}
+
 static char *handle_stop_gracefully(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "stop gracefully";
+		e->command = "core stop gracefully";
 		e->usage = 
-			"Usage: stop gracefully\n"
+			"Usage: core stop gracefully\n"
 			"       Causes Asterisk to not accept new calls, and exit when all\n"
 			"       active calls have terminated normally.\n";
 		return NULL;
@@ -1564,39 +1572,55 @@
 		return NULL;
 	}
 
-	if (a->argc != 2)
+	if (a->argc != 3)
 		return CLI_SHOWUSAGE;
 	quit_handler(0, 1 /* nicely */, 1 /* safely */, 0 /* no restart */);
 	return CLI_SUCCESS;
 }
 
+static char *handle_stop_gracefully_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	char *res = handle_stop_gracefully(e, cmd, a);
+	if (cmd == CLI_INIT)
+		e->command = "stop gracefully";
+	return res;
+}
+
 static char *handle_stop_when_convenient(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "stop when convenient";
+		e->command = "core stop when convenient";
 		e->usage = 
-			"Usage: stop when convenient\n"
+			"Usage: core stop when convenient\n"
 			"       Causes Asterisk to perform a shutdown when all active calls have ended.\n";
 		return NULL;
 	case CLI_GENERATE:
 		return NULL;
 	}
 
-	if (a->argc != 3)
+	if (a->argc != 4)
 		return CLI_SHOWUSAGE;
 	ast_cli(a->fd, "Waiting for inactivity to perform halt\n");
 	quit_handler(0, 2 /* really nicely */, 1 /* safely */, 0 /* don't restart */);
 	return CLI_SUCCESS;
 }
 
+static char *handle_stop_when_convenient_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	char *res = handle_stop_when_convenient(e, cmd, a);
+	if (cmd == CLI_INIT)
+		e->command = "stop when convenient";
+	return res;
+}
+
 static char *handle_restart_now(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "restart now";
+		e->command = "core restart now";
 		e->usage = 
-			"Usage: restart now\n"
+			"Usage: core restart now\n"
 			"       Causes Asterisk to hangup all calls and exec() itself performing a cold\n"
 			"       restart.\n";
 		return NULL;
@@ -1604,19 +1628,27 @@
 		return NULL;
 	}
 
-	if (a->argc != 2)
+	if (a->argc != 3)
 		return CLI_SHOWUSAGE;
 	quit_handler(0, 0 /* not nicely */, 1 /* safely */, 1 /* restart */);
 	return CLI_SUCCESS;
 }
 
+static char *handle_restart_now_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	char *res = handle_restart_now(e, cmd, a);
+	if (cmd == CLI_INIT)
+		e->command = "restart now";
+	return res;
+}
+
 static char *handle_restart_gracefully(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "restart gracefully";
+		e->command = "core restart gracefully";
 		e->usage = 
-			"Usage: restart gracefully\n"
+			"Usage: core restart gracefully\n"
 			"       Causes Asterisk to stop accepting new calls and exec() itself performing a cold\n"
 			"       restart when all active calls have ended.\n";
 		return NULL;
@@ -1624,39 +1656,55 @@
 		return NULL;
 	}
 
-	if (a->argc != 2)
+	if (a->argc != 3)
 		return CLI_SHOWUSAGE;
 	quit_handler(0, 1 /* nicely */, 1 /* safely */, 1 /* restart */);
 	return CLI_SUCCESS;
 }
 
+static char *handle_restart_gracefully_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	char *res = handle_restart_gracefully(e, cmd, a);
+	if (cmd == CLI_INIT)
+		e->command = "restart gracefully";
+	return res;
+}
+
 static char *handle_restart_when_convenient(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "restart when convenient";
+		e->command = "core restart when convenient";
 		e->usage = 
-			"Usage: restart when convenient\n"
+			"Usage: core restart when convenient\n"
 			"       Causes Asterisk to perform a cold restart when all active calls have ended.\n";
 		return NULL;
 	case CLI_GENERATE:
 		return NULL;
 	}
 
-	if (a->argc != 3)
+	if (a->argc != 4)
 		return CLI_SHOWUSAGE;
 	ast_cli(a->fd, "Waiting for inactivity to perform restart\n");
 	quit_handler(0, 2 /* really nicely */, 1 /* safely */, 1 /* restart */);
 	return CLI_SUCCESS;
 }
 
+static char *handle_restart_when_convenient_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	char *res = handle_restart_when_convenient(e, cmd, a);
+	if (cmd == CLI_INIT)
+		e->command = "restart when convenient";
+	return res;
+}
+
 static char *handle_abort_shutdown(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "abort shutdown";
+		e->command = "core abort shutdown";
 		e->usage = 
-			"Usage: abort shutdown\n"
+			"Usage: core abort shutdown\n"
 			"       Causes Asterisk to abort an executing shutdown or restart, and resume normal\n"
 			"       call operations.\n";
 		return NULL;
@@ -1664,11 +1712,19 @@
 		return NULL;
 	}
 
-	if (a->argc != 2)
+	if (a->argc != 3)
 		return CLI_SHOWUSAGE;
 	ast_cancel_shutdown();
 	shuttingdown = 0;
 	return CLI_SUCCESS;
+}
+
+static char *handle_abort_shutdown_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	char *res = handle_abort_shutdown(e, cmd, a);
+	if (cmd == CLI_INIT)
+		e->command = "abort shutdown";
+	return res;
 }
 
 static char *handle_bang(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
@@ -1770,14 +1826,24 @@
 
 #define ASTERISK_PROMPT2 "%s*CLI> "
 
+/* deprecated cli entries */
+static struct ast_cli_entry cli_abort_shutdown_deprecated = AST_CLI_DEFINE(handle_abort_shutdown_deprecated, "Cancel a running shutdown.");
+static struct ast_cli_entry cli_stop_now_deprecated = AST_CLI_DEFINE(handle_stop_now_deprecated, "Shut down Asterisk immediately.");
+static struct ast_cli_entry cli_stop_gracefully_deprecated = AST_CLI_DEFINE(handle_stop_gracefully_deprecated, "Gracefully shut down Asterisk.");
+static struct ast_cli_entry cli_stop_when_convenient_deprecated = AST_CLI_DEFINE(handle_stop_when_convenient_deprecated, "Shut down Asterisk at empty call volume.");
+static struct ast_cli_entry cli_restart_now_deprecated = AST_CLI_DEFINE(handle_restart_now_deprecated, "Restart Asterisk immediately.");
+static struct ast_cli_entry cli_restart_gracefully_deprecated = AST_CLI_DEFINE(handle_restart_gracefully_deprecated, "Restart Asterisk gracefully.");
+static struct ast_cli_entry cli_restart_when_convenient_deprecated = AST_CLI_DEFINE(handle_restart_when_convenient_deprecated, "Restart Asterisk at empty call volume.");
+/* end deprecated cli entries */
+
 static struct ast_cli_entry cli_asterisk[] = {
-	AST_CLI_DEFINE(handle_abort_shutdown, "Cancel a running shutdown"),
-	AST_CLI_DEFINE(handle_stop_now, "Shut down Asterisk immediately"),
-	AST_CLI_DEFINE(handle_stop_gracefully, "Gracefully shut down Asterisk"),
-	AST_CLI_DEFINE(handle_stop_when_convenient, "Shut down Asterisk at empty call volume"),
-	AST_CLI_DEFINE(handle_restart_now, "Restart Asterisk immediately"), 
-	AST_CLI_DEFINE(handle_restart_gracefully, "Restart Asterisk gracefully"),
-	AST_CLI_DEFINE(handle_restart_when_convenient, "Restart Asterisk at empty call volume"),
+	AST_CLI_DEFINE(handle_abort_shutdown, "Cancel a running shutdown", .deprecate_cmd = &cli_abort_shutdown_deprecated),
+	AST_CLI_DEFINE(handle_stop_now, "Shut down Asterisk immediately", .deprecate_cmd = &cli_stop_now_deprecated),
+	AST_CLI_DEFINE(handle_stop_gracefully, "Gracefully shut down Asterisk", .deprecate_cmd = &cli_stop_gracefully_deprecated),
+	AST_CLI_DEFINE(handle_stop_when_convenient, "Shut down Asterisk at empty call volume", .deprecate_cmd = &cli_stop_when_convenient_deprecated),
+	AST_CLI_DEFINE(handle_restart_now, "Restart Asterisk immediately", .deprecate_cmd = &cli_restart_now_deprecated), 
+	AST_CLI_DEFINE(handle_restart_gracefully, "Restart Asterisk gracefully", .deprecate_cmd = &cli_restart_gracefully_deprecated),
+	AST_CLI_DEFINE(handle_restart_when_convenient, "Restart Asterisk at empty call volume", .deprecate_cmd = &cli_restart_when_convenient_deprecated),
 	AST_CLI_DEFINE(show_warranty, "Show the warranty (if any) for this copy of Asterisk"),
 	AST_CLI_DEFINE(show_license, "Show the license(s) for this copy of Asterisk"),
 	AST_CLI_DEFINE(handle_version, "Display version info"),

Modified: team/mvanbaak/cli-command-audit/main/cdr.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/cli-command-audit/main/cdr.c?view=diff&rev=101579&r1=101578&r2=101579
==============================================================================
--- team/mvanbaak/cli-command-audit/main/cdr.c (original)
+++ team/mvanbaak/cli-command-audit/main/cdr.c Thu Jan 31 16:05:44 2008
@@ -1236,16 +1236,16 @@
 
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "cdr status";
+		e->command = "cdr show status";
 		e->usage = 
-			"Usage: cdr status\n"
+			"Usage: cdr show status\n"
 			"	Displays the Call Detail Record engine system status.\n";
 		return NULL;
 	case CLI_GENERATE:
 		return NULL;
 	}
 
-	if (a->argc > 2)
+	if (a->argc > 3)
 		return CLI_SHOWUSAGE;
 
 	ast_cli(a->fd, "CDR logging: %s\n", enabled ? "enabled" : "disabled");
@@ -1274,6 +1274,14 @@
 	return CLI_SUCCESS;
 }
 
+static char *handle_cli_status_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	char *res = handle_cli_status(e, cmd, a);
+	if (cmd == CLI_INIT)
+		e->command = "cdr status";
+	return res;
+}
+
 static char *handle_cli_submit(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	switch (cmd) {
@@ -1296,7 +1304,8 @@
 }
 
 static struct ast_cli_entry cli_submit = AST_CLI_DEFINE(handle_cli_submit, "Posts all pending batched CDR data");
-static struct ast_cli_entry cli_status = AST_CLI_DEFINE(handle_cli_status, "Display the CDR status");
+static struct ast_cli_entry cli_status_deprecated = AST_CLI_DEFINE(handle_cli_status_deprecated, "Display the CDR status");
+static struct ast_cli_entry cli_status = AST_CLI_DEFINE(handle_cli_status, "Display the CDR status", .deprecate_cmd = &cli_status_deprecated);
 
 static int do_reload(int reload)
 {

Modified: team/mvanbaak/cli-command-audit/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/cli-command-audit/res/res_agi.c?view=diff&rev=101579&r1=101578&r2=101579
==============================================================================
--- team/mvanbaak/cli-command-audit/res/res_agi.c (original)
+++ team/mvanbaak/cli-command-audit/res/res_agi.c Thu Jan 31 16:05:44 2008
@@ -1673,9 +1673,9 @@
 {
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "agi debug [off]";
+		e->command = "agi set debug [on|off]";
 		e->usage =
-			"Usage: agi debug [off]\n"
+			"Usage: agi set debug [on|off]\n"
 			"       Enables/disables dumping of AGI transactions for\n"
 			"       debugging purposes.\n";
 		return NULL;
@@ -1683,16 +1683,16 @@
 	case CLI_GENERATE:
 		return NULL;
 	}
-	if (a->argc < e->args - 1 || a->argc > e->args )
+
+	if (a->argc != e->args)
 		return CLI_SHOWUSAGE;
-	if (a->argc == e->args - 1) {
+
+	if (strncasecmp(a->argv[3], "off", 3) == 0) {
+		agidebug = 0;
+	} else if (strncasecmp(a->argv[3], "on", 2) == 0) {
 		agidebug = 1;
 	} else {
-		if (strncasecmp(a->argv[e->args - 1], "off", 3) == 0) {
-			agidebug = 0;
-		} else {
-			return CLI_SHOWUSAGE;
-		}
+		return CLI_SHOWUSAGE;
 	}
 	ast_cli(a->fd, "AGI Debugging %sabled\n", agidebug ? "En" : "Dis");
 	return CLI_SUCCESS;




More information about the asterisk-commits mailing list