Maybe I'm daft, but can asterisk to 'or' logic in dialplan matches sort of like the SPA's can? Tollfree numbers for example. I can have a line for each combination: exten => _1800NXXXXXX, Dial, ............ exten => _1866NXXXXXX, Dial, ............ exten => _1877NXXXXXX, Dial, ............ exten => _1888NXXXXXX, Dial, ............ But I want to do is something like this: exten => _18[0678][0678]NXXXXXX, Dial, ............. Or to prevent the logic error which albeit small, the above would create: exten => _18[00,66,77,88:2]NXXXXXX, Dial, ...... (representing that the next 2 chars must equal any of '00'.'66','77' or '88' Is there any syntax that allows this?? dbc.
On 8/18/06, David Cook <dbc_asterisk@advan.ca> wrote:> Maybe I'm daft, but can asterisk to 'or' logic in dialplan matches sort > of like the SPA's can? > > Tollfree numbers for example. I can have a line for each combination: > exten => _1800NXXXXXX, Dial, ............ > exten => _1866NXXXXXX, Dial, ............ > exten => _1877NXXXXXX, Dial, ............ > exten => _1888NXXXXXX, Dial, ............ > > But I want to do is something like this: > exten => _18[0678][0678]NXXXXXX, Dial, .............This syntax is valid and would work for what you're doing, but as you said, there is a chance of logic error in it.> > Or to prevent the logic error which albeit small, the above would create: > exten => _18[00,66,77,88:2]NXXXXXX, Dial, ...... > (representing that the next 2 chars must equal any of '00'.'66','77' or > '88'As for this syntax, Asterisk does not respect the [], so it parses the 66 as the priority. I have no idea how to properly do this in one line if it is possible. Kinsey
Hey David,
Yes, it can, you just have to play around with the logic and what you
are comparing and when you can do the comparison.
Try something like this:
exten => _18XXNXXXXXX,1, NoOP()
exten => _18XXNXXXXXX,n,gotoif("${EXTEN}:2:2" = "00" |
"${EXTEN}:2:2" =
"66" | "${EXTEN}:2:2" = "77" |
"${EXTEN}:2:2" = "88")?TRUE:FALSE
exten => _18XXNXXXXXX,n(TRUE),Dial()
exten => _18XXNXXXXXX,n(FALSE), HangUp()
I'm sure you can take it from there. You can remove the first line with
the NoOP but I normally feel it is good to give an instruction cycle to
Asterisk (and any program) when jumping to another extension (or
function), is it needed, no, but you never know.
Kevin
David Cook wrote:> Maybe I'm daft, but can asterisk to 'or' logic in dialplan
matches
> sort of like the SPA's can?
>
> Tollfree numbers for example. I can have a line for each combination:
> exten => _1800NXXXXXX, Dial, ............
> exten => _1866NXXXXXX, Dial, ............
> exten => _1877NXXXXXX, Dial, ............
> exten => _1888NXXXXXX, Dial, ............
>
> But I want to do is something like this:
> exten => _18[0678][0678]NXXXXXX, Dial, .............
>
> Or to prevent the logic error which albeit small, the above would create:
> exten => _18[00,66,77,88:2]NXXXXXX, Dial, ......
> (representing that the next 2 chars must equal any of
'00'.'66','77'
> or '88'
>
> Is there any syntax that allows this??
>
> dbc.
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users