Kudos Jared for citing a good example. At least now I see
that there is
at least one practical application of this methodology.
IMHO, I wouldn't recommend building a dialplan that way
because it is
pretty ambiguous to someone that doesn't understand the
inner workings
of Asterisk pattern matching.
Indeed, I admit that had you given me that example and asked
me which
pattern would match I would not have been able to say with
certainty how
it would work.
As a practical example, I prefer to do dial plans this way:
[class1] ; lobby
include => local
include => toll-free
include => block-ld
include => block-int
include => no-sex
[class2] ; secretary
include => local
include => toll-free
include => long-distance
include => block-int
include => no-sex
[class3] ; CEO
include => local
include => toll-free
include => long-distance
include => international
include => sex
[local]
include => convert-to-local
exten => _NXXXXXX,1,Dial(IAX2/some_itsp/$) ;
seven-digit local
exten => _NXXNXXXXXX,1,Dial(IAX2/some_itsp/$) ;
ten-digit local
[toll-free]
exten => _1800NXXXXXX,1,Dial(IAX2/some_itsp/$) ;
800 toll free
exten => _1888NXXXXXX,1,Dial(IAX2/some_itsp/$) ;
888 toll free
exten => _1877NXXXXXX,1,Dial(IAX2/some_itsp/$) ;
877 toll free
exten => _1866NXXXXXX,1,Dial(IAX2/some_itsp/$) ;
866 toll free
[long-distance]
exten => _1NXXNXXXXXX,1,Dial(IAX2/some_itsp/$) ;
allow ld calls
[international]
exten => _011.,1,Dial(IAX2/some_itsp/$) ; allow
int. calls
[sex]
exten => _1900NXXXXXX,1,Dial(IAX2/some_itsp/$) ;
allow int. calls
[block-ld]
exten =>
_1NXXNXXXXXX,1,Playback(this-call-is-not-allowed,n) ; block
ld
exten => _1NXXNXXXXXX,n,Congestion(5)
exten => _1NXXNXXXXXX,n,Hangup()
[block-int]
exten => _011.,1,Playback(this-call-is-not-allowed,n) ;
block int'l
exten => _011.,n,Congestion(5)
exten => _011.,n,Hangup()
[no-sex]
exten =>
_1900NXXXXXX,1,Playback(this-call-is-not-allowed,n) ; block
900
exten => _1900NXXXXXX,n,Congestion(5)
exten => _1900NXXXXXX,n,Hangup()
[convert-to-local]
exten => _1555222XXXX,1,Dial(IAX2/some_itsp/${EXTEN:4})
exten => _1555223XXXX,1,Dial(IAX2/some_itsp/${EXTEN:4})
exten => _1555224XXXX,1,Dial(IAX2/some_itsp/${EXTEN:4})
... etc...
----
With a quick look you can tell how the calls will route for
each of the
kinds of phones. I admit that it's a bit longer and
"readability" is
purely a subjective thing.
My point is simply that this example doesn't work with the
existing
system. "convert-to-local" never matches because
"long-distance" is
always a higher priority.
A while back there was a thread regarding implementing a
type of regexp
matching and as part of that work there might be some
optimization of
matching as well. If that work ever makes it in then it
would seem to
make sense to reevaluate the priority matching system as
well.
Thanks to all for the feedback on this topic.
John
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.c
om--
asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-dev
|