Index: pbx.c =================================================================== RCS file: /usr/cvsroot/asterisk/pbx.c,v retrieving revision 1.162 diff -u -r1.162 pbx.c --- pbx.c 17 Oct 2004 22:13:05 -0000 1.162 +++ pbx.c 19 Oct 2004 11:06:25 -0000 @@ -172,6 +172,7 @@ static int pbx_builtin_saycharacters(struct ast_channel *, void *); static int pbx_builtin_sayphonetic(struct ast_channel *, void *); int pbx_builtin_setvar(struct ast_channel *, void *); +int pbx_builtin_showvars(struct ast_channel *, void *); void pbx_builtin_setvar_helper(struct ast_channel *chan, char *name, char *value); char *pbx_builtin_getvar_helper(struct ast_channel *chan, char *name); @@ -378,6 +379,13 @@ " Setvar(#n=value): Sets channel specific variable n to value" }, + { "ShowVars", pbx_builtin_showvars, + "Show variables", + " ShowVars(): Show all channel specific variables.\n" + "Only displays when verbose level > 2\n" + "Always returns 0" + }, + { "StripMSD", pbx_builtin_stripmsd, "Strip leading digits", " StripMSD(count): Strips the leading 'count' digits from the channel's\n" @@ -4955,6 +4963,36 @@ AST_LIST_INSERT_HEAD(headp,newvariable,entries); } } + +int pbx_builtin_showvars(struct ast_channel *chan, void *name) +{ + struct ast_var_t *variables; + struct varshead *headp; + + if (option_verbose <= 2) + return 0; + + if (chan!=NULL) { + headp=&chan->varshead; + AST_LIST_TRAVERSE(headp,variables,entries) { + ast_verbose( "Channel: \"%s\" -> \"%s\"\n", + ast_var_name(variables), + ast_var_value(variables) + ); + } + } + + headp=&globals; + AST_LIST_TRAVERSE(headp,variables,entries) { + ast_verbose( "Global : \"%s\" -> \"%s\"\n", + ast_var_name(variables), + ast_var_value(variables) + ); + } + + return 0; +} + int pbx_builtin_setvar(struct ast_channel *chan, void *data) {