Index: UPGRADE.txt
===================================================================
--- UPGRADE.txt	(revision 131605)
+++ UPGRADE.txt	(working copy)
@@ -63,6 +63,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.
 
Index: CHANGES
===================================================================
--- CHANGES	(revision 131605)
+++ CHANGES	(working copy)
@@ -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
 -------------------
Index: main/pbx.c
===================================================================
--- main/pbx.c	(revision 131605)
+++ main/pbx.c	(working copy)
@@ -5376,7 +5376,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)
 {
@@ -5385,9 +5384,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:
@@ -5400,18 +5399,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_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 = "dialplan show chanvar";
+		e->usage = 
+			"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 = "core set global";
+		e->command = "dialplan set global";
 		e->usage = 
-			"Usage: core set global <name> <value>\n"
+			"Usage: dialplan set global <name> <value>\n"
 			"       Set global dialplan variable <name> to <value>\n";
 		return NULL;
 	case CLI_GENERATE:
@@ -5422,11 +5463,19 @@
 		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)
 {
 	struct ast_channel *chan;
@@ -5434,9 +5483,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:
@@ -5456,15 +5505,20 @@
 	}
 
 	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)
 {
 	int oldval = 0;
@@ -5522,6 +5576,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[] = {
@@ -5530,11 +5592,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."),
