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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 19 18:44:41 CDT 2007


Author: tilghman
Date: Tue Jun 19 18:44:40 2007
New Revision: 70163

URL: http://svn.digium.com/view/asterisk?view=rev&rev=70163
Log:
More conversions from '|' delimiter to ','

Modified:
    team/group/dialplan_aesthetics/apps/app_channelredirect.c
    team/group/dialplan_aesthetics/apps/app_macro.c
    team/group/dialplan_aesthetics/apps/app_page.c
    team/group/dialplan_aesthetics/apps/app_parkandannounce.c
    team/group/dialplan_aesthetics/apps/app_queue.c
    team/group/dialplan_aesthetics/apps/app_readfile.c
    team/group/dialplan_aesthetics/apps/app_record.c
    team/group/dialplan_aesthetics/apps/app_skel.c
    team/group/dialplan_aesthetics/apps/app_softhangup.c
    team/group/dialplan_aesthetics/apps/app_talkdetect.c
    team/group/dialplan_aesthetics/apps/app_url.c
    team/group/dialplan_aesthetics/apps/app_verbose.c
    team/group/dialplan_aesthetics/apps/app_voicemail.c
    team/group/dialplan_aesthetics/apps/app_zapras.c
    team/group/dialplan_aesthetics/channels/chan_local.c
    team/group/dialplan_aesthetics/funcs/func_odbc.c
    team/group/dialplan_aesthetics/main/pbx.c
    team/group/dialplan_aesthetics/pbx/pbx_config.c

Modified: team/group/dialplan_aesthetics/apps/app_channelredirect.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/apps/app_channelredirect.c?view=diff&rev=70163&r1=70162&r2=70163
==============================================================================
--- team/group/dialplan_aesthetics/apps/app_channelredirect.c (original)
+++ team/group/dialplan_aesthetics/apps/app_channelredirect.c Tue Jun 19 18:44:40 2007
@@ -45,7 +45,7 @@
 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";
 
 
@@ -53,8 +53,7 @@
 {
 	int res = -1;
 	struct ast_module_user *u;
-	char *info, *context, *exten, *priority;
-	int prio = 1;
+	char *info;
 	struct ast_channel *chan2 = NULL;
 
 	AST_DECLARE_APP_ARGS(args,
@@ -63,7 +62,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;
 	}
 
@@ -73,7 +72,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;
 	}
 
@@ -83,38 +82,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:
 	ast_module_user_remove(u);
 
 	return res;

Modified: team/group/dialplan_aesthetics/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/apps/app_macro.c?view=diff&rev=70163&r1=70162&r2=70163
==============================================================================
--- team/group/dialplan_aesthetics/apps/app_macro.c (original)
+++ team/group/dialplan_aesthetics/apps/app_macro.c Tue Jun 19 18:44:40 2007
@@ -201,7 +201,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");
 		ast_module_user_remove(u);
@@ -263,7 +263,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: team/group/dialplan_aesthetics/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/apps/app_page.c?view=diff&rev=70163&r1=70162&r2=70163
==============================================================================
--- team/group/dialplan_aesthetics/apps/app_page.c (original)
+++ team/group/dialplan_aesthetics/apps/app_page.c Tue Jun 19 18:44:40 2007
@@ -87,7 +87,7 @@
 {
 	struct ast_module_user *u;
 	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;
@@ -113,9 +113,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: team/group/dialplan_aesthetics/apps/app_parkandannounce.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/apps/app_parkandannounce.c?view=diff&rev=70163&r1=70162&r2=70163
==============================================================================
--- team/group/dialplan_aesthetics/apps/app_parkandannounce.c (original)
+++ team/group/dialplan_aesthetics/apps/app_parkandannounce.c Tue Jun 19 18:44:40 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,20 +77,21 @@
 
 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);
+	);
 	struct ast_module_user *u;
 
 	if (ast_strlen_zero(data)) {
@@ -100,96 +102,52 @@
 	u = ast_module_user_add(chan);
 
 	s = ast_strdupa(data);
-
-	template=strsep(&s,"|");
-	if(! template) {
-		ast_log(LOG_WARNING, "PARK: An announce template must be defined\n");
-		ast_module_user_remove(u);
-		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");
 		ast_module_user_remove(u);
 		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);
-		ast_module_user_remove(u);
-		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);
@@ -206,24 +164,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: team/group/dialplan_aesthetics/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/apps/app_queue.c?view=diff&rev=70163&r1=70162&r2=70163
==============================================================================
--- team/group/dialplan_aesthetics/apps/app_queue.c (original)
+++ team/group/dialplan_aesthetics/apps/app_queue.c Tue Jun 19 18:44:40 2007
@@ -917,11 +917,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)
@@ -3081,7 +3081,7 @@
 			continue;
 
 		cur_ptr = queue_data;
-		while ((member = strsep(&cur_ptr, "|"))) {
+		while ((member = strsep(&cur_ptr, ",|"))) {
 			if (ast_strlen_zero(member))
 				continue;
 

Modified: team/group/dialplan_aesthetics/apps/app_readfile.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/apps/app_readfile.c?view=diff&rev=70163&r1=70162&r2=70163
==============================================================================
--- team/group/dialplan_aesthetics/apps/app_readfile.c (original)
+++ team/group/dialplan_aesthetics/apps/app_readfile.c Tue Jun 19 18:44:40 2007
@@ -70,7 +70,7 @@
 	s = ast_strdupa(data);
 
 	varname = strsep(&s, "=");
-	file = strsep(&s, "|");
+	file = strsep(&s, ",");
 	length = s;
 
 	if (!varname || !file) {

Modified: team/group/dialplan_aesthetics/apps/app_record.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/apps/app_record.c?view=diff&rev=70163&r1=70162&r2=70163
==============================================================================
--- team/group/dialplan_aesthetics/apps/app_record.c (original)
+++ team/group/dialplan_aesthetics/apps/app_record.c Tue Jun 19 18:44:40 2007
@@ -74,18 +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 *vdata, *p;
+	char *ext = NULL, *opts[0];
+	char *parse;
 	int i = 0;
 	char tmp[256];
 
-	struct ast_filestream *s = '\0';
+	struct ast_filestream *s = NULL;
 	struct ast_module_user *u;
 	struct ast_frame *f = NULL;
 	
@@ -96,15 +113,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 */
@@ -114,21 +134,17 @@
 
 	u = ast_module_user_add(chan);
 
-	/* 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++;
@@ -139,52 +155,36 @@
 		ast_module_user_remove(u);
 		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;
 
@@ -213,28 +213,26 @@
 		} 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 */
 			ast_module_user_remove(u);
 			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) {
@@ -244,9 +242,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);
@@ -263,25 +261,25 @@
 		}
 		ast_dsp_set_threshold(sildet, 256);
 	} 
-		
-		
-	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) {
@@ -290,7 +288,7 @@
 			}
 			maxduration = waitres;
 		}
-		
+
 		f = ast_read(chan);
 		if (!f) {
 			res = -1;
@@ -298,13 +296,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);
@@ -322,7 +320,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);
@@ -339,9 +337,9 @@
 		ast_debug(1, "Got hangup\n");
 		res = -1;
 	}
-			
+
 	if (gotsilence) {
-		ast_stream_rewind(s, silence-1000);
+		ast_stream_rewind(s, silence - 1000);
 		ast_truncstream(s);
 	} else if (!gottimeout) {
 		/* Strip off the last 1/4 second of it */
@@ -352,8 +350,8 @@
 
 	if (silgen)
 		ast_channel_stop_silence_generator(chan, silgen);
-	
- out:
+
+out:
 	if ((silence > 0) && rfmt) {
 		res = ast_set_read_format(chan, rfmt);
 		if (res)

Modified: team/group/dialplan_aesthetics/apps/app_skel.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/apps/app_skel.c?view=diff&rev=70163&r1=70162&r2=70163
==============================================================================
--- team/group/dialplan_aesthetics/apps/app_skel.c (original)
+++ team/group/dialplan_aesthetics/apps/app_skel.c Tue Jun 19 18:44:40 2007
@@ -85,7 +85,7 @@
 	);
 
 	if (ast_strlen_zero(data)) {
-		ast_log(LOG_WARNING, "%s requires an argument (dummy|[options])\n", app);
+		ast_log(LOG_WARNING, "%s requires an argument (dummy[,options])\n", app);
 		return -1;
 	}
 

Modified: team/group/dialplan_aesthetics/apps/app_softhangup.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/apps/app_softhangup.c?view=diff&rev=70163&r1=70162&r2=70163
==============================================================================
--- team/group/dialplan_aesthetics/apps/app_softhangup.c (original)
+++ team/group/dialplan_aesthetics/apps/app_softhangup.c Tue Jun 19 18:44:40 2007
@@ -41,10 +41,11 @@
 #include "asterisk/pbx.h"
 #include "asterisk/module.h"
 #include "asterisk/lock.h"
+#include "asterisk/app.h"
 
 static char *synopsis = "Soft Hangup Application";
 
-static char *desc = "  SoftHangup(Technology/resource|options)\n"
+static char *desc = "SoftHangup(Technology/resource[,options])\n"
 "Hangs up the requested channel.  If there are no channels to hangup,\n"
 "the application will report it.\n"
 "- 'options' may contain the following letter:\n"
@@ -52,51 +53,67 @@
 
 static char *app = "SoftHangup";
 
+enum {
+	OPTION_ALL = (1 << 0),
+};
+
+AST_APP_OPTIONS(app_opts,{
+	AST_APP_OPTION('a', OPTION_ALL),
+});
 
 static int softhangup_exec(struct ast_channel *chan, void *data)
 {
 	struct ast_module_user *u;
-	struct ast_channel *c=NULL;
-	char *options, *cut, *cdata, *match;
-	char name[AST_CHANNEL_NAME] = "";
-	int all = 0;
+	struct ast_channel *c = NULL;
+	char *cut, *opts[0];
+	char name[AST_CHANNEL_NAME] = "", *parse;
+	struct ast_flags flags;
+	int lenmatch;
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(channel);
+		AST_APP_ARG(options);
+	);
 	
 	if (ast_strlen_zero(data)) {
-                ast_log(LOG_WARNING, "SoftHangup requires an argument (Technology/resource)\n");
+		ast_log(LOG_WARNING, "SoftHangup requires an argument (Technology/resource)\n");
 		return 0;
 	}
-	
+
 	u = ast_module_user_add(chan);
 
-	cdata = ast_strdupa(data);
-	match = strsep(&cdata, "|");
-	options = strsep(&cdata, "|");
-	all = options && strchr(options,'a');
-	c = ast_channel_walk_locked(NULL);
-	while (c) {
+	parse = ast_strdupa(data);
+	AST_STANDARD_APP_ARGS(args, parse);
+
+	if (args.argc == 2)
+		ast_app_parse_options(app_opts, &flags, opts, args.options);
+	lenmatch = strlen(args.channel);
+
+	for (c = ast_walk_channel_by_name_prefix_locked(NULL, args.channel, lenmatch);
+		 c;
+		 c = ast_walk_channel_by_name_prefix_locked(c, args.channel, lenmatch)) {
 		ast_copy_string(name, c->name, sizeof(name));
-		ast_mutex_unlock(&c->lock);
-		/* XXX watch out, i think it is wrong to access c-> after unlocking! */
-		if (all) {
+		if (ast_test_flag(&flags, OPTION_ALL)) {
 			/* CAPI is set up like CAPI[foo/bar]/clcnt */ 
 			if (!strcmp(c->tech->type, "CAPI")) 
-				cut = strrchr(name,'/');
+				cut = strrchr(name, '/');
 			/* Basically everything else is Foo/Bar-Z */
 			else
-				cut = strchr(name,'-');
+				cut = strchr(name, '-');
 			/* Get rid of what we've cut */
 			if (cut)
 				*cut = 0;
 		}
-		if (!strcasecmp(name, match)) {
-			ast_log(LOG_WARNING, "Soft hanging %s up.\n",c->name);
+		if (!strcasecmp(name, args.channel)) {
+			ast_log(LOG_WARNING, "Soft hanging %s up.\n", c->name);
 			ast_softhangup(c, AST_SOFTHANGUP_EXPLICIT);
-			if(!all)
+			if (!ast_test_flag(&flags, OPTION_ALL)) {
+				ast_mutex_unlock(&c->lock);
 				break;
+			}
 		}
-		c = ast_channel_walk_locked(c);
+		ast_mutex_unlock(&c->lock);
 	}
-	
+
 	ast_module_user_remove(u);
 
 	return 0;

Modified: team/group/dialplan_aesthetics/apps/app_talkdetect.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/apps/app_talkdetect.c?view=diff&rev=70163&r1=70162&r2=70163
==============================================================================
--- team/group/dialplan_aesthetics/apps/app_talkdetect.c (original)
+++ team/group/dialplan_aesthetics/apps/app_talkdetect.c Tue Jun 19 18:44:40 2007
@@ -43,6 +43,7 @@
 #include "asterisk/utils.h"
 #include "asterisk/dsp.h"
 #include "asterisk/options.h"
+#include "asterisk/app.h"
 
 static char *app = "BackgroundDetect";
 
@@ -65,17 +66,21 @@
 	int res = 0;
 	struct ast_module_user *u;
 	char *tmp;
-	char *options;
-	char *stringp;
 	struct ast_frame *fr;
-	int notsilent=0;
+	int notsilent = 0;
 	struct timeval start = { 0, 0};
 	int sil = 1000;
 	int min = 100;
 	int max = -1;
 	int x;
 	int origrformat=0;
-	struct ast_dsp *dsp;
+	struct ast_dsp *dsp = NULL;
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(filename);
+		AST_APP_ARG(silence);
+		AST_APP_ARG(min);
+		AST_APP_ARG(max);
+	);
 	
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "BackgroundDetect requires an argument (filename)\n");
@@ -85,118 +90,112 @@
 	u = ast_module_user_add(chan);
 
 	tmp = ast_strdupa(data);
-
-	stringp=tmp;
-	strsep(&stringp, "|");
-	options = strsep(&stringp, "|");
-	if (options) {
-		if ((sscanf(options, "%d", &x) == 1) && (x > 0))
-			sil = x;
-		options = strsep(&stringp, "|");
-		if (options) {
-			if ((sscanf(options, "%d", &x) == 1) && (x > 0))
-				min = x;
-			options = strsep(&stringp, "|");
-			if (options) {
-				if ((sscanf(options, "%d", &x) == 1) && (x > 0))
-					max = x;
+	AST_STANDARD_APP_ARGS(args, tmp);
+
+	if ((sscanf(args.silence, "%d", &x) == 1) && (x > 0))
+		sil = x;
+	if ((sscanf(args.min, "%d", &x) == 1) && (x > 0))
+		min = x;
+	if ((sscanf(args.max, "%d", &x) == 1) && (x > 0))
+		max = x;
+
+	ast_debug(1, "Preparing detect of '%s', sil=%d, min=%d, max=%d\n", args.filename, sil, min, max);
+	do {
+		if (chan->_state != AST_STATE_UP) {
+			if ((res = ast_answer(chan)))
+				break;
+		}
+
+		origrformat = chan->readformat;
+		if ((ast_set_read_format(chan, AST_FORMAT_SLINEAR))) {
+			ast_log(LOG_WARNING, "Unable to set read format to linear!\n");
+			res = -1;
+			break;
+		}
+
+		if (!(dsp = ast_dsp_new())) {
+			ast_log(LOG_WARNING, "Unable to allocate DSP!\n");
+			res = -1;
+			break;
+		}
+		ast_stopstream(chan);
+		if (ast_streamfile(chan, tmp, chan->language)) {
+			ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char *)data);
+			break;
+		}
+
+		while (chan->stream) {
+			res = ast_sched_wait(chan->sched);
+			if ((res < 0) && !chan->timingfunc) {
+				res = 0;
+				break;
 			}
-		}
-	}
-	ast_debug(1, "Preparing detect of '%s', sil=%d,min=%d,max=%d\n", tmp, sil, min, max);
-	if (chan->_state != AST_STATE_UP) {
-		/* Otherwise answer unless we're supposed to send this while on-hook */
-		res = ast_answer(chan);
-	}
-	if (!res) {
-		origrformat = chan->readformat;
-		if ((res = ast_set_read_format(chan, AST_FORMAT_SLINEAR))) 
-			ast_log(LOG_WARNING, "Unable to set read format to linear!\n");
-	}
-	if (!(dsp = ast_dsp_new())) {
-		ast_log(LOG_WARNING, "Unable to allocate DSP!\n");
-		res = -1;
-	}
-	if (!res) {
+			if (res < 0)
+				res = 1000;
+			res = ast_waitfor(chan, res);
+			if (res < 0) {
+				ast_log(LOG_WARNING, "Waitfor failed on %s\n", chan->name);
+				break;
+			} else if (res > 0) {
+				fr = ast_read(chan);
+				if (!fr) {
+					res = -1;
+					break;
+				} else if (fr->frametype == AST_FRAME_DTMF) {
+					char t[2];
+					t[0] = fr->subclass;
+					t[1] = '\0';
+					if (ast_canmatch_extension(chan, chan->context, t, 1, chan->cid.cid_num)) {
+						/* They entered a valid  extension, or might be anyhow */
+						res = fr->subclass;
+						ast_frfree(fr);
+						break;
+					}
+				} else if ((fr->frametype == AST_FRAME_VOICE) && (fr->subclass == AST_FORMAT_SLINEAR)) {
+					int totalsilence;
+					int ms;
+					res = ast_dsp_silence(dsp, fr, &totalsilence);
+					if (res && (totalsilence > sil)) {
+						/* We've been quiet a little while */
+						if (notsilent) {
+							/* We had heard some talking */
+							ms = ast_tvdiff_ms(ast_tvnow(), start);
+							ms -= sil;
+							if (ms < 0)
+								ms = 0;
+							if ((ms > min) && ((max < 0) || (ms < max))) {
+								char ms_str[10];
+								ast_debug(1, "Found qualified token of %d ms\n", ms);
+
+								/* Save detected talk time (in milliseconds) */ 
+								sprintf(ms_str, "%d", ms );	
+								pbx_builtin_setvar_helper(chan, "TALK_DETECTED", ms_str);
+
+								ast_goto_if_exists(chan, chan->context, "talk", 1);
+								res = 0;
+								ast_frfree(fr);
+								break;
+							} else {
+								ast_debug(1, "Found unqualified token of %d ms\n", ms);
+							}
+							notsilent = 0;
+						}
+					} else {
+						if (!notsilent) {
+							/* Heard some audio, mark the begining of the token */
+							start = ast_tvnow();
+							ast_debug(1, "Start of voice token!\n");
+							notsilent = 1;
+						}
+					}
+				}
+				ast_frfree(fr);
+			}
+			ast_sched_runq(chan->sched);
+		}
 		ast_stopstream(chan);
-		res = ast_streamfile(chan, tmp, chan->language);
-		if (!res) {
-			while(chan->stream) {
-				res = ast_sched_wait(chan->sched);
-				if ((res < 0) && !chan->timingfunc) {
-					res = 0;
-					break;
-				}
-				if (res < 0)
-					res = 1000;
-				res = ast_waitfor(chan, res);
-				if (res < 0) {
-					ast_log(LOG_WARNING, "Waitfor failed on %s\n", chan->name);
-					break;
-				} else if (res > 0) {
-					fr = ast_read(chan);
-					if (!fr) {
-						res = -1;
-						break;
-					} else if (fr->frametype == AST_FRAME_DTMF) {
-						char t[2];
-						t[0] = fr->subclass;
-						t[1] = '\0';
-						if (ast_canmatch_extension(chan, chan->context, t, 1, chan->cid.cid_num)) {
-							/* They entered a valid  extension, or might be anyhow */
-							res = fr->subclass;
-							ast_frfree(fr);
-							break;
-						}
-					} else if ((fr->frametype == AST_FRAME_VOICE) && (fr->subclass == AST_FORMAT_SLINEAR)) {
-						int totalsilence;
-						int ms;
-						res = ast_dsp_silence(dsp, fr, &totalsilence);
-						if (res && (totalsilence > sil)) {
-							/* We've been quiet a little while */
-							if (notsilent) {
-								/* We had heard some talking */
-								ms = ast_tvdiff_ms(ast_tvnow(), start);
-								ms -= sil;
-								if (ms < 0)
-									ms = 0;
-								if ((ms > min) && ((max < 0) || (ms < max))) {
-									char ms_str[10];
-									ast_debug(1, "Found qualified token of %d ms\n", ms);
-
-									/* Save detected talk time (in milliseconds) */ 
-									sprintf(ms_str, "%d", ms );	
-									pbx_builtin_setvar_helper(chan, "TALK_DETECTED", ms_str);
-									
-									ast_goto_if_exists(chan, chan->context, "talk", 1);
-									res = 0;
-									ast_frfree(fr);
-									break;
-								} else {
-									ast_debug(1, "Found unqualified token of %d ms\n", ms);
-								}
-								notsilent = 0;
-							}
-						} else {
-							if (!notsilent) {
-								/* Heard some audio, mark the begining of the token */
-								start = ast_tvnow();
-								ast_debug(1, "Start of voice token!\n");
-								notsilent = 1;
-							}
-						}
-						
-					}
-					ast_frfree(fr);
-				}
-				ast_sched_runq(chan->sched);
-			}
-			ast_stopstream(chan);
-		} else {
-			ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char *)data);
-			res = 0;
-		}
-	}
+	} while (0);
+
 	if (res > -1) {
 		if (origrformat && ast_set_read_format(chan, origrformat)) {
 			ast_log(LOG_WARNING, "Failed to restore read format for %s to %s\n", 

Modified: team/group/dialplan_aesthetics/apps/app_url.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/apps/app_url.c?view=diff&rev=70163&r1=70162&r2=70163
==============================================================================
--- team/group/dialplan_aesthetics/apps/app_url.c (original)
+++ team/group/dialplan_aesthetics/apps/app_url.c Tue Jun 19 18:44:40 2007
@@ -42,6 +42,7 @@
 #include "asterisk/translate.h"
 #include "asterisk/image.h"
 #include "asterisk/options.h"
+#include "asterisk/app.h"
 
 static char *app = "SendURL";
 
@@ -56,23 +57,33 @@
 "    NOLOAD        Client failed to load URL (wait enabled)\n"
 "    UNSUPPORTED   Channel does not support URL transport\n"
 "\n"
-"If the option 'wait' is specified, execution will wait for an\n"
+"If the option 'w' is specified, execution will wait for an\n"
 "acknowledgement that the URL has been loaded before continuing\n"
 "\n"
 "SendURL continues normally if the URL was sent correctly or if the channel\n"
 "does not support HTML transport.  Otherwise, the channel is hung up.\n";
 
+enum {
+	OPTION_WAIT = (1 << 0),
+} option_flags;
+
+AST_APP_OPTIONS(app_opts,{
+	AST_APP_OPTION('w', OPTION_WAIT),
+});
 
 static int sendurl_exec(struct ast_channel *chan, void *data)
 {
 	int res = 0;
 	struct ast_module_user *u;
 	char *tmp;
-	char *options;
-	int local_option_wait=0;
 	struct ast_frame *f;
-	char *stringp=NULL;
 	char *status = "FAILURE";
+	char *opts[0];
+	struct ast_flags flags;
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(url);
+		AST_APP_ARG(options);
+	);
 	
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "SendURL requires an argument (URL)\n");
@@ -84,11 +95,9 @@
 
 	tmp = ast_strdupa(data);
 
-	stringp=tmp;
-	strsep(&stringp, "|");
-	options = strsep(&stringp, "|");
-	if (options && !strcasecmp(options, "wait"))
-		local_option_wait = 1;
+	AST_STANDARD_APP_ARGS(args, tmp);
+	if (args.argc == 2)
+		ast_app_parse_options(app_opts, &flags, opts, args.options);
 	
 	if (!ast_channel_supports_html(chan)) {
 		/* Does not support transport */
@@ -96,14 +105,14 @@
 		ast_module_user_remove(u);
 		return 0;
 	}
-	res = ast_channel_sendurl(chan, tmp);
+	res = ast_channel_sendurl(chan, args.url);
 	if (res == -1) {
 		pbx_builtin_setvar_helper(chan, "SENDURLSTATUS", "FAILURE");
 		ast_module_user_remove(u);
 		return res;
 	}
 	status = "SUCCESS";
-	if (local_option_wait) {
+	if (ast_test_flag(&flags, OPTION_WAIT)) {
 		for(;;) {
 			/* Wait for an event */
 			res = ast_waitfor(chan, -1);
@@ -125,7 +134,7 @@
 					break;
 				case AST_HTML_NOSUPPORT:
 					/* Does not support transport */
-					status ="UNSUPPORTED";
+					status = "UNSUPPORTED";
 					res = 0;
 					ast_frfree(f);
 					goto out;
@@ -148,7 +157,6 @@
 	int res;
 
 	res = ast_unregister_application(app);
-	
 	ast_module_user_hangup_all();
 
 	return res;	

Modified: team/group/dialplan_aesthetics/apps/app_verbose.c
URL: http://svn.digium.com/view/asterisk/team/group/dialplan_aesthetics/apps/app_verbose.c?view=diff&rev=70163&r1=70162&r2=70163
==============================================================================
--- team/group/dialplan_aesthetics/apps/app_verbose.c (original)
+++ team/group/dialplan_aesthetics/apps/app_verbose.c Tue Jun 19 18:44:40 2007
@@ -38,58 +38,65 @@
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
 #include "asterisk/module.h"
+#include "asterisk/app.h"
 
 static char *app_verbose = "Verbose";
 static char *verbose_synopsis = "Send arbitrary text to verbose output";
 static char *verbose_descrip =
-"Verbose([<level>|]<message>)\n"
+"Verbose([<level>,]<message>)\n"
 "  level must be an integer value.  If not specified, defaults to 0.\n";
 
 static char *app_log = "Log";
 static char *log_synopsis = "Send arbitrary text to a selected log level";
 static char *log_descrip =
-"Log(<level>|<message>)\n"
+"Log(<level>,<message>)\n"
 "  level must be one of ERROR, WARNING, NOTICE, DEBUG, VERBOSE, DTMF\n";
 
 
 static int verbose_exec(struct ast_channel *chan, void *data)
 {
-	char *vtext;
 	int vsize;
 	struct ast_module_user *u;
+	char *parse;
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(level);
+		AST_APP_ARG(msg);
+	);
 
 	u = ast_module_user_add(chan);
 
-	if (data) {
-		char *tmp;
-		vtext = ast_strdupa(data);
-		tmp = strsep(&vtext, "|");
-		if (vtext) {
-			if (sscanf(tmp, "%d", &vsize) != 1) {
-				vsize = 0;
-				ast_log(LOG_WARNING, "'%s' is not a verboser number\n", vtext);
-			}
-		} else {
-			vtext = tmp;
-			vsize = 0;
-		}
-		if (option_verbose >= vsize) {
-			switch (vsize) {
-			case 0:
-				ast_verbose("%s\n", vtext);
-				break;
-			case 1:
-				ast_verbose(VERBOSE_PREFIX_1 "%s\n", vtext);
-				break;
-			case 2:
-				ast_verbose(VERBOSE_PREFIX_2 "%s\n", vtext);
-				break;
-			case 3:
-				ast_verbose(VERBOSE_PREFIX_3 "%s\n", vtext);
-				break;
-			default:

[... 229 lines stripped ...]



More information about the asterisk-commits mailing list