Re: [Asterisk-Users] pattern matching problems

2004-08-31 Thread Adam Goryachev
On Tue, 2004-08-31 at 21:42, Atif Rasheed wrote:
> this is from my extensions.conf, the first three patterns are for
> toll-free numbers, and fourth pattern is for other numbers, where an AGI
> is called for authentication. 
> now when I dial 011448000664327 if falls into the fourth pattern, where
> as it should be matched by the first pattern. Any suggestions
> 
> 1 - exten => _01144800XXX,1,Dial(${MAG}/${EXTEN:3},45,tT)
> 2 - exten => _01144808XXX,1,Dial(${MAG}/${EXTEN:3},45,tT)
> 3 - exten => _01144500XXX,1,Dial(${MAG}/${EXTEN:3},45,tT)
> 
> 4 - exten => _011.,1,AGI(iax.agi)
> 4 - exten => _011.,2,Dial(${MAG}/${EXTEN:3},45,tT)
> 4 - exten => _011.,103,playback(no-service)

This is because asterisk is 'lazy'. It will not take the "first"
matching extension, nor will it take the most specific matching
extension, instead, it will take the least specific extension. This
means, regardless of the number, if it matches 011* then it will always
take that option. The only way to acheive what you want (AFAIK) is like
this:

[blah]
include => foo
include => bar
[foo]
exten => _01144800XXX,1,Dial(${MAG}/${EXTEN:3},45,tT)
exten => _01144808XXX,1,Dial(${MAG/${EXTEN:3},45,tT)
exten => _01144500XXX,1,Dial(${MAG}/${EXTEN:3},45,tT)
[bar]
exten => _011.,1,AGI(iax.agi)
exten => _011.,2,Dial(${MAG}/${EXTEN:3},45,tT)
exten => _011.,103,playback(no-service)

This will force asterisk to look/match extensions in foo before it
attempts to look/match extensions in bar.

Hope this helps (and it is actually correct, try it and see)

Regards,
Adam

___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


RE: [Asterisk-Users] pattern matching problems

2004-08-31 Thread Florian Overkamp
Hi, 

> -Original Message-
> this is from my extensions.conf, the first three patterns are for
> toll-free numbers, and fourth pattern is for other numbers, 
> where an AGI
> is called for authentication. 
> now when I dial 011448000664327 if falls into the fourth 
> pattern, where
> as it should be matched by the first pattern. Any suggestions
> 
> 1 - exten => _01144800XXX,1,Dial(${MAG}/${EXTEN:3},45,tT)
> 2 - exten => _01144808XXX,1,Dial(${MAG}/${EXTEN:3},45,tT)
> 3 - exten => _01144500XXX,1,Dial(${MAG}/${EXTEN:3},45,tT)
> 
> 4 - exten => _011.,1,AGI(iax.agi)
> 4 - exten => _011.,2,Dial(${MAG}/${EXTEN:3},45,tT)
> 4 - exten => _011.,103,playback(no-service)

Better to do it like this:

[mycontext]
Include = numberedcases
Include = othercases

[numberedcases]
exten => _01144800XXX,1,Dial(${MAG}/${EXTEN:3},45,tT)
exten => _01144808XXX,1,Dial(${MAG}/${EXTEN:3},45,tT)
exten => _01144500XXX,1,Dial(${MAG}/${EXTEN:3},45,tT)

[othercases]
exten => _011.,1,AGI(iax.agi)
exten => _011.,2,Dial(${MAG}/${EXTEN:3},45,tT)
exten => _011.,103,playback(no-service)

Included contexts are matched sequentially.

Florian

___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


[Asterisk-Users] pattern matching problems

2004-08-31 Thread Atif Rasheed
this is from my extensions.conf, the first three patterns are for
toll-free numbers, and fourth pattern is for other numbers, where an AGI
is called for authentication. 
now when I dial 011448000664327 if falls into the fourth pattern, where
as it should be matched by the first pattern. Any suggestions

1 - exten => _01144800XXX,1,Dial(${MAG}/${EXTEN:3},45,tT)
2 - exten => _01144808XXX,1,Dial(${MAG}/${EXTEN:3},45,tT)
3 - exten => _01144500XXX,1,Dial(${MAG}/${EXTEN:3},45,tT)

4 - exten => _011.,1,AGI(iax.agi)
4 - exten => _011.,2,Dial(${MAG}/${EXTEN:3},45,tT)
4 - exten => _011.,103,playback(no-service)


thank you
-- 
Atif 

___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users