mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 16:21:01 +00:00
Allow "n" or "next" and "s" or "same" in dialplan logic priorities
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3885 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -3,9 +3,9 @@
|
|||||||
*
|
*
|
||||||
* Populate and remember extensions from static config file
|
* Populate and remember extensions from static config file
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999, Mark Spencer
|
* Copyright (C) 1999-2004, Digium, Inc.
|
||||||
*
|
*
|
||||||
* Mark Spencer <markster@linux-support.net>
|
* Mark Spencer <markster@digium.com>
|
||||||
*
|
*
|
||||||
* This program is free software, distributed under the terms of
|
* This program is free software, distributed under the terms of
|
||||||
* the GNU General Public License
|
* the GNU General Public License
|
||||||
@@ -1618,6 +1618,7 @@ static int pbx_load_module(void)
|
|||||||
struct ast_context *con;
|
struct ast_context *con;
|
||||||
char *start, *end;
|
char *start, *end;
|
||||||
char realvalue[256];
|
char realvalue[256];
|
||||||
|
int lastpri = -2;
|
||||||
|
|
||||||
cfg = ast_load(config);
|
cfg = ast_load(config);
|
||||||
if (cfg) {
|
if (cfg) {
|
||||||
@@ -1658,7 +1659,17 @@ static int pbx_load_module(void)
|
|||||||
pri="";
|
pri="";
|
||||||
if (!strcmp(pri,"hint"))
|
if (!strcmp(pri,"hint"))
|
||||||
ipri=PRIORITY_HINT;
|
ipri=PRIORITY_HINT;
|
||||||
else {
|
else if (!strcmp(pri, "next") || !strcmp(pri, "n")) {
|
||||||
|
if (lastpri > -2)
|
||||||
|
ipri = lastpri + 1;
|
||||||
|
else
|
||||||
|
ast_log(LOG_WARNING, "Can't use 'next' priority on the first entry!\n");
|
||||||
|
} else if (!strcmp(pri, "same") || !strcmp(pri, "s")) {
|
||||||
|
if (lastpri > -2)
|
||||||
|
ipri = lastpri;
|
||||||
|
else
|
||||||
|
ast_log(LOG_WARNING, "Can't use 'same' priority on the first entry!\n");
|
||||||
|
} else {
|
||||||
if (sscanf(pri, "%i", &ipri) != 1) {
|
if (sscanf(pri, "%i", &ipri) != 1) {
|
||||||
ast_log(LOG_WARNING, "Invalid priority '%s' at line %d\n", pri, v->lineno);
|
ast_log(LOG_WARNING, "Invalid priority '%s' at line %d\n", pri, v->lineno);
|
||||||
ipri = 0;
|
ipri = 0;
|
||||||
@@ -1700,6 +1711,7 @@ static int pbx_load_module(void)
|
|||||||
while(*appl && (*appl < 33)) appl++;
|
while(*appl && (*appl < 33)) appl++;
|
||||||
pbx_substitute_variables_helper(NULL, ext, realext, sizeof(realext) - 1);
|
pbx_substitute_variables_helper(NULL, ext, realext, sizeof(realext) - 1);
|
||||||
if (ipri) {
|
if (ipri) {
|
||||||
|
lastpri = ipri;
|
||||||
if (ast_add_extension2(con, 0, realext, ipri, cidmatch, appl, strdup(data), FREE, registrar)) {
|
if (ast_add_extension2(con, 0, realext, ipri, cidmatch, appl, strdup(data), FREE, registrar)) {
|
||||||
ast_log(LOG_WARNING, "Unable to register extension at line %d\n", v->lineno);
|
ast_log(LOG_WARNING, "Unable to register extension at line %d\n", v->lineno);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user