diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-11-19 05:18:10 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-11-19 05:18:10 +0000 |
commit | 5ac18d709288301a79d9d4af4bbe169df281b9f7 (patch) | |
tree | 3218a655bec49a3d102c38b69c87a58cb890f010 /pbx.c | |
parent | a5d7d250947ab9171aca3cf377c629ba5b52f66a (diff) |
Add incremental/decremental priorities (bug #2906)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4292 f38db490-d61c-443f-a65b-d21fe96a405b
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) |