[asterisk-commits] file: branch group/stasis_cache_usage r392848 - /team/group/stasis_cache_usag...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 25 09:17:44 CDT 2013


Author: file
Date: Tue Jun 25 09:17:41 2013
New Revision: 392848

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392848
Log:
Another place that can just query the cache.

Modified:
    team/group/stasis_cache_usage/main/pbx.c

Modified: team/group/stasis_cache_usage/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/group/stasis_cache_usage/main/pbx.c?view=diff&rev=392848&r1=392847&r2=392848
==============================================================================
--- team/group/stasis_cache_usage/main/pbx.c (original)
+++ team/group/stasis_cache_usage/main/pbx.c Tue Jun 25 09:17:41 2013
@@ -8028,8 +8028,9 @@
 /*! \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 */
+	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
+	struct ast_channel_snapshot *snapshot;
+	struct ast_var_t *var;
 
 	switch (cmd) {
 	case CLI_INIT:
@@ -8045,18 +8046,15 @@
 	if (a->argc != e->args + 1)
 		return CLI_SHOWUSAGE;
 
-	if (!(chan = ast_channel_get_by_name(a->argv[e->args]))) {
+	if (!(msg = stasis_cache_get(ast_channel_topic_all_cached_by_name(), ast_channel_snapshot_type(), a->argv[3]))) {
 		ast_cli(a->fd, "Channel '%s' not found\n", a->argv[e->args]);
 		return CLI_FAILURE;
 	}
-
-	pbx_builtin_serialize_variables(chan, &vars);
-
-	if (ast_str_strlen(vars)) {
-		ast_cli(a->fd, "\nVariables for channel %s:\n%s\n", a->argv[e->args], ast_str_buffer(vars));
-	}
-
-	chan = ast_channel_unref(chan);
+	snapshot = stasis_message_data(msg);
+
+	AST_LIST_TRAVERSE(snapshot->channel_vars, var, entries) {
+		ast_cli(a->fd, "%s=%s\n", ast_var_name(var), ast_var_value(var));
+	}
 
 	return CLI_SUCCESS;
 }




More information about the asterisk-commits mailing list