List Info

Thread: new priority of pattern matching in 1.4. Does it makes sense?




new priority of pattern matching in 1.4. Does it makes sense?
country flaguser name
Canada
2008-02-20 15:52:51
I know this has been raised as a thread before but the more
I experience
it the more confused and frustrated I become. I must be
missing
something...

In 1.4 the priority of matching dial strings changed from
"best match"
to "best local match -> best included-match".

In other words, in 1.2, all patterns were given equal weight
regardless
if they were part of an include or not, and then the closest
exact match
was used.

In 1.4, only non-included patterns are evaluated and if, and
only if
there is absolutely no match found, then included patterns
are
evaluated.

Can someone please explain what purpose this serves or why
this is an
improvement? I can't think of a single example of how this
could be used
in practice.

Far from being an improvement this change has caused our
dialplans to be
much messier and inefficient. I'll try and give a brief
example and
maybe someone can explain how this can be done with 1.4.

In a situation where you have many classes of users, many
sections of
the dialplans for these users will be identical with only
minor
differences (perhaps for different outbound trunking).

e.g.

; Class 1 users uses 2 cheap SIP and IAX proviers for
; long distance but uses the PRI for local calls.
[class1]
include => local_calls
exten => _1555NXXXXXX,1,Dial(SIP/$provider1)
exten => _1NXXNXXXXXX,1,Dial(iax2/2195provider2/$)
exten => _011.,2,Dial(iax2/1234provider2/$)
include => toll_free

; Class 2 uses cheap provider for international but use PRI
for
; all other calls.
[class2]
include => local_calls
exten => _1555NXXXXXX,1,Dial($/$)
exten => _1NXXNXXXXXX,1,Dial($/$)
exten => _011.,2,Dial(iax2/1234provider2/$)
include => toll_free

; in all cases we want to send toll free through the PRI
[toll_free]
exten => _1800NXXXXXX,1,Dial($/$)
exten => _1888NXXXXXX,1,Dial($/$)
exten => _1877NXXXXXX,1,Dial($/$)
exten => _1866NXXXXXX,1,Dial($/$)
exten => _1855NXXXXXX,1,Dial($/$)

; In all cases we want to send local calls to the PRI so
just in case
; the user accidentally dialed a local call as a long
distance call,
; we try and match all local area codes and exchanges
[local_calls]
exten => _1555940XXXX,1,Dial($/${EXTEN:4})
exten => _1555941XXXX,1,Dial($/${EXTEN:4})
exten => _1555942XXXX,1,Dial($/${EXTEN:4})
exten => _1555943XXXX,1,Dial($/${EXTEN:4})
.
.
.
.
.
.. insert 190 other local exchanges here ...

------

In the above example, the "toll_free" and
"local_calls" contexts NEVER
match anything because the less precise
"_1NXXNXXXXXX" pattern is in a
higher context and therefore matches everything.

The only way to make this work is to duplicate the entire
"toll_free"
and "local_calls" context (which is nearly 200
lines long) for every
class of user or put the "toll_free" and
"local_calls" into separate
files (without the context identifiers) and then
"#include" them.

What am I missing here? How can this less-precise,
prioritized pattern
matching ever be used?

John Lange



_______________________________________________
--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

Re: new priority of pattern matching in 1.4. Does it makes sense?
country flaguser name
United Kingdom
2008-02-21 08:48:21
In article <1203544372.4319.102.camelibmlaptop.darkcore.net>,
John Lange <john.langeopen-it.ca> wrote:
> [...]
> Far from being an improvement this change has caused
our dialplans to be
> much messier and inefficient. I'll try and give a brief
example and
> maybe someone can explain how this can be done with
1.4.
> 
> In a situation where you have many classes of users,
many sections of
> the dialplans for these users will be identical with
only minor
> differences (perhaps for different outbound trunking).

I think include sections are searched in the order they are
specified,
so put the class-specific rules into their own context for
each class,
and include that context after the more specific ones.

> e.g.
> 
> ; Class 1 users uses 2 cheap SIP and IAX proviers for
> ; long distance but uses the PRI for local calls.
> [class1]
> include => local_calls
> exten => _1555NXXXXXX,1,Dial(SIP/$provider1)
> exten => _1NXXNXXXXXX,1,Dial(iax2/2195provider2/$)
> exten => _011.,2,Dial(iax2/1234provider2/$)
> include => toll_free

[class1]
include => local_calls
include => toll_free
include => class1_rules

[class1_rules]
exten => _1555NXXXXXX,1,Dial(SIP/$provider1)
exten => _1NXXNXXXXXX,1,Dial(iax2/2195provider2/$)
exten => _011.,2,Dial(iax2/1234provider2/$)

> ; Class 2 uses cheap provider for international but use
PRI for
> ; all other calls.
> [class2]
> include => local_calls
> exten => _1555NXXXXXX,1,Dial($/$)
> exten => _1NXXNXXXXXX,1,Dial($/$)
> exten => _011.,2,Dial(iax2/1234provider2/$)
> include => toll_free

[class2]
include => local_calls
include => toll_free
include => class2_rules

[class2_rules]
exten => _1555NXXXXXX,1,Dial($/$)
exten => _1NXXNXXXXXX,1,Dial($/$)
exten => _011.,2,Dial(iax2/1234provider2/$)

And so on.

Cheers
Tony
-- 
Tony Mountifield
Work: tonysoftins.co.uk - http://www.softins.co.uk

Play: tonymountifield.org - http://tony.mountifield.o
rg

_______________________________________________
--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

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )