[asterisk-users] Dialplan regexp

Steve Murphy murf at digium.com
Wed Sep 5 16:46:10 CDT 2007


On Wed, 2007-09-05 at 12:57 -0400, James FitzGibbon wrote:
> On 9/5/07, Adrian Marsh <Adrian.Marsh at ubiquisys.com> wrote:
>         Many thanks for that!!  I didn't know that the order worked
>         quite like
>         that but I see it now... Better go check the other contexts...
>         (the [56][0-9] worked fine).
> 
> You can also impose a finer level of control over the order extensions
> are searched in by putting them in different contexts and using
> "include" to pull them in in a specific order: 
> 
> [foo]
> exten => _017935201[56][0-9],1,Goto(local,${EXTEN:-3},1)
> include => bar
> 
> [bar]
> exten => _0.,1,Set(CALLERID(num)=${PSTN_GLOBAL}${CALLERID(num):-3}) 
> exten => _0.,2,Dial(${TRUNK}/${EXTEN},,W)
> 
> Dialing 01793520158 would match the longer pattern in this case.  The
> search is done in the initial context, then in each included context
> in the order they were included. 
> 
> There's more info here:
> 
> http://www.voip-info.org/wiki/index.php?page=Asterisk+config
> +extensions.conf+sorting
> 

James speaks the truth. Within a single context, the algorithm tries to match 
EVERY POSSIBLE extension. The one that scores the best wins. The more specific
the pattern, the higher the score. So, _0. would lose to _017. if they
both
matched.

If ANY pattern matches, the include path will not be followed.

murf

-- 
Steve Murphy
Software Developer
Digium
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3227 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20070905/5cf404ce/attachment.bin 


More information about the asterisk-users mailing list