summaryrefslogtreecommitdiff
path: root/apps/app_channelredirect.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2007-07-23 19:51:41 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2007-07-23 19:51:41 +0000
commit55b1ee298e926c594f45456e5afbc25c79e3889b (patch)
treec9c73917bfd120da30c16650000c7296781fae50 /apps/app_channelredirect.c
parentd8d1b6c8f242dbc1be319ceef5442378a5bda885 (diff)
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). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@76703 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_channelredirect.c')
-rw-r--r--apps/app_channelredirect.c41
1 files changed, 6 insertions, 35 deletions
diff --git a/apps/app_channelredirect.c b/apps/app_channelredirect.c
index 2164521a4..0f654251f 100644
--- a/apps/app_channelredirect.c
+++ b/apps/app_channelredirect.c
@@ -45,15 +45,14 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
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 @@ static int asyncgoto_exec(struct ast_channel *chan, void *data)
);
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 @@ static int asyncgoto_exec(struct ast_channel *chan, void *data)
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 @@ static int asyncgoto_exec(struct ast_channel *chan, void *data)
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;
- }
-
- /* 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;
+ res = ast_parseable_goto(chan2, args.label);
- chanquit:
ast_mutex_unlock(&chan2->lock);
- quit:
+quit:
return res;
}