[asterisk-commits] tilghman: trunk r76703 - in /trunk: ./ apps/ channels/ funcs/ include/asteris...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 23 14:51:42 CDT 2007


Author: tilghman
Date: Mon Jul 23 14:51:41 2007
New Revision: 76703

URL: http://svn.digium.com/view/asterisk?view=rev&rev=76703
Log:
Merge the dialplan_aesthetics branch.  Most of this patch simply converts applications
using old methods of parsing arguments to using the standard macros.  However, the big
change is that the really old way of specifying application and arguments separated by
a comma will no longer work (e.g. NoOp,foo|bar).  Instead, the way that has been
recommended since long before 1.0 will become the only method available (e.g. NoOp(foo,bar).

Added:
    trunk/include/asterisk/aes.h   (props changed)
      - copied unchanged from r76702, team/group/dialplan_aesthetics/include/asterisk/aes.h
Modified:
    trunk/UPGRADE.txt
    trunk/apps/app_channelredirect.c
    trunk/apps/app_chanspy.c
    trunk/apps/app_controlplayback.c
    trunk/apps/app_dial.c
    trunk/apps/app_exec.c
    trunk/apps/app_externalivr.c
    trunk/apps/app_macro.c
    trunk/apps/app_page.c
    trunk/apps/app_parkandannounce.c
    trunk/apps/app_queue.c
    trunk/apps/app_readfile.c
    trunk/apps/app_record.c
    trunk/apps/app_skel.c
    trunk/apps/app_softhangup.c
    trunk/apps/app_talkdetect.c
    trunk/apps/app_url.c
    trunk/apps/app_verbose.c
    trunk/apps/app_voicemail.c
    trunk/apps/app_zapras.c
    trunk/channels/chan_local.c
    trunk/funcs/func_callerid.c
    trunk/funcs/func_cut.c
    trunk/funcs/func_env.c
    trunk/funcs/func_logic.c
    trunk/funcs/func_odbc.c
    trunk/funcs/func_rand.c
    trunk/funcs/func_realtime.c
    trunk/funcs/func_strings.c
    trunk/funcs/func_vmcount.c
    trunk/include/asterisk/app.h
    trunk/main/pbx.c
    trunk/pbx/pbx_config.c

Modified: trunk/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/trunk/UPGRADE.txt?view=diff&rev=76703&r1=76702&r2=76703
==============================================================================
--- trunk/UPGRADE.txt (original)
+++ trunk/UPGRADE.txt Mon Jul 23 14:51:41 2007
@@ -35,6 +35,16 @@
   like sin, cos, tan, log, pow, etc. The ability to call external functions
   like CDR(), etc. was also added, without having to use the ${...} notation.
  
+* The delimiter passed to applications has been changed to the comma (','), as
+  that is what people are used to using within extensions.conf.  If you are
+  using realtime extensions, you will need to translate your existing dialplan
+  to use this separator.  To use a literal comma, you need merely to escape it
+  with a backslash ('\').  Another possible side effect is that you may need to
+  remove the obscene level of backslashing that was necessary for the dialplan
+  to work correctly in 1.4 and previous versions.  This should make writing
+  dialplans less painful in the future, albeit with the pain of a one-time
+  conversion.
+
 Voicemail:
 
 * The voicemail configuration values 'maxmessage' and 'minmessage' have

Modified: trunk/apps/app_channelredirect.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_channelredirect.c?view=diff&rev=76703&r1=76702&r2=76703
==============================================================================
--- trunk/apps/app_channelredirect.c (original)
+++ trunk/apps/app_channelredirect.c Mon Jul 23 14:51:41 2007
@@ -45,15 +45,14 @@
 static char *app = "ChannelRedirect";
 static char *synopsis = "Redirects given channel to a dialplan target.";
 static char *descrip = 
-"ChannelRedirect(channel|[[context|]extension|]priority):\n"
+"ChannelRedirect(channel,[[context,]extension,]priority)\n"
 "  Sends the specified channel to the specified extension priority\n";
 
 
 static int asyncgoto_exec(struct ast_channel *chan, void *data)
 {
 	int res = -1;
-	char *info, *context, *exten, *priority;
-	int prio = 1;
+	char *info;
 	struct ast_channel *chan2 = NULL;
 
 	AST_DECLARE_APP_ARGS(args,
@@ -62,7 +61,7 @@
 	);
 
 	if (ast_strlen_zero(data)) {
-		ast_log(LOG_WARNING, "%s requires an argument (channel|[[context|]exten|]priority)\n", app);
+		ast_log(LOG_WARNING, "%s requires an argument (channel,[[context,]exten,]priority)\n", app);
 		return -1;
 	}
 
@@ -70,7 +69,7 @@
 	AST_STANDARD_APP_ARGS(args, info);
 
 	if (ast_strlen_zero(args.channel) || ast_strlen_zero(args.label)) {
-		ast_log(LOG_WARNING, "%s requires an argument (channel|[[context|]exten|]priority)\n", app);
+		ast_log(LOG_WARNING, "%s requires an argument (channel,[[context,]exten,]priority)\n", app);
 		goto quit;
 	}
 
@@ -80,38 +79,10 @@
 		goto quit;
 	}
 
-	/* Parsed right to left, so standard parsing won't work */
-	context = strsep(&args.label, "|");
-	exten = strsep(&args.label, "|");
-	if (exten) {
-		priority = strsep(&args.label, "|");
-		if (!priority) {
-			priority = exten;
-			exten = context;
-			context = NULL;
-		}
-	} else {
-		priority = context;
-		context = NULL;
-	}
+	res = ast_parseable_goto(chan2, args.label);
 
-	/* ast_findlabel_extension does not convert numeric priorities; it only does a lookup */
-	if (!(prio = atoi(priority)) && !(prio = ast_findlabel_extension(chan2, S_OR(context, chan2->context),
-									S_OR(exten, chan2->exten), priority, chan2->cid.cid_num))) {
-		ast_log(LOG_WARNING, "'%s' is not a known priority or label\n", priority);
-		goto chanquit;
-	}
-
-	ast_debug(2, "Attempting async goto (%s) to %s|%s|%d\n", args.channel, S_OR(context, chan2->context), S_OR(exten, chan2->exten), prio);
-
-	if (ast_async_goto_if_exists(chan2, S_OR(context, chan2->context), S_OR(exten, chan2->exten), prio))
-		ast_log(LOG_WARNING, "%s failed for %s\n", app, args.channel);
-	else
-		res = 0;
-
- chanquit:
 	ast_mutex_unlock(&chan2->lock);
- quit:
+quit:
 
 	return res;
 }

Modified: trunk/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_chanspy.c?view=diff&rev=76703&r1=76702&r2=76703
==============================================================================
--- trunk/apps/app_chanspy.c (original)
+++ trunk/apps/app_chanspy.c Mon Jul 23 14:51:41 2007
@@ -626,33 +626,27 @@
 
 static int chanspy_exec(struct ast_channel *chan, void *data)
 {
-	char *options = NULL;
-	char *spec = NULL;
-	char *argv[2];
 	char *mygroup = NULL;
 	char *recbase = NULL;
 	int fd = 0;
 	struct ast_flags flags;
 	int oldwf = 0;
-	int argc = 0;
 	int volfactor = 0;
 	int res;
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(spec);
+		AST_APP_ARG(options);
+	);
+	char *opts[OPT_ARG_ARRAY_SIZE];
 
 	data = ast_strdupa(data);
-
-	if ((argc = ast_app_separate_args(data, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
-		spec = argv[0];
-		if (argc > 1)
-			options = argv[1];
-
-		if (ast_strlen_zero(spec) || !strcmp(spec, "all"))
-			spec = NULL;
-	}
-
-	if (options) {
-		char *opts[OPT_ARG_ARRAY_SIZE];
-		
-		ast_app_parse_options(spy_opts, &flags, opts, options);
+	AST_STANDARD_APP_ARGS(args, data);
+
+	if (args.spec && !strcmp(args.spec, "all"))
+		args.spec = NULL;
+
+	if (args.options) {
+		ast_app_parse_options(spy_opts, &flags, opts, args.options);
 		if (ast_test_flag(&flags, OPTION_GROUP))
 			mygroup = opts[OPT_ARG_GROUP];
 
@@ -690,7 +684,7 @@
 		}
 	}
 
-	res = common_exec(chan, &flags, volfactor, fd, mygroup, spec, NULL, NULL);
+	res = common_exec(chan, &flags, volfactor, fd, mygroup, args.spec, NULL, NULL);
 
 	if (fd)
 		close(fd);
@@ -703,35 +697,35 @@
 
 static int extenspy_exec(struct ast_channel *chan, void *data)
 {
-	char *options = NULL;
-	char *exten = NULL;
-	char *context = NULL;
-	char *argv[2];
+	char *ptr, *exten = NULL;
 	char *mygroup = NULL;
 	char *recbase = NULL;
 	int fd = 0;
 	struct ast_flags flags;
 	int oldwf = 0;
-	int argc = 0;
 	int volfactor = 0;
 	int res;
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(context);
+		AST_APP_ARG(options);
+	);
 
 	data = ast_strdupa(data);
 
-	if ((argc = ast_app_separate_args(data, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
-		context = argv[0];
-		if (!ast_strlen_zero(argv[0]))
-			exten = strsep(&context, "@");
-		if (ast_strlen_zero(context))
-			context = ast_strdupa(chan->context);
-		if (argc > 1)
-			options = argv[1];
-	}
-
-	if (options) {
+	AST_STANDARD_APP_ARGS(args, data);
+	if (!ast_strlen_zero(args.context) && (ptr = strchr(args.context, '@'))) {
+		exten = args.context;
+		*ptr++ = '\0';
+		args.context = ptr;
+	}
+
+	if (ast_strlen_zero(args.context))
+		args.context = ast_strdupa(chan->context);
+
+	if (args.options) {
 		char *opts[OPT_ARG_ARRAY_SIZE];
 		
-		ast_app_parse_options(spy_opts, &flags, opts, options);
+		ast_app_parse_options(spy_opts, &flags, opts, args.options);
 		if (ast_test_flag(&flags, OPTION_GROUP))
 			mygroup = opts[OPT_ARG_GROUP];
 
@@ -769,7 +763,7 @@
 		}
 	}
 
-	res = common_exec(chan, &flags, volfactor, fd, mygroup, NULL, exten, context);
+	res = common_exec(chan, &flags, volfactor, fd, mygroup, NULL, exten, args.context);
 
 	if (fd)
 		close(fd);

Modified: trunk/apps/app_controlplayback.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_controlplayback.c?view=diff&rev=76703&r1=76702&r2=76703
==============================================================================
--- trunk/apps/app_controlplayback.c (original)
+++ trunk/apps/app_controlplayback.c Mon Jul 23 14:51:41 2007
@@ -94,20 +94,18 @@
 	long offsetms = 0;
 	char offsetbuf[20];
 	char *tmp;
-	int argc;
-	char *argv[8] = { NULL, };
-	enum arg_ids {
-		arg_file = 0,
-		arg_skip = 1,
-		arg_fwd = 2,
-		arg_rev = 3,
-		arg_stop = 4,
-		arg_pause = 5,
-		arg_restart = 6,
-		options = 7,
-	};
 	struct ast_flags opts = { 0, };
 	char *opt_args[OPT_ARG_ARRAY_LEN];
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(filename);
+		AST_APP_ARG(skip);
+		AST_APP_ARG(fwd);
+		AST_APP_ARG(rev);
+		AST_APP_ARG(stop);
+		AST_APP_ARG(pause);
+		AST_APP_ARG(restart);
+		AST_APP_ARG(options);
+	);
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "ControlPlayback requires an argument (filename)\n");
@@ -115,39 +113,36 @@
 	}
 	
 	tmp = ast_strdupa(data);
+	AST_STANDARD_APP_ARGS(args, tmp);
 
-	argc = ast_app_separate_args(tmp, '|', argv, sizeof(argv) / sizeof(argv[0]));
-
-	if (argc < 1) {
+	if (args.argc < 1) {
 		ast_log(LOG_WARNING, "ControlPlayback requires an argument (filename)\n");
 		return -1;
 	}
 
-	skipms = argv[arg_skip] ? atoi(argv[arg_skip]) : 3000;
-	if (!skipms)
-		skipms = 3000;
+	skipms = args.skip ? (atoi(args.skip) ? atoi(args.skip) : 3000) : 3000;
 
-	if (!argv[arg_fwd] || !is_on_phonepad(*argv[arg_fwd]))
-		argv[arg_fwd] = "#";
-	if (!argv[arg_rev] || !is_on_phonepad(*argv[arg_rev]))
-		argv[arg_rev] = "*";
-	if (argv[arg_stop] && !is_on_phonepad(*argv[arg_stop]))
-		argv[arg_stop] = NULL;
-	if (argv[arg_pause] && !is_on_phonepad(*argv[arg_pause]))
-		argv[arg_pause] = NULL;
-	if (argv[arg_restart] && !is_on_phonepad(*argv[arg_restart]))
-		argv[arg_restart] = NULL;
+	if (!args.fwd || !is_on_phonepad(*args.fwd))
+		args.fwd = "#";
+	if (!args.rev || !is_on_phonepad(*args.rev))
+		args.rev = "*";
+	if (args.stop && !is_on_phonepad(*args.stop))
+		args.stop = NULL;
+	if (args.pause && !is_on_phonepad(*args.pause))
+		args.pause = NULL;
+	if (args.restart && !is_on_phonepad(*args.restart))
+		args.restart = NULL;
 
-	if (argv[options]) {
-		ast_app_parse_options(cpb_opts, &opts, opt_args, argv[options]);		
+	if (args.options) {
+		ast_app_parse_options(cpb_opts, &opts, opt_args, args.options);		
 		if (ast_test_flag(&opts, OPT_OFFSET))
 			offsetms = atol(opt_args[OPT_ARG_OFFSET]);
 	}
 
-	res = ast_control_streamfile(chan, argv[arg_file], argv[arg_fwd], argv[arg_rev], argv[arg_stop], argv[arg_pause], argv[arg_restart], skipms, &offsetms);
+	res = ast_control_streamfile(chan, args.filename, args.fwd, args.rev, args.stop, args.pause, args.restart, skipms, &offsetms);
 
 	/* If we stopped on one of our stop keys, return 0  */
-	if (argv[arg_stop] && strchr(argv[arg_stop], res)) {
+	if (args.stop && strchr(args.stop, res)) {
 		res = 0;
 		pbx_builtin_setvar_helper(chan, "CPLAYBACKSTATUS", "USERSTOPPED");
 	} else {

Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dial.c?view=diff&rev=76703&r1=76702&r2=76703
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Mon Jul 23 14:51:41 2007
@@ -66,7 +66,7 @@
 static char *synopsis = "Place a call and connect to the current channel";
 
 static char *descrip =
-"  Dial(Technology/resource[&Tech2/resource2...][|timeout][|options][|URL]):\n"
+"  Dial(Technology/resource[&Tech2/resource2...][,timeout][,options][,URL]):\n"
 "This application will place calls to one or more specified channels. As soon\n"
 "as one of the requested channels answers, the originating channel will be\n"
 "answered, if it has not already been answered. These two channels will then\n"
@@ -215,7 +215,7 @@
 static char *rapp = "RetryDial";
 static char *rsynopsis = "Place a call, retrying on failure allowing optional exit extension.";
 static char *rdescrip =
-"  RetryDial(announce|sleep|retries|dialargs): This application will attempt to\n"
+"  RetryDial(announce,sleep,retries,dialargs): This application will attempt to\n"
 "place a call using the normal Dial application. If no channel can be reached,\n"
 "the 'announce' file will be played. Then, it will wait 'sleep' number of\n"
 "seconds before retying the call. After 'retires' number of attempts, the\n"
@@ -840,7 +840,7 @@
 {
 	for (; *s; s++)
 		if (*s == '^')
-			*s = '|';
+			*s = ',';
 }
 
 
@@ -1856,41 +1856,33 @@
 
 static int retrydial_exec(struct ast_channel *chan, void *data)
 {
-	char *announce = NULL, *dialdata = NULL;
+	char *parse;
 	const char *context = NULL;
 	int sleep = 0, loops = 0, res = -1;
-	struct ast_flags64 peerflags;
-	
+	struct ast_flags64 peerflags = { 0, };
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(announce);
+		AST_APP_ARG(sleep);
+		AST_APP_ARG(retries);
+		AST_APP_ARG(dialdata);
+	);
+
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "RetryDial requires an argument!\n");
 		return -1;
 	}	
 
-	announce = ast_strdupa(data);
-
-	memset(&peerflags, 0, sizeof(peerflags));
-
-	if ((dialdata = strchr(announce, '|'))) {
-		*dialdata++ = '\0';
-		if (sscanf(dialdata, "%d", &sleep) == 1) {
-			sleep *= 1000;
-		} else {
-			ast_log(LOG_ERROR, "%s requires the numerical argument <sleep>\n",rapp);
-			goto done;
-		}
-		if ((dialdata = strchr(dialdata, '|'))) {
-			*dialdata++ = '\0';
-			if (sscanf(dialdata, "%d", &loops) != 1) {
-				ast_log(LOG_ERROR, "%s requires the numerical argument <loops>\n",rapp);
-				goto done;
-			}
-		}
-	}
-	
-	if ((dialdata = strchr(dialdata, '|'))) {
-		*dialdata++ = '\0';
-	} else {
-		ast_log(LOG_ERROR, "%s requires more arguments\n",rapp);
+	parse = ast_strdupa(data);
+	AST_STANDARD_APP_ARGS(args, parse);
+
+	if ((sleep = atoi(args.sleep))) {
+		sleep *= 1000;
+	}
+
+	loops = atoi(args.retries);
+
+	if (!args.dialdata) {
+		ast_log(LOG_ERROR, "%s requires a 4th argument (dialdata)\n", rapp);
 		goto done;
 	}
 		
@@ -1910,18 +1902,18 @@
 		if (ast_test_flag(chan, AST_FLAG_MOH))
 			ast_moh_stop(chan);
 
-		res = dial_exec_full(chan, dialdata, &peerflags, &continue_exec);
+		res = dial_exec_full(chan, args.dialdata, &peerflags, &continue_exec);
 		if (continue_exec)
 			break;
 
 		if (res == 0) {
 			if (ast_test_flag64(&peerflags, OPT_DTMF_EXIT)) {
-				if (!ast_strlen_zero(announce)) {
-					if (ast_fileexists(announce, NULL, chan->language) > 0) {
-						if(!(res = ast_streamfile(chan, announce, chan->language)))								
+				if (!ast_strlen_zero(args.announce)) {
+					if (ast_fileexists(args.announce, NULL, chan->language) > 0) {
+						if(!(res = ast_streamfile(chan, args.announce, chan->language)))								
 							ast_waitstream(chan, AST_DIGIT_ANY);
 					} else
-						ast_log(LOG_WARNING, "Announce file \"%s\" specified in Retrydial does not exist\n", announce);
+						ast_log(LOG_WARNING, "Announce file \"%s\" specified in Retrydial does not exist\n", args.announce);
 				}
 				if (!res && sleep) {
 					if (!ast_test_flag(chan, AST_FLAG_MOH))
@@ -1929,12 +1921,12 @@
 					res = ast_waitfordigit(chan, sleep);
 				}
 			} else {
-				if (!ast_strlen_zero(announce)) {
-					if (ast_fileexists(announce, NULL, chan->language) > 0) {
-						if (!(res = ast_streamfile(chan, announce, chan->language)))
+				if (!ast_strlen_zero(args.announce)) {
+					if (ast_fileexists(args.announce, NULL, chan->language) > 0) {
+						if (!(res = ast_streamfile(chan, args.announce, chan->language)))
 							res = ast_waitstream(chan, "");
 					} else
-						ast_log(LOG_WARNING, "Announce file \"%s\" specified in Retrydial does not exist\n", announce);
+						ast_log(LOG_WARNING, "Announce file \"%s\" specified in Retrydial does not exist\n", args.announce);
 				}
 				if (sleep) {
 					if (!ast_test_flag(chan, AST_FLAG_MOH))

Modified: trunk/apps/app_exec.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_exec.c?view=diff&rev=76703&r1=76702&r2=76703
==============================================================================
--- trunk/apps/app_exec.c (original)
+++ trunk/apps/app_exec.c Mon Jul 23 14:51:41 2007
@@ -41,6 +41,7 @@
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
 #include "asterisk/module.h"
+#include "asterisk/app.h"
 
 /* Maximum length of any variable */
 #define MAXRESULT	1024
@@ -83,7 +84,7 @@
 static char *app_execif = "ExecIf";
 static char *execif_synopsis = "Executes dialplan application, conditionally";
 static char *execif_descrip = 
-"Usage:  ExecIF (<expr>|<app>|<data>)\n"
+"Usage:  ExecIF (<expr>?<app>(<data>):<app2>(<data2>))\n"
 "If <expr> is true, execute and return the result of <app>(<data>).\n"
 "If <expr> is true, but <app> is not found, then the application\n"
 "will return a non-zero value.\n";
@@ -152,33 +153,47 @@
 static int execif_exec(struct ast_channel *chan, void *data)
 {
 	int res = 0;
-	char *myapp = NULL;
-	char *mydata = NULL;
-	char *expr = NULL;
+	char *truedata = NULL, *falsedata = NULL, *end;
 	struct ast_app *app = NULL;
-
-	expr = ast_strdupa(data);
-
-	if ((myapp = strchr(expr,'|'))) {
-		*myapp = '\0';
-		myapp++;
-		if ((mydata = strchr(myapp,'|'))) {
-			*mydata = '\0';
-			mydata++;
-		} else
-			mydata = "";
-
-		if (pbx_checkcondition(expr)) { 
-			if ((app = pbx_findapp(myapp))) {
-				res = pbx_exec(chan, app, mydata);
-			} else {
-				ast_log(LOG_WARNING, "Count not find application! (%s)\n", myapp);
-				res = -1;
-			}
+	AST_DECLARE_APP_ARGS(expr,
+		AST_APP_ARG(expr);
+		AST_APP_ARG(remainder);
+	);
+	AST_DECLARE_APP_ARGS(apps,
+		AST_APP_ARG(true);
+		AST_APP_ARG(false);
+	);
+	char *parse = ast_strdupa(data);
+
+	AST_NONSTANDARD_APP_ARGS(expr, parse, '?');
+	AST_NONSTANDARD_APP_ARGS(apps, expr.remainder, ':');
+
+	if (apps.true && (truedata = strchr(apps.true, '('))) {
+		*truedata++ = '\0';
+		if ((end = strrchr(truedata, ')')))
+			*end = '\0';
+	}
+
+	if (apps.false && (falsedata = strchr(apps.false, '('))) {
+		*falsedata++ = '\0';
+		if ((end = strrchr(falsedata, ')')))
+			*end = '\0';
+	}
+
+	if (pbx_checkcondition(expr.expr)) { 
+		if (!ast_strlen_zero(apps.true) && (app = pbx_findapp(apps.true))) {
+			res = pbx_exec(chan, app, S_OR(truedata, ""));
+		} else {
+			ast_log(LOG_WARNING, "Could not find application! (%s)\n", apps.true);
+			res = -1;
 		}
 	} else {
-		ast_log(LOG_ERROR,"Invalid Syntax.\n");
-		res = -1;
+		if (!ast_strlen_zero(apps.false) && (app = pbx_findapp(apps.false))) {
+			res = pbx_exec(chan, app, S_OR(falsedata, ""));
+		} else {
+			ast_log(LOG_WARNING, "Could not find application! (%s)\n", apps.false);
+			res = -1;
+		}
 	}
 
 	return res;

Modified: trunk/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_externalivr.c?view=diff&rev=76703&r1=76702&r2=76703
==============================================================================
--- trunk/apps/app_externalivr.c (original)
+++ trunk/apps/app_externalivr.c Mon Jul 23 14:51:41 2007
@@ -58,7 +58,7 @@
 static const char *synopsis = "Interfaces with an external IVR application";
 
 static const char *descrip = 
-"  ExternalIVR(command[|arg[|arg...]]): Forks an process to run the supplied command,\n"
+"  ExternalIVR(command[,arg[,arg...]]): Forks an process to run the supplied command,\n"
 "and starts a generator on the channel. The generator's play list is\n"
 "controlled by the external application, which can add and clear entries\n"
 "via simple commands issued over its stdout. The external application\n"
@@ -244,7 +244,6 @@
 static int app_exec(struct ast_channel *chan, void *data)
 {
 	struct playlist_entry *entry;
-	const char *args = data;
 	int child_stdin[2] = { 0,0 };
 	int child_stdout[2] = { 0,0 };
 	int child_stderr[2] = { 0,0 };
@@ -252,7 +251,6 @@
 	int gen_active = 0;
 	int pid;
 	char *argv[32];
-	int argc = 1;
 	char *buf, *command;
 	FILE *child_commands = NULL;
 	FILE *child_errors = NULL;
@@ -263,6 +261,9 @@
 	};
 	struct ivr_localuser *u = &foo;
 	sigset_t fullset, oldset;
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(cmd)[32];
+	);
 
 	sigfillset(&fullset);
 	pthread_sigmask(SIG_BLOCK, &fullset, &oldset);
@@ -270,14 +271,13 @@
 	u->abort_current_sound = 0;
 	u->chan = chan;
 	
-	if (ast_strlen_zero(args)) {
+	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "ExternalIVR requires a command to execute\n");
 		return -1;	
 	}
 
 	buf = ast_strdupa(data);
-
-	argc = ast_app_separate_args(buf, '|', argv, sizeof(argv) / sizeof(argv[0]));
+	AST_STANDARD_APP_ARGS(args, buf);
 
 	if (pipe(child_stdin)) {
 		ast_chan_log(LOG_WARNING, chan, "Could not create pipe for child input: %s\n", strerror(errno));

Modified: trunk/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_macro.c?view=diff&rev=76703&r1=76702&r2=76703
==============================================================================
--- trunk/apps/app_macro.c (original)
+++ trunk/apps/app_macro.c Mon Jul 23 14:51:41 2007
@@ -197,7 +197,7 @@
 
 	tmp = ast_strdupa(data);
 	rest = tmp;
-	macro = strsep(&rest, "|");
+	macro = strsep(&rest, ",");
 	if (ast_strlen_zero(macro)) {
 		ast_log(LOG_WARNING, "Invalid macro name specified\n");
 		return 0;
@@ -255,7 +255,7 @@
 	ast_copy_string(chan->context, fullmacro, sizeof(chan->context));
 	chan->priority = 1;
 
-	while((cur = strsep(&rest, "|")) && (argc < MAX_ARGS)) {
+	while((cur = strsep(&rest, ",")) && (argc < MAX_ARGS)) {
 		const char *s;
   		/* Save copy of old arguments if we're overwriting some, otherwise
 	   	let them pass through to the other macro */

Modified: trunk/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_page.c?view=diff&rev=76703&r1=76702&r2=76703
==============================================================================
--- trunk/apps/app_page.c (original)
+++ trunk/apps/app_page.c Mon Jul 23 14:51:41 2007
@@ -86,7 +86,7 @@
 static int page_exec(struct ast_channel *chan, void *data)
 {
 	char *options, *tech, *resource, *tmp;
-	char meetmeopts[88], originator[AST_CHANNEL_NAME];
+	char meetmeopts[88], originator[AST_CHANNEL_NAME], *opts[0];
 	struct ast_flags flags = { 0 };
 	unsigned int confid = ast_random();
 	struct ast_app *app;
@@ -109,9 +109,9 @@
 	if ((tmp = strchr(originator, '-')))
 		*tmp = '\0';
 
-	tmp = strsep(&options, "|");
+	tmp = strsep(&options, ",");
 	if (options)
-		ast_app_parse_options(page_opts, &flags, NULL, options);
+		ast_app_parse_options(page_opts, &flags, opts, options);
 
 	snprintf(meetmeopts, sizeof(meetmeopts), "MeetMe|%ud|%s%sqxdw(5)", confid, (ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m"),
 		(ast_test_flag(&flags, PAGE_RECORD) ? "r" : "") );

Modified: trunk/apps/app_parkandannounce.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_parkandannounce.c?view=diff&rev=76703&r1=76702&r2=76703
==============================================================================
--- trunk/apps/app_parkandannounce.c (original)
+++ trunk/apps/app_parkandannounce.c Mon Jul 23 14:51:41 2007
@@ -50,6 +50,7 @@
 #include "asterisk/say.h"
 #include "asterisk/lock.h"
 #include "asterisk/utils.h"
+#include "asterisk/app.h"
 
 static char *app = "ParkAndAnnounce";
 
@@ -76,113 +77,72 @@
 
 static int parkandannounce_exec(struct ast_channel *chan, void *data)
 {
-	int res=0;
-	char *return_context;
+	int res = -1;
 	int lot, timeout = 0, dres;
-	char *working, *context, *exten, *priority, *dial, *dialtech, *dialstr;
-	char *template, *tpl_working, *tpl_current;
-	char *tmp[100];
-	char buf[13];
-	int looptemp=0,i=0;
+	char *dialtech, *tmp[100], buf[13];
+	int looptemp, i;
 	char *s;
 
 	struct ast_channel *dchan;
-	struct outgoing_helper oh;
+	struct outgoing_helper oh = { 0, };
 	int outstate;
-
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(template);
+		AST_APP_ARG(timeout);
+		AST_APP_ARG(dial);
+		AST_APP_ARG(return_context);
+	);
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "ParkAndAnnounce requires arguments: (announce:template|timeout|dial|[return_context])\n");
 		return -1;
 	}
   
 	s = ast_strdupa(data);
-
-	template=strsep(&s,"|");
-	if(! template) {
-		ast_log(LOG_WARNING, "PARK: An announce template must be defined\n");
-		return -1;
-	}
-  
-	if(s) {
-		timeout = atoi(strsep(&s, "|"));
-		timeout *= 1000;
-	}
-	dial=strsep(&s, "|");
-	if(!dial) {
+	AST_STANDARD_APP_ARGS(args, s);
+
+	if (args.timeout)
+		timeout = atoi(args.timeout) * 1000;
+
+	if (ast_strlen_zero(args.dial)) {
 		ast_log(LOG_WARNING, "PARK: A dial resource must be specified i.e: Console/dsp or Zap/g1/5551212\n");
 		return -1;
-	} else {
-		dialtech=strsep(&dial, "/");
-		dialstr=dial;
-		ast_verbose( VERBOSE_PREFIX_3 "Dial Tech,String: (%s,%s)\n", dialtech,dialstr);
-	}
-
-	return_context = s;
-  
-	if(return_context != NULL) {
-		/* set the return context. Code borrowed from the Goto builtin */
-    
-		working = return_context;
-		context = strsep(&working, "|");
-		exten = strsep(&working, "|");
-		if(!exten) {
-			/* Only a priority in this one */
-			priority = context;
-			exten = NULL;
-			context = NULL;
-		} else {
-			priority = strsep(&working, "|");
-			if(!priority) {
-				/* Only an extension and priority in this one */
-				priority = exten;
-				exten = context;
-				context = NULL;
+	}
+
+	dialtech = strsep(&args.dial, "/");
+	if (option_verbose > 2)
+		ast_verbose(VERBOSE_PREFIX_3 "Dial Tech,String: (%s,%s)\n", dialtech, args.dial);
+
+	if (!ast_strlen_zero(args.return_context))
+		ast_parseable_goto(chan, args.return_context);
+
+	if (option_verbose > 2) {
+		ast_verbose(VERBOSE_PREFIX_3 "Return Context: (%s,%s,%d) ID: %s\n", chan->context, chan->exten, chan->priority, chan->cid.cid_num);
+		if (!ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) {
+			ast_verbose(VERBOSE_PREFIX_3 "Warning: Return Context Invalid, call will return to default|s\n");
 		}
 	}
-	if(atoi(priority) < 0) {
-		ast_log(LOG_WARNING, "Priority '%s' must be a number > 0\n", priority);
-		return -1;
-	}
-	/* At this point we have a priority and maybe an extension and a context */
-	chan->priority = atoi(priority);
-	if (exten)
-		ast_copy_string(chan->exten, exten, sizeof(chan->exten));
-	if (context)
-		ast_copy_string(chan->context, context, sizeof(chan->context));
-	} else {  /* increment the priority by default*/
-		chan->priority++;
-	}
-
-	if(option_verbose > 2) {
-		ast_verbose( VERBOSE_PREFIX_3 "Return Context: (%s,%s,%d) ID: %s\n", chan->context,chan->exten, chan->priority, chan->cid.cid_num);
-		if(!ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) {
-			ast_verbose( VERBOSE_PREFIX_3 "Warning: Return Context Invalid, call will return to default|s\n");
-		}
-	}
-  
+
 	/* we are using masq_park here to protect * from touching the channel once we park it.  If the channel comes out of timeout
 	before we are done announcing and the channel is messed with, Kablooeee.  So we use Masq to prevent this.  */
 
 	ast_masq_park_call(chan, NULL, timeout, &lot);
 
-	res=-1; 
-
-	ast_verbose( VERBOSE_PREFIX_3 "Call Parking Called, lot: %d, timeout: %d, context: %s\n", lot, timeout, return_context);
-
-	/* Now place the call to the extention */
+	if (option_verbose > 2)
+		ast_verbose(VERBOSE_PREFIX_3 "Call Parking Called, lot: %d, timeout: %d, context: %s\n", lot, timeout, args.return_context);
+
+	/* Now place the call to the extension */
 
 	snprintf(buf, sizeof(buf), "%d", lot);
-	memset(&oh, 0, sizeof(oh));
 	oh.parent_channel = chan;
 	oh.vars = ast_variable_new("_PARKEDAT", buf);
-	dchan = __ast_request_and_dial(dialtech, AST_FORMAT_SLINEAR, dialstr,30000, &outstate, chan->cid.cid_num, chan->cid.cid_name, &oh);
-
-	if(dchan) {
-		if(dchan->_state == AST_STATE_UP) {
-			if(option_verbose > 3)
+	dchan = __ast_request_and_dial(dialtech, AST_FORMAT_SLINEAR, args.dial, 30000, &outstate, chan->cid.cid_num, chan->cid.cid_name, &oh);
+
+	if (dchan) {
+		if (dchan->_state == AST_STATE_UP) {
+			if (option_verbose > 3)
 				ast_verbose(VERBOSE_PREFIX_4 "Channel %s was answered.\n", dchan->name);
 		} else {
-			if(option_verbose > 3)
+			if (option_verbose > 3)
 				ast_verbose(VERBOSE_PREFIX_4 "Channel %s was never answered.\n", dchan->name);
         			ast_log(LOG_WARNING, "PARK: Channel %s was never answered for the announce.\n", dchan->name);
 			ast_hangup(dchan);
@@ -197,24 +157,21 @@
 
 	/* now we have the call placed and are ready to play stuff to it */
 
-	ast_verbose(VERBOSE_PREFIX_4 "Announce Template:%s\n", template);
-
-	tpl_working = template;
-	tpl_current=strsep(&tpl_working, ":");
-
-	while(tpl_current && looptemp < sizeof(tmp)) {
-		tmp[looptemp]=tpl_current;
-		looptemp++;
-		tpl_current=strsep(&tpl_working,":");
-	}
-
-	for(i=0; i<looptemp; i++) {
-		ast_verbose(VERBOSE_PREFIX_4 "Announce:%s\n", tmp[i]);
-		if(!strcmp(tmp[i], "PARKED")) {
+	if (option_verbose > 3)
+		ast_verbose(VERBOSE_PREFIX_4 "Announce Template:%s\n", args.template);
+
+	for (looptemp = 0, tmp[looptemp++] = strsep(&args.template, ":");
+		 looptemp < sizeof(tmp) / sizeof(tmp[0]);
+		 tmp[looptemp++] = strsep(&args.template, ":"));
+
+	for (i = 0; i < looptemp; i++) {
+		if (option_verbose > 3)
+			ast_verbose(VERBOSE_PREFIX_4 "Announce:%s\n", tmp[i]);
+		if (!strcmp(tmp[i], "PARKED")) {
 			ast_say_digits(dchan, lot, "", dchan->language);
 		} else {
 			dres = ast_streamfile(dchan, tmp[i], dchan->language);
-			if(!dres) {
+			if (!dres) {
 				dres = ast_waitstream(dchan, "");
 			} else {
 				ast_log(LOG_WARNING, "ast_streamfile of %s failed on %s\n", tmp[i], dchan->name);

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=76703&r1=76702&r2=76703
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Mon Jul 23 14:51:41 2007
@@ -930,11 +930,11 @@
 		else
 			q->announceholdtime = 0;
 	} else if (!strcasecmp(param, "periodic-announce")) {
-		if (strchr(val, '|')) {
+		if (strchr(val, ',')) {
 			char *s, *buf = ast_strdupa(val);
 			unsigned int i = 0;
 
-			while ((s = strsep(&buf, "|"))) {
+			while ((s = strsep(&buf, ",|"))) {
 				ast_copy_string(q->sound_periodicannounce[i], s, sizeof(q->sound_periodicannounce[i]));
 				i++;
 				if (i == MAX_PERIODIC_ANNOUNCEMENTS)
@@ -3179,7 +3179,7 @@
 			continue;
 
 		cur_ptr = queue_data;
-		while ((member = strsep(&cur_ptr, "|"))) {
+		while ((member = strsep(&cur_ptr, ",|"))) {
 			if (ast_strlen_zero(member))
 				continue;
 

Modified: trunk/apps/app_readfile.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_readfile.c?view=diff&rev=76703&r1=76702&r2=76703
==============================================================================
--- trunk/apps/app_readfile.c (original)
+++ trunk/apps/app_readfile.c Mon Jul 23 14:51:41 2007
@@ -67,7 +67,7 @@
 	s = ast_strdupa(data);
 
 	varname = strsep(&s, "=");
-	file = strsep(&s, "|");
+	file = strsep(&s, ",");
 	length = s;
 
 	if (!varname || !file) {

Modified: trunk/apps/app_record.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_record.c?view=diff&rev=76703&r1=76702&r2=76703
==============================================================================
--- trunk/apps/app_record.c (original)
+++ trunk/apps/app_record.c Mon Jul 23 14:51:41 2007
@@ -74,19 +74,35 @@
 "If the user should hangup during a recording, all data will be lost and the\n"
 "application will teminate. \n";
 
+enum {
+	OPTION_APPEND = (1 << 0),
+	OPTION_NOANSWER = (1 << 1),
+	OPTION_QUIET = (1 << 2),
+	OPTION_SKIP = (1 << 3),
+	OPTION_STAR_TERMINATE = (1 << 4),
+	OPTION_IGNORE_TERMINATE = (1 << 5),
+	FLAG_HAS_PERCENT = (1 << 6),
+};
+
+AST_APP_OPTIONS(app_opts,{
+	AST_APP_OPTION('a', OPTION_APPEND),
+	AST_APP_OPTION('n', OPTION_NOANSWER),
+	AST_APP_OPTION('q', OPTION_QUIET),
+	AST_APP_OPTION('s', OPTION_SKIP),
+	AST_APP_OPTION('t', OPTION_STAR_TERMINATE),
+	AST_APP_OPTION('x', OPTION_IGNORE_TERMINATE),
+});
 
 static int record_exec(struct ast_channel *chan, void *data)
 {
 	int res = 0;
 	int count = 0;
-	int percentflag = 0;
-	char *filename, *ext = NULL, *silstr, *maxstr, *options;
-	char *file, *dir;
-	char *vdata, *p;
+	char *ext = NULL, *opts[0];
+	char *parse, *dir, *file;
 	int i = 0;
 	char tmp[256];
 
-	struct ast_filestream *s = '\0';
+	struct ast_filestream *s = NULL;
 	struct ast_frame *f = NULL;
 	
 	struct ast_dsp *sildet = NULL;   	/* silence detector dsp */
@@ -96,15 +112,18 @@
 	int gotsilence = 0;		/* did we timeout for silence? */
 	int maxduration = 0;		/* max duration of recording in milliseconds */
 	int gottimeout = 0;		/* did we timeout for maxduration exceeded? */
-	int option_skip = 0;
-	int option_noanswer = 0;
-	int option_append = 0;
 	int terminator = '#';
-	int option_quiet = 0;
 	int rfmt = 0;
-	int flags;
+	int ioflags;
 	int waitres;
 	struct ast_silence_generator *silgen = NULL;
+	struct ast_flags flags;
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(filename);
+		AST_APP_ARG(silence);
+		AST_APP_ARG(maxduration);
+		AST_APP_ARG(options);
+	);
 	
 	/* The next few lines of code parse out the filename and header from the input string */
 	if (ast_strlen_zero(data)) { /* no data implies no filename or anything is present */
@@ -112,21 +131,17 @@
 		return -1;
 	}
 
-	/* Yay for strsep being easy */
-	vdata = ast_strdupa(data);
-
-	p = vdata;
-	filename = strsep(&p, "|");
-	silstr = strsep(&p, "|");
-	maxstr = strsep(&p, "|");	
-	options = strsep(&p, "|");
-	
-	if (filename) {
-		if (strstr(filename, "%d"))
-			percentflag = 1;
-		ext = strrchr(filename, '.'); /* to support filename with a . in the filename, not format */
+	parse = ast_strdupa(data);
+	AST_STANDARD_APP_ARGS(args, parse);
+	if (args.argc == 4)
+		ast_app_parse_options(app_opts, &flags, opts, args.options);
+
+	if (!ast_strlen_zero(args.filename)) {
+		if (strstr(args.filename, "%d"))
+			ast_set_flag(&flags, FLAG_HAS_PERCENT);
+		ext = strrchr(args.filename, '.'); /* to support filename with a . in the filename, not format */
 		if (!ext)
-			ext = strchr(filename, ':');
+			ext = strchr(args.filename, ':');
 		if (ext) {
 			*ext = '\0';
 			ext++;
@@ -136,52 +151,36 @@
 		ast_log(LOG_WARNING, "No extension specified to filename!\n");
 		return -1;
 	}
-	if (silstr) {
-		if ((sscanf(silstr, "%d", &i) == 1) && (i > -1)) {
+	if (args.silence) {
+		if ((sscanf(args.silence, "%d", &i) == 1) && (i > -1)) {
 			silence = i * 1000;
-		} else if (!ast_strlen_zero(silstr)) {
-			ast_log(LOG_WARNING, "'%s' is not a valid silence duration\n", silstr);
+		} else if (!ast_strlen_zero(args.silence)) {
+			ast_log(LOG_WARNING, "'%s' is not a valid silence duration\n", args.silence);
 		}
 	}
 	
-	if (maxstr) {
-		if ((sscanf(maxstr, "%d", &i) == 1) && (i > -1))
+	if (args.maxduration) {
+		if ((sscanf(args.maxduration, "%d", &i) == 1) && (i > -1))
 			/* Convert duration to milliseconds */
 			maxduration = i * 1000;
-		else if (!ast_strlen_zero(maxstr))
-			ast_log(LOG_WARNING, "'%s' is not a valid maximum duration\n", maxstr);
-	}
-	if (options) {
-		/* Retain backwards compatibility with old style options */
-		if (!strcasecmp(options, "skip"))
-			option_skip = 1;
-		else if (!strcasecmp(options, "noanswer"))
-			option_noanswer = 1;
-		else {
-			if (strchr(options, 's'))
-				option_skip = 1;
-			if (strchr(options, 'n'))
-				option_noanswer = 1;
-			if (strchr(options, 'a'))
-				option_append = 1;
-			if (strchr(options, 't'))
-				terminator = '*';
-			if (strchr(options, 'x'))
-				terminator = 0;
-			if (strchr(options, 'q'))
-				option_quiet = 1;
-		}
-	}
-	
+		else if (!ast_strlen_zero(args.maxduration))
+			ast_log(LOG_WARNING, "'%s' is not a valid maximum duration\n", args.maxduration);
+	}
+
+	if (ast_test_flag(&flags, OPTION_STAR_TERMINATE))
+		terminator = '*';
+	if (ast_test_flag(&flags, OPTION_IGNORE_TERMINATE))
+		terminator = '\0';
+
 	/* done parsing */
-	
+
 	/* these are to allow the use of the %d in the config file for a wild card of sort to
 	  create a new file with the inputed name scheme */
-	if (percentflag) {
+	if (ast_test_flag(&flags, FLAG_HAS_PERCENT)) {
 		AST_DECLARE_APP_ARGS(fname,
 			AST_APP_ARG(piece)[100];
 		);
-		char *tmp2 = ast_strdupa(filename);
+		char *tmp2 = ast_strdupa(args.filename);
 		char countstring[15];
 		int i;
 
@@ -210,27 +209,25 @@
 		} while (ast_fileexists(tmp, ext, chan->language) > 0);
 		pbx_builtin_setvar_helper(chan, "RECORDED_FILE", tmp);
 	} else
-		ast_copy_string(tmp, filename, sizeof(tmp));
+		ast_copy_string(tmp, args.filename, sizeof(tmp));
 	/* end of routine mentioned */
-	
-	
-	
+
 	if (chan->_state != AST_STATE_UP) {
-		if (option_skip) {
+		if (ast_test_flag(&flags, OPTION_SKIP)) {
 			/* At the user's option, skip if the line is not up */
 			return 0;
-		} else if (!option_noanswer) {
+		} else if (!ast_test_flag(&flags, OPTION_NOANSWER)) {
 			/* Otherwise answer unless we're supposed to record while on-hook */
 			res = ast_answer(chan);
 		}
 	}
-	
+
 	if (res) {
 		ast_log(LOG_WARNING, "Could not answer channel '%s'\n", chan->name);
 		goto out;
 	}
-	
-	if (!option_quiet) {
+
+	if (!ast_test_flag(&flags, OPTION_QUIET)) {
 		/* Some code to play a nice little beep to signify the start of the record operation */
 		res = ast_streamfile(chan, "beep", chan->language);
 		if (!res) {
@@ -240,9 +237,9 @@
 		}
 		ast_stopstream(chan);
 	}
-		
+
 	/* The end of beep code.  Now the recording starts */
-		
+
 	if (silence > 0) {
 		rfmt = chan->readformat;
 		res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
@@ -264,23 +261,23 @@
 		*file++ = '\0';
 	ast_mkdir (dir, 0777);
 
-	flags = option_append ? O_CREAT|O_APPEND|O_WRONLY : O_CREAT|O_TRUNC|O_WRONLY;
-	s = ast_writefile( tmp, ext, NULL, flags , 0, AST_FILE_MODE);
-		
+	ioflags = ast_test_flag(&flags, OPTION_APPEND) ? O_CREAT|O_APPEND|O_WRONLY : O_CREAT|O_TRUNC|O_WRONLY;
+	s = ast_writefile(tmp, ext, NULL, ioflags, 0, AST_FILE_MODE);
+
 	if (!s) {
-		ast_log(LOG_WARNING, "Could not create file %s\n", filename);
+		ast_log(LOG_WARNING, "Could not create file %s\n", args.filename);
 		goto out;
 	}
 
 	if (ast_opt_transmit_silence)
 		silgen = ast_channel_start_silence_generator(chan);
-	
+
 	/* Request a video update */
 	ast_indicate(chan, AST_CONTROL_VIDUPDATE);
-	
+
 	if (maxduration <= 0)
 		maxduration = -1;
-	
+
 	while ((waitres = ast_waitfor(chan, maxduration)) > -1) {
 		if (maxduration > 0) {
 			if (waitres == 0) {
@@ -289,7 +286,7 @@
 			}
 			maxduration = waitres;
 		}
-		
+
 		f = ast_read(chan);
 		if (!f) {
 			res = -1;
@@ -297,13 +294,13 @@
 		}
 		if (f->frametype == AST_FRAME_VOICE) {
 			res = ast_writestream(s, f);
-			
+
 			if (res) {
 				ast_log(LOG_WARNING, "Problem writing frame\n");
 				ast_frfree(f);
 				break;
 			}
-			
+
 			if (silence > 0) {
 				dspsilence = 0;
 				ast_dsp_silence(sildet, f, &dspsilence);
@@ -321,7 +318,7 @@
 			}
 		} else if (f->frametype == AST_FRAME_VIDEO) {
 			res = ast_writestream(s, f);
-			
+
 			if (res) {
 				ast_log(LOG_WARNING, "Problem writing frame\n");
 				ast_frfree(f);
@@ -338,9 +335,9 @@
 		ast_debug(1, "Got hangup\n");
 		res = -1;
 	}
-			
+
 	if (gotsilence) {

[... 1481 lines stripped ...]



More information about the asterisk-commits mailing list