[svn-commits] murf: branch murf/mtxprof r131646 - in /team/murf/mtxprof: ./ main/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 17 09:53:48 CDT 2008


Author: murf
Date: Thu Jul 17 09:53:47 2008
New Revision: 131646

URL: http://svn.digium.com/view/asterisk?view=rev&rev=131646
Log:
Merged revisions 131570,131606 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r131570 | murf | 2008-07-16 17:53:02 -0600 (Wed, 16 Jul 2008) | 20 lines

(closes issue #13089)
Reported by: murf

Most of this bug was already fixed by Tilghman before
I opened it; Many thanks to Tilghman for his fix
in svn version 125794. That fix cleared up some of the
fields in the lock_info.

This commit changes the address that is stored for the
lock in the lock_info struct, so that it is the same 
as that passed into the locking macros. This makes 
searching for a lock_info (as in log_show_lock()) 
by its lock addr possible. The lock_addr field is
infinitely more useful if it is the same as what
is 'publicly' available outside the lock_info code.

Many thanks to kpfleming, putnopvut, and Russell for their
invaluable insights earlier today.


........
r131606 | tilghman | 2008-07-17 08:00:27 -0600 (Thu, 17 Jul 2008) | 7 lines

Change several 'core' commands to be 'dialplan' commands (with appropriate
deprecation, of course)
(closes issue #13016)
 Reported by: caio1982
 Patches: 
       dialplan_globals6.diff uploaded by caio1982 (license 22)

........

Modified:
    team/murf/mtxprof/   (props changed)
    team/murf/mtxprof/CHANGES
    team/murf/mtxprof/UPGRADE.txt
    team/murf/mtxprof/main/pbx.c

Propchange: team/murf/mtxprof/
------------------------------------------------------------------------------
    automerge = yep

Propchange: team/murf/mtxprof/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jul 17 09:53:47 2008
@@ -1,1 +1,1 @@
-/trunk:1-131563
+/trunk:1-131642

Modified: team/murf/mtxprof/CHANGES
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/CHANGES?view=diff&rev=131646&r1=131645&r2=131646
==============================================================================
--- team/murf/mtxprof/CHANGES (original)
+++ team/murf/mtxprof/CHANGES Thu Jul 17 09:53:47 2008
@@ -146,6 +146,11 @@
      A new API call was added so trunk will now have to be compiled against
      a versions of libpri and libss7 that have them or it will not know that
      these libraries exist.
+  * The commands "core show globals", "core set global" and "core set chanvar" has
+     been deprecated in favor of the more semanticly correct "dialplan show globals",
+     "dialplan set chanvar" and "dialplan set global".
+  * New CLI command "dialplan show chanvar" to list all variables associated
+    with a given channel.
 
 DNS manager changes
 -------------------

Modified: team/murf/mtxprof/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/UPGRADE.txt?view=diff&rev=131646&r1=131645&r2=131646
==============================================================================
--- team/murf/mtxprof/UPGRADE.txt (original)
+++ team/murf/mtxprof/UPGRADE.txt Thu Jul 17 09:53:47 2008
@@ -62,6 +62,11 @@
 
 * The concise versions of various CLI commands are now deprecated. We recommend
   using the manager interface (AMI) for application integration with Asterisk.
+
+* The following core commands dealing with dialplan has been deprecated: 'core
+  show globals', 'core set global' and 'core set chanvar'. Use the equivalent
+  'dialplan show globals', 'dialplan set global' and 'dialplan set chanvar'
+  instead.
 
 * The silencethreshold used for various applications is now settable via a
   centralized config option in dsp.conf.

Modified: team/murf/mtxprof/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/main/pbx.c?view=diff&rev=131646&r1=131645&r2=131646
==============================================================================
--- team/murf/mtxprof/main/pbx.c (original)
+++ team/murf/mtxprof/main/pbx.c Thu Jul 17 09:53:47 2008
@@ -5399,7 +5399,6 @@
 " Context: <context>		Context (Optional)\n"
 "\n";
 
-
 /*! \brief CLI support for listing global variables in a parseable way */
 static char *handle_show_globals(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
@@ -5408,9 +5407,9 @@
 
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "core show globals";
+		e->command = "dialplan show globals";
 		e->usage = 
-			"Usage: core show globals\n"
+			"Usage: dialplan show globals\n"
 			"       List current global dialplan variables and their values\n";
 		return NULL;
 	case CLI_GENERATE:
@@ -5423,18 +5422,60 @@
 		ast_cli(a->fd, "   %s=%s\n", ast_var_name(newvariable), ast_var_value(newvariable));
 	}
 	ast_rwlock_unlock(&globalslock);
-	ast_cli(a->fd, "\n    -- %d variables\n", i);
+	ast_cli(a->fd, "\n    -- %d variable(s)\n", i);
 
 	return CLI_SUCCESS;
 }
 
-static char *handle_set_global(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
+static char *handle_show_globals_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+
+	char *res = handle_show_globals(e, cmd, a);
+	if (cmd == CLI_INIT)
+		e->command = "core show globals";
+	return res;
+}
+
+/*! \brief CLI support for listing chanvar's variables in a parseable way */
+static char *handle_show_chanvar(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	struct ast_channel *chan = NULL;
+	struct ast_str *vars = ast_str_alloca(BUFSIZ * 4); /* XXX large because we might have lots of channel vars */
+
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "core set global";
+		e->command = "dialplan show chanvar";
 		e->usage = 
-			"Usage: core set global <name> <value>\n"
+			"Usage: dialplan show chanvar <channel>\n"
+			"       List current channel variables and their values\n";
+		return NULL;
+	case CLI_GENERATE:
+		return ast_complete_channels(a->line, a->word, a->pos, a->n, 3);
+	}
+
+	if (a->argc != e->args + 1)
+		return CLI_SHOWUSAGE;
+
+	if (!(chan = ast_get_channel_by_name_locked(a->argv[e->args]))) {
+		ast_cli(a->fd, "Channel '%s' not found\n", a->argv[e->args]);
+		return CLI_FAILURE;
+	}
+
+	pbx_builtin_serialize_variables(chan, &vars);
+	if (vars->str) {
+		ast_cli(a->fd, "\nVariables for channel %s:\n%s\n", a->argv[e->args], vars->str);
+	}
+	ast_channel_unlock(chan);
+	return CLI_SUCCESS;
+}
+
+static char *handle_set_global(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "dialplan set global";
+		e->usage = 
+			"Usage: dialplan set global <name> <value>\n"
 			"       Set global dialplan variable <name> to <value>\n";
 		return NULL;
 	case CLI_GENERATE:
@@ -5445,9 +5486,17 @@
 		return CLI_SHOWUSAGE;
 
 	pbx_builtin_setvar_helper(NULL, a->argv[3], a->argv[4]);
-	ast_cli(a->fd, "\n    -- Global variable %s set to %s\n", a->argv[3], a->argv[4]);
+	ast_cli(a->fd, "\n    -- Global variable '%s' set to '%s'\n", a->argv[3], a->argv[4]);
 
 	return CLI_SUCCESS;
+}
+
+static char *handle_set_global_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	char *res = handle_set_global(e, cmd, a);
+	if (cmd == CLI_INIT)
+		e->command = "core set global";
+	return res;
 }
 
 static char *handle_set_chanvar(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
@@ -5457,9 +5506,9 @@
 
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "core set chanvar";
+		e->command = "dialplan set chanvar";
 		e->usage = 
-			"Usage: core set chanvar <channel> <varname> <value>\n"
+			"Usage: dialplan set chanvar <channel> <varname> <value>\n"
 			"       Set channel variable <varname> to <value>\n";
 		return NULL;
 	case CLI_GENERATE:
@@ -5479,13 +5528,18 @@
 	}
 
 	pbx_builtin_setvar_helper(chan, var_name, var_value);
-
 	ast_channel_unlock(chan);
-
-	ast_cli(a->fd, "\n    -- Channel variable '%s' set to '%s' for '%s'\n", 
-		var_name, var_value, chan_name);
+	ast_cli(a->fd, "\n    -- Channel variable '%s' set to '%s' for '%s'\n",  var_name, var_value, chan_name);
 
 	return CLI_SUCCESS;
+}
+
+static char *handle_set_chanvar_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	char *res = handle_set_chanvar(e, cmd, a);
+	if (cmd == CLI_INIT)
+		e->command = "core set chanvar";
+	return res;
 }
 
 static char *handle_set_extenpatternmatchnew(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
@@ -5545,6 +5599,14 @@
 }
 
 /*
+ * Deprecated CLI commands
+ */
+
+static struct ast_cli_entry cli_show_globals_deprecated = AST_CLI_DEFINE(handle_show_globals_deprecated, "Show global dialplan variables.");
+static struct ast_cli_entry cli_set_chanvar_deprecated = AST_CLI_DEFINE(handle_set_chanvar_deprecated, "Set a channel variable.");
+static struct ast_cli_entry cli_set_global_deprecated = AST_CLI_DEFINE(handle_set_global_deprecated, "Set global dialplan variable.");
+
+/*
  * CLI entries for upper commands ...
  */
 static struct ast_cli_entry pbx_cli[] = {
@@ -5553,11 +5615,12 @@
 	AST_CLI_DEFINE(handle_show_switches, "Show alternative switches"),
 	AST_CLI_DEFINE(handle_show_hints, "Show dialplan hints"),
 	AST_CLI_DEFINE(handle_show_hint, "Show dialplan hint"),
-	AST_CLI_DEFINE(handle_show_globals, "Show global dialplan variables"),
+	AST_CLI_DEFINE(handle_show_globals, "Show global dialplan variables", .deprecate_cmd = &cli_show_globals_deprecated),
+	AST_CLI_DEFINE(handle_show_chanvar, "Show channel variables"),
 	AST_CLI_DEFINE(handle_show_function, "Describe a specific dialplan function"),
 	AST_CLI_DEFINE(handle_show_application, "Describe a specific dialplan application"),
-	AST_CLI_DEFINE(handle_set_global, "Set global dialplan variable"),
-	AST_CLI_DEFINE(handle_set_chanvar, "Set a channel variable"),
+	AST_CLI_DEFINE(handle_set_global, "Set global dialplan variable", .deprecate_cmd = &cli_set_global_deprecated),
+	AST_CLI_DEFINE(handle_set_chanvar, "Set a channel variable", .deprecate_cmd = &cli_set_chanvar_deprecated),
 	AST_CLI_DEFINE(handle_show_dialplan, "Show dialplan"),
 	AST_CLI_DEFINE(handle_unset_extenpatternmatchnew, "Use the Old extension pattern matching algorithm."),
 	AST_CLI_DEFINE(handle_set_extenpatternmatchnew, "Use the New extension pattern matching algorithm."),




More information about the svn-commits mailing list