[asterisk-commits] tilghman: branch group/dialplan_aesthetics r68594 - in /team/group/dialplan_a...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Jun 9 09:15:49 MST 2007


Author: tilghman
Date: Sat Jun  9 11:15:49 2007
New Revision: 68594

URL: http://svn.digium.com/view/asterisk?view=rev&rev=68594
Log:
Convert core and functions to end conversion of ',' to '|'

Modified:
    team/group/dialplan_aesthetics/funcs/func_callerid.c
    team/group/dialplan_aesthetics/funcs/func_cut.c
    team/group/dialplan_aesthetics/funcs/func_env.c
    team/group/dialplan_aesthetics/funcs/func_logic.c
    team/group/dialplan_aesthetics/funcs/func_rand.c
    team/group/dialplan_aesthetics/funcs/func_realtime.c
    team/group/dialplan_aesthetics/funcs/func_strings.c
    team/group/dialplan_aesthetics/funcs/func_vmcount.c
    team/group/dialplan_aesthetics/include/asterisk/app.h
    team/group/dialplan_aesthetics/main/pbx.c
    team/group/dialplan_aesthetics/pbx/pbx_config.c

Modified: team/group/dialplan_aesthetics/funcs/func_callerid.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/funcs/func_callerid.c?view=diff&rev=68594&r1=68593&r2=68594
==============================================================================
--- team/group/dialplan_aesthetics/funcs/func_callerid.c (original)
+++ team/group/dialplan_aesthetics/funcs/func_callerid.c Sat Jun  9 11:15:49 2007
@@ -63,10 +63,10 @@
 	if (!chan)
 		return -1;
 
-	if (strchr(opt, '|')) {
+	if (strchr(opt, ',')) {
 		char name[80], num[80];
 
-		data = strsep(&opt, "|");
+		data = strsep(&opt, ",");
 		ast_callerid_split(opt, name, sizeof(name), num, sizeof(num));
 
 		if (!strncasecmp("all", data, 3)) {

Modified: team/group/dialplan_aesthetics/funcs/func_cut.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/funcs/func_cut.c?view=diff&rev=68594&r1=68593&r2=68594
==============================================================================
--- team/group/dialplan_aesthetics/funcs/func_cut.c (original)
+++ team/group/dialplan_aesthetics/funcs/func_cut.c Sat Jun  9 11:15:49 2007
@@ -78,7 +78,7 @@
 	strings = ast_strdupa(data);
 
 	for (ptrkey = strings; *ptrkey; ptrkey++) {
-		if (*ptrkey == '|')
+		if (*ptrkey == ',')
 			count++;
 	}
 
@@ -88,7 +88,7 @@
 
 	/* Parse each into a struct */
 	count2 = 0;
-	while ((ptrkey = strsep(&strings, "|"))) {
+	while ((ptrkey = strsep(&strings, ","))) {
 		ptrvalue = index(ptrkey, ':');
 		if (!ptrvalue) {
 			count--;

Modified: team/group/dialplan_aesthetics/funcs/func_env.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/funcs/func_env.c?view=diff&rev=68594&r1=68593&r2=68594
==============================================================================
--- team/group/dialplan_aesthetics/funcs/func_env.c (original)
+++ team/group/dialplan_aesthetics/funcs/func_env.c Sat Jun  9 11:15:49 2007
@@ -76,7 +76,7 @@
 
 	*buf = '\0';
 
-	action = strsep(&data, "|");
+	action = strsep(&data, ",");
 	if (stat(data, &s)) {
 		return -1;
 	} else {

Modified: team/group/dialplan_aesthetics/funcs/func_logic.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/funcs/func_logic.c?view=diff&rev=68594&r1=68593&r2=68594
==============================================================================
--- team/group/dialplan_aesthetics/funcs/func_logic.c (original)
+++ team/group/dialplan_aesthetics/funcs/func_logic.c Sat Jun  9 11:15:49 2007
@@ -140,6 +140,29 @@
 	return 0;
 }
 
+static int acf_import(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
+{
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(channel);
+		AST_APP_ARG(varname);
+	);
+	AST_STANDARD_APP_ARGS(args, data);
+	memset(buf, 0, len);
+
+	if (!ast_strlen_zero(args.varname)) {
+		struct ast_channel *chan2 = ast_get_channel_by_name_locked(args.channel);
+		if (chan2) {
+			char *s = alloca(strlen(args.varname) + 4);
+			if (s) {
+				sprintf(s, "${%s}", args.varname);
+				pbx_substitute_variables_helper(chan2, s, buf, len);
+			}
+			ast_channel_unlock(chan2);
+		}
+	}
+	return 0;
+}
+
 static struct ast_custom_function isnull_function = {
 	.name = "ISNULL",
 	.synopsis = "NULL Test: Returns 1 if NULL or 0 otherwise",
@@ -164,7 +187,7 @@
 static struct ast_custom_function if_function = {
 	.name = "IF",
 	.synopsis =
-		"Conditional: Returns the data following '?' if true else the data following ':'",
+		"Conditional: Returns the data following '?' if true, else the data following ':'",
 	.syntax = "IF(<expr>?[<true>][:<false>])",
 	.read = acf_if,
 };
@@ -172,9 +195,17 @@
 static struct ast_custom_function if_time_function = {
 	.name = "IFTIME",
 	.synopsis =
-		"Temporal Conditional: Returns the data following '?' if true else the data following ':'",
+		"Temporal Conditional: Returns the data following '?' if true, else the data following ':'",
 	.syntax = "IFTIME(<timespec>?[<true>][:<false>])",
 	.read = iftime,
+};
+
+static struct ast_custom_function import_function = {
+	.name = "IMPORT",
+	.synopsis =
+		"Retrieve the value of a variable from another channel\n",
+	.syntax = "IMPORT(channel,variable)",
+	.read = acf_import,
 };
 
 static int unload_module(void)
@@ -186,6 +217,7 @@
 	res |= ast_custom_function_unregister(&exists_function);
 	res |= ast_custom_function_unregister(&if_function);
 	res |= ast_custom_function_unregister(&if_time_function);
+	res |= ast_custom_function_unregister(&import_function);
 
 	return res;
 }
@@ -199,6 +231,7 @@
 	res |= ast_custom_function_register(&exists_function);
 	res |= ast_custom_function_register(&if_function);
 	res |= ast_custom_function_register(&if_time_function);
+	res |= ast_custom_function_register(&import_function);
 
 	return res;
 }

Modified: team/group/dialplan_aesthetics/funcs/func_rand.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/funcs/func_rand.c?view=diff&rev=68594&r1=68593&r2=68594
==============================================================================
--- team/group/dialplan_aesthetics/funcs/func_rand.c (original)
+++ team/group/dialplan_aesthetics/funcs/func_rand.c Sat Jun  9 11:15:49 2007
@@ -84,11 +84,11 @@
 static struct ast_custom_function acf_rand = {
 	.name = "RAND",
 	.synopsis = "Choose a random number in a range",
-	.syntax = "RAND([min][|max])",
+	.syntax = "RAND([min][,max])",
 	.desc =
 		"Choose a random number between min and max.  Min defaults to 0, if not\n"
 		"specified, while max defaults to RAND_MAX (2147483647 on many systems).\n"
-		"  Example:  Set(junky=${RAND(1|8)}); \n"
+		"  Example:  Set(junky=${RAND(1,8)}); \n"
 		"  Sets junky to a random number between 1 and 8, inclusive.\n",
 	.read = acf_rand_exec,
 };

Modified: team/group/dialplan_aesthetics/funcs/func_realtime.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/funcs/func_realtime.c?view=diff&rev=68594&r1=68593&r2=68594
==============================================================================
--- team/group/dialplan_aesthetics/funcs/func_realtime.c (original)
+++ team/group/dialplan_aesthetics/funcs/func_realtime.c Sat Jun  9 11:15:49 2007
@@ -61,7 +61,7 @@
 	);
 
 	if (ast_strlen_zero(data)) {
-		ast_log(LOG_WARNING, "Syntax: REALTIME(family|fieldmatch[|value[|delim1[|delim2]]]) - missing argument!\n");
+		ast_log(LOG_WARNING, "Syntax: REALTIME(family,fieldmatch[,value[,delim1[,delim2]]]) - missing argument!\n");
 		return -1;
 	}
 
@@ -70,7 +70,7 @@
 	AST_STANDARD_APP_ARGS(args, data);
 
 	if (!args.delim1)
-		args.delim1 = "|";
+		args.delim1 = ",";
 	if (!args.delim2)
 		args.delim2 = "=";
 
@@ -109,7 +109,7 @@
 	);
 
 	if (ast_strlen_zero(data)) {
-		ast_log(LOG_WARNING, "Syntax: REALTIME(family|fieldmatch|value|newcol) - missing argument!\n");
+		ast_log(LOG_WARNING, "Syntax: REALTIME(family,fieldmatch,value,newcol) - missing argument!\n");
 		return -1;
 	}
 
@@ -131,14 +131,14 @@
 struct ast_custom_function realtime_function = {
 	.name = "REALTIME",
 	.synopsis = "RealTime Read/Write Functions",
-	.syntax = "REALTIME(family|fieldmatch[|value[|delim1[|delim2]]]) on read\n"
-		  "REALTIME(family|fieldmatch|value|field) on write\n",
+	.syntax = "REALTIME(family,fieldmatch[,value[,delim1[,delim2]]]) on read\n"
+		  "REALTIME(family,fieldmatch,value,field) on write",
 	.desc = "This function will read or write values from/to a RealTime repository.\n"
 		"REALTIME(....) will read names/values from the repository, and \n"
 		"REALTIME(....)= will write a new value/field to the repository. On a\n"
 		"read, this function returns a delimited text string. The name/value \n"
 		"pairs are delimited by delim1, and the name and value are delimited \n"
-		"between each other with delim2. The default for delim1 is '|' and   \n"
+		"between each other with delim2. The default for delim1 is ',' and   \n"
 		"the default for delim2 is '='. If there is no match, NULL will be   \n"
 		"returned by the function. On a write, this function will always     \n"
 		"return NULL. \n",

Modified: team/group/dialplan_aesthetics/funcs/func_strings.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/funcs/func_strings.c?view=diff&rev=68594&r1=68593&r2=68594
==============================================================================
--- team/group/dialplan_aesthetics/funcs/func_strings.c (original)
+++ team/group/dialplan_aesthetics/funcs/func_strings.c Sat Jun  9 11:15:49 2007
@@ -88,7 +88,7 @@
 static struct ast_custom_function fieldqty_function = {
 	.name = "FIELDQTY",
 	.synopsis = "Count the fields, with an arbitrary delimiter",
-	.syntax = "FIELDQTY(<varname>|<delim>)",
+	.syntax = "FIELDQTY(<varname>,<delim>)",
 	.read = function_fieldqty,
 };
 
@@ -104,7 +104,7 @@
 	AST_STANDARD_APP_ARGS(args, parse);
 
 	if (!args.string) {
-		ast_log(LOG_ERROR, "Usage: FILTER(<allowed-chars>|<string>)\n");
+		ast_log(LOG_ERROR, "Usage: FILTER(<allowed-chars>,<string>)\n");
 		return -1;
 	}
 
@@ -120,7 +120,7 @@
 static struct ast_custom_function filter_function = {
 	.name = "FILTER",
 	.synopsis = "Filter the string to include only the allowed characters",
-	.syntax = "FILTER(<allowed-chars>|<string>)",
+	.syntax = "FILTER(<allowed-chars>,<string>)",
 	.read = filter,
 };
 
@@ -239,15 +239,9 @@
 	 */
 	if (option_debug)
 		ast_log(LOG_DEBUG, "array (%s=%s)\n", var, value2);
-	if (strchr(var, ','))
-		AST_NONSTANDARD_APP_ARGS(arg1, var, ',');
-	else
-		AST_STANDARD_APP_ARGS(arg1, var);
-
-	if (strchr(value2, ','))
-		AST_NONSTANDARD_APP_ARGS(arg2, value2, ',');
-	else
-		AST_STANDARD_APP_ARGS(arg2, value2);
+	AST_STANDARD_APP_ARGS(arg1, var);
+
+	AST_STANDARD_APP_ARGS(arg2, value2);
 
 	for (i = 0; i < arg1.argc; i++) {
 		if (option_debug)
@@ -305,7 +299,7 @@
 		AST_APP_ARG(hashkey);
 	);
 
-	if (!strchr(var, '|')) {
+	if (!strchr(var, ',')) {
 		/* Single argument version */
 		return array(chan, "HASH", var, value);
 	}
@@ -366,7 +360,7 @@
 static struct ast_custom_function hash_function = {
 	.name = "HASH",
 	.synopsis = "Implementation of a dialplan associative array",
-	.syntax = "HASH(hashname[|hashkey])",
+	.syntax = "HASH(hashname[,hashkey])",
 	.write = hash_write,
 	.read = hash_read,
 	.desc =
@@ -390,15 +384,13 @@
 static struct ast_custom_function array_function = {
 	.name = "ARRAY",
 	.synopsis = "Allows setting multiple variables at once",
-	.syntax = "ARRAY(var1[|var2[...][|varN]])",
+	.syntax = "ARRAY(var1[,var2[...][,varN]])",
 	.write = array,
 	.desc =
 		"The comma-separated list passed as a value to which the function is set will\n"
 		"be interpreted as a set of values to which the comma-separated list of\n"
 		"variable names in the argument should be set.\n"
-		"Hence, Set(ARRAY(var1|var2)=1\\,2) will set var1 to 1 and var2 to 2\n"
-		"Note: remember to either backslash your commas in extensions.conf or quote the\n"
-		"entire argument, since Set can take multiple arguments itself.\n",
+		"Hence, Set(ARRAY(var1,var2)=1,2) will set var1 to 1 and var2 to 2.\n",
 };
 
 static int acf_sprintf(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
@@ -536,7 +528,7 @@
 static struct ast_custom_function sprintf_function = {
 	.name = "SPRINTF",
 	.synopsis = "Format a variable according to a format string",
-	.syntax = "SPRINTF(<format>|<arg1>[|...<argN>])",
+	.syntax = "SPRINTF(<format>,<arg1>[,...<argN>])",
 	.read = acf_sprintf,
 	.desc =
 "Parses the format string specified and returns a string matching that format.\n"
@@ -626,7 +618,7 @@
 static struct ast_custom_function strftime_function = {
 	.name = "STRFTIME",
 	.synopsis = "Returns the current date/time in a specified format.",
-	.syntax = "STRFTIME([<epoch>][|[timezone][|format]])",
+	.syntax = "STRFTIME([<epoch>][,[timezone][,format]])",
 	.read = acf_strftime,
 };
 
@@ -654,7 +646,7 @@
 
 	if (ast_strlen_zero(args.format)) {
 		ast_log(LOG_ERROR,
-				"No format supplied to STRPTIME(<timestring>|<timezone>|<format>)");
+				"No format supplied to STRPTIME(<timestring>,<timezone>,<format>)");
 		return -1;
 	}
 
@@ -671,14 +663,14 @@
 	.name = "STRPTIME",
 	.synopsis =
 		"Returns the epoch of the arbitrary date/time string structured as described in the format.",
-	.syntax = "STRPTIME(<datetime>|<timezone>|<format>)",
+	.syntax = "STRPTIME(<datetime>,<timezone>,<format>)",
 	.desc =
 		"This is useful for converting a date into an EPOCH time, possibly to pass to\n"
 		"an application like SayUnixTime or to calculate the difference between two\n"
 		"date strings.\n"
 		"\n"
 		"Example:\n"
-		"  ${STRPTIME(2006-03-01 07:30:35|America/Chicago|%Y-%m-%d %H:%M:%S)} returns 1141219835\n",
+		"  ${STRPTIME(2006-03-01 07:30:35,America/Chicago,%Y-%m-%d %H:%M:%S)} returns 1141219835\n",
 	.read = acf_strptime,
 };
 

Modified: team/group/dialplan_aesthetics/funcs/func_vmcount.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/funcs/func_vmcount.c?view=diff&rev=68594&r1=68593&r2=68594
==============================================================================
--- team/group/dialplan_aesthetics/funcs/func_vmcount.c (original)
+++ team/group/dialplan_aesthetics/funcs/func_vmcount.c Sat Jun  9 11:15:49 2007
@@ -81,7 +81,7 @@
 struct ast_custom_function acf_vmcount = {
 	.name = "VMCOUNT",
 	.synopsis = "Counts the voicemail in a specified mailbox",
-	.syntax = "VMCOUNT(vmbox[@context][|folder])",
+	.syntax = "VMCOUNT(vmbox[@context][,folder])",
 	.desc =
 	"  context - defaults to \"default\"\n"
 	"  folder  - defaults to \"INBOX\"\n",

Modified: team/group/dialplan_aesthetics/include/asterisk/app.h
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/include/asterisk/app.h?view=diff&rev=68594&r1=68593&r2=68594
==============================================================================
--- team/group/dialplan_aesthetics/include/asterisk/app.h (original)
+++ team/group/dialplan_aesthetics/include/asterisk/app.h Sat Jun  9 11:15:49 2007
@@ -283,7 +283,7 @@
   the argc argument counter field.
  */
 #define AST_STANDARD_APP_ARGS(args, parse) \
-	args.argc = ast_app_separate_args(parse, '|', args.argv, (sizeof(args) - sizeof(args.argc)) / sizeof(args.argv[0]))
+	args.argc = ast_app_separate_args(parse, ',', args.argv, (sizeof(args) - sizeof(args.argc)) / sizeof(args.argv[0]))
 	
 /*!
   \brief Performs the 'nonstandard' argument separation process for an application.

Modified: team/group/dialplan_aesthetics/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/main/pbx.c?view=diff&rev=68594&r1=68593&r2=68594
==============================================================================
--- team/group/dialplan_aesthetics/main/pbx.c (original)
+++ team/group/dialplan_aesthetics/main/pbx.c Sat Jun  9 11:15:49 2007
@@ -301,7 +301,7 @@
 
 	{ "BackGround", pbx_builtin_background,
 	"Play an audio file while waiting for digits of an extension to go to.",
-	"  Background(filename1[&filename2...][|options[|langoverride][|context]]):\n"
+	"  Background(filename1[&filename2...][,options[,langoverride][,context]]):\n"
 	"This application will play the given list of files while waiting for an\n"
 	"extension to be dialed by the calling channel. To continue waiting for digits\n"
 	"after this application has finished playing files, the WaitExten application\n"
@@ -342,14 +342,14 @@
 
 	{ "ExecIfTime", pbx_builtin_execiftime,
 	"Conditional application execution based on the current time",
-	"  ExecIfTime(<times>|<weekdays>|<mdays>|<months>?appname[|appargs]):\n"
+	"  ExecIfTime(<times>,<weekdays>,<mdays>,<months>?appname[(appargs)]):\n"
 	"This application will execute the specified dialplan application, with optional\n"
 	"arguments, if the current time matches the given time specification.\n"
 	},
 
 	{ "Goto", pbx_builtin_goto,
 	"Jump to a particular priority, extension, or context",
-	"  Goto([[context|]extension|]priority): This application will set the current\n"
+	"  Goto([[context,]extension,]priority): This application will set the current\n"
 	"context, extension, and priority in the channel structure. After it completes, the\n"
 	"pbx engine will continue dialplan execution at the specified location.\n"
 	"If no specific extension, or extension and context, are specified, then this\n"
@@ -389,7 +389,7 @@
 
 	{ "GotoIfTime", pbx_builtin_gotoiftime,
 	"Conditional Goto based on the current time",
-	"  GotoIfTime(<times>|<weekdays>|<mdays>|<months>?[[context|]exten|]priority):\n"
+	"  GotoIfTime(<times>,<weekdays>,<mdays>,<months>?[[context,]exten,]priority):\n"
 	"This application will set the context, extension, and priority in the channel structure\n"
 	"if the current time matches the given time specification. Otherwise, nothing is done.\n"
         "Further information on the time specification can be found in examples\n"
@@ -399,7 +399,7 @@
 
 	{ "ImportVar", pbx_builtin_importvar,
 	"Import a variable from a channel into a new variable",
-	"  ImportVar(newvar=channelname|variable): This application imports a variable\n"
+	"  ImportVar(newvar=channelname,variable): This application imports a variable\n"
 	"from the specified channel (as opposed to the current one) and stores it as\n"
 	"a variable in the current channel (the channel that is calling this\n"
 	"application). Variables created by this application have the same inheritance\n"
@@ -474,16 +474,13 @@
 
 	{ "Set", pbx_builtin_setvar,
 	"Set channel variable(s) or function value(s)",
-	"  Set(name1=value1|name2=value2|..[|options])\n"
+	"  Set(name1=value1)\n"
 	"This function can be used to set the value of channel variables or dialplan\n"
 	"functions. It will accept up to 24 name/value pairs. When setting variables,\n"
 	"if the variable name is prefixed with _, the variable will be inherited into\n"
 	"channels created from the current channel. If the variable name is prefixed\n"
 	"with __, the variable will be inherited into channels created from the current\n"
 	"channel and all children channels.\n"
-	"  Options:\n"
-	"    g - Set variable globally instead of on the channel\n"
-	"        (applies only to variables, not functions)\n"
 	},
 
 	{ "SetAMAFlags", pbx_builtin_setamaflags,
@@ -502,7 +499,7 @@
 
 	{ "WaitExten", pbx_builtin_waitexten,
 	"Waits for an extension to be entered",
-	"  WaitExten([seconds][|options]): This application waits for the user to enter\n"
+	"  WaitExten([seconds][,options]): This application waits for the user to enter\n"
 	"a new extension for a specified number of seconds.\n"
 	"  Note that the seconds can be passed with fractions of a second. For example,\n"
 	"'1.5' will ask the application to wait for 1.5 seconds.\n"
@@ -4317,13 +4314,13 @@
 	i->daymask = 0x7fffffffU; /* 31 bits */
 	i->dowmask = 0x7f; /* 7 bits */
 	/* on each call, use strsep() to move info to the next argument */
-	get_timerange(i, strsep(&info, "|"));
+	get_timerange(i, strsep(&info, "|,"));
 	if (info)
-		i->dowmask = get_range(strsep(&info, "|"), 7, days, "day of week");
+		i->dowmask = get_range(strsep(&info, "|,"), 7, days, "day of week");
 	if (info)
-		i->daymask = get_range(strsep(&info, "|"), 31, NULL, "day");
+		i->daymask = get_range(strsep(&info, "|,"), 31, NULL, "day");
 	if (info)
-		i->monthmask = get_range(strsep(&info, "|"), 12, months, "month");
+		i->monthmask = get_range(strsep(&info, "|,"), 12, months, "month");
 	return 1;
 }
 
@@ -4394,7 +4391,7 @@
 	new_include->rname = p;
 	strcpy(p, value);
 	/* Strip off timing info, and process if it is there */
-	if ( (c = strchr(p, '|')) ) {
+	if ( (c = strchr(p, ',')) ) {
 		*c++ = '\0';
 	        new_include->hastime = ast_build_timing(&(new_include->timing), c);
 	}
@@ -5571,14 +5568,14 @@
 	struct ast_timing timing;
 
 	if (ast_strlen_zero(data)) {
-		ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n  <time range>|<days of week>|<days of month>|<months>?[[context|]extension|]priority\n");
+		ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n  <time range>,<days of week>,<days of month>,<months>?[[context,]extension,]priority\n");
 		return -1;
 	}
 
 	ts = s = ast_strdupa(data);
 
 	/* Separate the Goto path */
-	strsep(&ts,"?");
+	strsep(&ts, "?");
 
 	/* struct ast_include include contained garbage here, fixed by zeroing it on get_timerange */
 	if (ast_build_timing(&timing, s) && ast_check_timing(&timing))
@@ -5595,7 +5592,7 @@
 	char *s, *appname;
 	struct ast_timing timing;
 	struct ast_app *app;
-	static const char *usage = "ExecIfTime requires an argument:\n  <time range>|<days of week>|<days of month>|<months>?<appname>[|<appargs>]";
+	static const char *usage = "ExecIfTime requires an argument:\n  <time range>,<days of week>,<days of month>,<months>?<appname>[(<appargs>)]";
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "%s\n", usage);
@@ -5604,7 +5601,7 @@
 
 	appname = ast_strdupa(data);
 
-	s = strsep(&appname,"?");	/* Separate the timerange and application name/data */
+	s = strsep(&appname, "?");	/* Separate the timerange and application name/data */
 	if (!appname) {	/* missing application */
 		ast_log(LOG_WARNING, "%s\n", usage);
 		return -1;
@@ -5619,8 +5616,15 @@
 		return 0;
 
 	/* now split appname|appargs */
-	if ((s = strchr(appname, '|')))
+	if ((s = strchr(appname, '('))) {
+		char *e;
 		*s++ = '\0';
+		if (e == strrchr(s, ')'))
+			*e = '\0';
+		else
+			ast_log(LOG_WARNING, "Failed to find closing parenthesis\n");
+	}
+		
 
 	if ((app = pbx_findapp(appname))) {
 		return pbx_exec(chan, app, S_OR(s, ""));
@@ -5640,7 +5644,7 @@
 
 	/* Wait for "n" seconds */
 	if (data && (s = atof(data)) > 0.0) {
-		ms = s*1000.0;
+		ms = s * 1000.0;
 		return ast_safe_sleep(chan, ms);
 	}
 	return 0;
@@ -5794,7 +5798,7 @@
 {
 	int res = ast_parseable_goto(chan, data);
 	if (!res && (option_verbose > 2))
-		ast_verbose( VERBOSE_PREFIX_3 "Goto (%s,%s,%d)\n", chan->context,chan->exten, chan->priority+1);
+		ast_verbose( VERBOSE_PREFIX_3 "Goto (%s,%s,%d)\n", chan->context, chan->exten, chan->priority + 1);
 	return res;
 }
 
@@ -5812,7 +5816,7 @@
 	(*buf)->str[0] = '\0';
 
 	AST_LIST_TRAVERSE(&chan->varshead, variables, entries) {
-		if ((var=ast_var_name(variables)) && (val=ast_var_value(variables))
+		if ((var = ast_var_name(variables)) && (val = ast_var_value(variables))
 		   /* && !ast_strlen_zero(var) && !ast_strlen_zero(val) */
 		   ) {
 			if (ast_str_append(buf, 0, "%s=%s\n", var, val) < 0) {
@@ -5893,7 +5897,7 @@
 	const char *nametail = name;
 
 	/* XXX may need locking on the channel ? */
-	if (name[strlen(name)-1] == ')') {
+	if (name[strlen(name) - 1] == ')') {
 		char *function = ast_strdupa(name);
 
 		ast_func_write(chan, function, value);
@@ -5941,35 +5945,17 @@
 int pbx_builtin_setvar(struct ast_channel *chan, void *data)
 {
 	char *name, *value, *mydata;
-	int argc;
-	char *argv[24];		/* this will only support a maximum of 24 variables being set in a single operation */
-	int global = 0;
-	int x;
 
 	if (ast_strlen_zero(data)) {
-		ast_log(LOG_WARNING, "Set requires at least one variable name/value pair.\n");
+		ast_log(LOG_WARNING, "Set requires one variable name/value pair.\n");
 		return 0;
 	}
 
 	mydata = ast_strdupa(data);
-	argc = ast_app_separate_args(mydata, '|', argv, sizeof(argv) / sizeof(argv[0]));
-
-	/* check for a trailing flags argument */
-	if ((argc > 1) && !strchr(argv[argc-1], '=')) {
-		argc--;
-		if (strchr(argv[argc], 'g'))
-			global = 1;
-	}
-
-	for (x = 0; x < argc; x++) {
-		name = argv[x];
-		if ((value = strchr(name, '='))) {
-			*value++ = '\0';
-			pbx_builtin_setvar_helper((global) ? NULL : chan, name, value);
-		} else
-			ast_log(LOG_WARNING, "Ignoring entry '%s' with no = (and not last 'options' entry)\n", name);
-	}
-
+	name = strsep(&mydata, "=");
+	value = mydata;
+
+	pbx_builtin_setvar_helper(chan, name, value);
 	return(0);
 }
 
@@ -5979,15 +5965,21 @@
 	char *value;
 	char *channel;
 	char tmp[VAR_BUF_SIZE]="";
+	static int deprecation_warning = 0;
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "Ignoring, since there is no variable to set\n");
 		return 0;
 	}
 
+	if (!deprecation_warning) {
+		ast_log(LOG_WARNING, "ImportVar is deprecated.  Please use Set(varname=${IMPORT(channel,variable)}) instead.\n");
+		deprecation_warning = 1;
+	}
+
 	value = ast_strdupa(data);
 	name = strsep(&value,"=");
-	channel = strsep(&value,"|");
+	channel = strsep(&value,",");
 	if (channel && value && name) { /*! \todo XXX should do !ast_strlen_zero(..) of the args ? */
 		struct ast_channel *chan2 = ast_get_channel_by_name_locked(channel);
 		if (chan2) {
@@ -6032,7 +6024,6 @@
 static int pbx_builtin_gotoif(struct ast_channel *chan, void *data)
 {
 	char *condition, *branch1, *branch2, *branch;
-	int rc;
 	char *stringp;
 
 	if (ast_strlen_zero(data)) {
@@ -6052,9 +6043,7 @@
 		return 0;
 	}
 
-	rc = pbx_builtin_goto(chan, branch);
-
-	return rc;
+	return pbx_builtin_goto(chan, branch);
 }
 
 static int pbx_builtin_saynumber(struct ast_channel *chan, void *data)
@@ -6068,10 +6057,10 @@
 		return -1;
 	}
 	ast_copy_string(tmp, data, sizeof(tmp));
-	strsep(&number, "|");
-	options = strsep(&number, "|");
+	strsep(&number, ",");
+	options = strsep(&number, ",");
 	if (options) {
-		if ( strcasecmp(options, "f") && strcasecmp(options,"m") &&
+		if ( strcasecmp(options, "f") && strcasecmp(options, "m") &&
 			strcasecmp(options, "c") && strcasecmp(options, "n") ) {
 			ast_log(LOG_WARNING, "SayNumber gender option is either 'f', 'm', 'c' or 'n'\n");
 			return -1;
@@ -6390,13 +6379,13 @@
 	int mode = 0;
 
 	if (ast_strlen_zero(goto_string)) {
-		ast_log(LOG_WARNING, "Goto requires an argument (optional context|optional extension|priority)\n");
+		ast_log(LOG_WARNING, "Goto requires an argument ([[context,]extension,]priority)\n");
 		return -1;
 	}
 	stringp = ast_strdupa(goto_string);
-	context = strsep(&stringp, "|");	/* guaranteed non-null */
-	exten = strsep(&stringp, "|");
-	pri = strsep(&stringp, "|");
+	context = strsep(&stringp, ",");	/* guaranteed non-null */
+	exten = strsep(&stringp, ",");
+	pri = strsep(&stringp, ",");
 	if (!exten) {	/* Only a priority in this one */
 		pri = context;
 		exten = NULL;

Modified: team/group/dialplan_aesthetics/pbx/pbx_config.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/pbx/pbx_config.c?view=diff&rev=68594&r1=68593&r2=68594
==============================================================================
--- team/group/dialplan_aesthetics/pbx/pbx_config.c (original)
+++ team/group/dialplan_aesthetics/pbx/pbx_config.c Sat Jun  9 11:15:49 2007
@@ -1422,19 +1422,13 @@
 						ipri = 0;
 					}
 					appl = S_OR(stringp, "");
-					/* Find the first occurrence of either '(' or ',' */
-					firstc = strchr(appl, ',');
+					/* Find the first occurrence of '(' */
 					firstp = strchr(appl, '(');
-					if (firstc && (!firstp || firstc < firstp)) {
-						/* comma found, no parenthesis */
-						/* or both found, but comma found first */
-						appl = strsep(&stringp, ",");
-						data = stringp;
-					} else if (!firstc && !firstp) {
-						/* Neither found */
+					if (!firstp) {
+						/* No arguments */
 						data = "";
 					} else {
-						/* Final remaining case is parenthesis found first */
+						char *start;
 						appl = strsep(&stringp, "(");
 						data = stringp;
 						end = strrchr(data, ')');
@@ -1443,11 +1437,10 @@
 						} else {
 							ast_log(LOG_WARNING, "No closing parenthesis found? '%s(%s'\n", appl, data);
 						}
-						ast_process_quotes_and_slashes(data, ',', '|');
 					}
 
 					if (!data)
-						data="";
+						data = "";
 					appl = ast_skip_blanks(appl);
 					if (ipri) {
 						if (plus)
@@ -1472,7 +1465,7 @@
 				if (ast_context_add_ignorepat2(con, realvalue, registrar))
 					ast_log(LOG_WARNING, "Unable to include ignorepat '%s' in context '%s'\n", v->value, cxt);
 			} else if (!strcasecmp(v->name, "switch") || !strcasecmp(v->name, "lswitch") || !strcasecmp(v->name, "eswitch")) {
-				char *stringp= realvalue;
+				char *stringp = realvalue;
 				char *appl, *data;
 
 				memset(realvalue, 0, sizeof(realvalue));
@@ -1481,9 +1474,7 @@
 				else
 					ast_copy_string(realvalue, v->value, sizeof(realvalue));
 				appl = strsep(&stringp, "/");
-				data = strsep(&stringp, ""); /* XXX what for ? */
-				if (!data)
-					data = "";
+				data = S_OR(stringp, "");
 				if (ast_context_add_switch2(con, appl, data, !strcasecmp(v->name, "eswitch"), registrar))
 					ast_log(LOG_WARNING, "Unable to include switch '%s' in context '%s'\n", v->value, cxt);
 			} else {



More information about the asterisk-commits mailing list