diff options
-rwxr-xr-x | configs/extensions.conf.sample | 12 | ||||
-rwxr-xr-x | pbx/pbx_config.c | 10 |
2 files changed, 17 insertions, 5 deletions
diff --git a/configs/extensions.conf.sample b/configs/extensions.conf.sample index b0018fa6c..afee2996a 100755 --- a/configs/extensions.conf.sample +++ b/configs/extensions.conf.sample @@ -67,7 +67,9 @@ TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0) ; the previous priority was associated with the current extension or not. ; The priority "same" or "s" means the same as the previously specified ; priority, again regardless of whether the previous entry was for the -; same extension. Priorities may also have an alias, or label, in +; same extension. Priorities may be immediately followed by a plus sign +; and another integer to add that amount (most useful with 's' or 'n'). +; Priorities may then also have an alias, or label, in ; parenthesis after their name which can be used in goto situations ; ; Contexts contain several lines, one for each step of each @@ -78,8 +80,8 @@ TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0) ; they are listed. ; ;[context] -;exten => someexten,priority,application(arg1,arg2,...) -;exten => someexten,priority,application,arg1|arg2... +;exten => someexten,priority[+offset][(alias)],application(arg1,arg2,...) +;exten => someexten,priority[+offset][(alias)],application,arg1|arg2... ; ; Timing list for includes is ; @@ -313,7 +315,9 @@ include => demo ;exten => 6245,hint,SIP/Grandstream1&SIP/Xlite1 ; Channel hints for presence ;exten => 6245,1,Dial(SIP/Grandstream1,20,rt) ; permit transfer -;exten => 6245,1,Dial(${HINT},20,rtT) ; Use hint as listed +;exten => 6245,n,Dial(${HINT},20,rtT) ; Use hint as listed +;exten => 6245,n,Voicemail(u6245) ; Voicemail (unavailable) +;exten => 6245,s+100,Voicemail(b6245) ; Voicemail (busy) ;exten => 6361,1,Dial(IAX2/JaneDoe,,rm) ; ring without time limit ;exten => 6389,1,Dial(MGCP/aaln/1@192.168.0.14) ;exten => 6394,1,Dial(Local/6275/n) ; this will dial ${MARK} diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index 6cac835a7..a6286c0a7 100755 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -1649,6 +1649,7 @@ static int pbx_load_module(void) char *stringp=NULL; int ipri = -2; char realext[256]=""; + char *plus; tc = strdup(v->value); if(tc!=NULL){ stringp=tc; @@ -1668,6 +1669,11 @@ static int pbx_load_module(void) else ast_log(LOG_WARNING, "Label missing trailing ')' at line %d\n", v->lineno); } + plus = strchr(pri, '+'); + if (plus) { + *plus = '\0'; + plus++; + } if (!strcmp(pri,"hint")) ipri=PRIORITY_HINT; else if (!strcmp(pri, "next") || !strcmp(pri, "n")) { @@ -1680,7 +1686,7 @@ static int pbx_load_module(void) ipri = lastpri; else ast_log(LOG_WARNING, "Can't use 'same' priority on the first entry!\n"); - } else { + } else { if (sscanf(pri, "%i", &ipri) != 1) { ast_log(LOG_WARNING, "Invalid priority '%s' at line %d\n", pri, v->lineno); ipri = 0; @@ -1722,6 +1728,8 @@ static int pbx_load_module(void) while(*appl && (*appl < 33)) appl++; pbx_substitute_variables_helper(NULL, ext, realext, sizeof(realext) - 1); if (ipri) { + if (plus) + ipri += atoi(plus); lastpri = ipri; if (ast_add_extension2(con, 0, realext, ipri, label, cidmatch, appl, strdup(data), FREE, registrar)) { ast_log(LOG_WARNING, "Unable to register extension at line %d\n", v->lineno); |