diff options
author | Mark Spencer <markster@digium.com> | 2004-11-19 05:18:10 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2004-11-19 05:18:10 +0000 |
commit | 066d22ae0d710bd21bb59bb7fc802c6d7149d0d5 (patch) | |
tree | 3218a655bec49a3d102c38b69c87a58cb890f010 /pbx.c | |
parent | 1632d45e85e188302b8f3d5270b0a0aba5fe46ba (diff) |
Add incremental/decremental priorities (bug #2906)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4292 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'pbx.c')
-rwxr-xr-x | pbx.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -4939,6 +4939,7 @@ static int pbx_builtin_goto(struct ast_channel *chan, void *data) char *exten, *pri, *context; char *stringp=NULL; int ipri; + int mode = 0; if (!data || ast_strlen_zero(data)) { ast_log(LOG_WARNING, "Goto requires an argument (optional context|optional extension|priority)\n"); @@ -4962,15 +4963,26 @@ static int pbx_builtin_goto(struct ast_channel *chan, void *data) context = NULL; } } + if (*pri == '+') { + mode = 1; + pri++; + } else if (*pri == '-') { + mode = -1; + pri++; + } if (sscanf(pri, "%i", &ipri) != 1) { if ((ipri = ast_findlabel_extension(chan, context ? context : chan->context, (exten && strcasecmp(exten, "BYEXTENSION")) ? exten : chan->exten, pri, chan->cid.cid_num)) < 1) { ast_log(LOG_WARNING, "Priority '%s' must be a number > 0, or valid label\n", pri); return -1; - } + } else + mode = 0; } /* At this point we have a priority and maybe an extension and a context */ - chan->priority = ipri - 1; + if (mode) + chan->priority += mode * ipri - 1; + else + chan->priority = ipri - 1; if (exten && strcasecmp(exten, "BYEXTENSION")) strncpy(chan->exten, exten, sizeof(chan->exten)-1); if (context) |