[asterisk-users] dialplan pattern help

Armand Fumal af at cybernet.lu
Sun Jul 24 03:17:08 CDT 2011


Thanks for the suggestion.
If I have to do this way i will check the AGI side...
Thanks

Armand

-----Message d'origine-----
De : asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] De la part de Leif Madsen
Envoyé : samedi 23 juillet 2011 20:18
À : asterisk-users at lists.digium.com
Objet : Re: [asterisk-users] dialplan pattern help

On 11-07-23 10:30 AM, Armand Fumal wrote:
> Hi all,
> 
> I need help for make a pattern for a special case that i can't find the solution.
> 
> In my case I want to match these in one pattern:
> 
> This is the same ext that can come in 4 cases
> 
> exten => _42704701,1,Macro(dialfax,${EXTEN:-8})		; case with 42704701
> exten => _X42704701,1,Macro(dialfax,${EXTEN:-8})		; case with 042704701
> exten => _XXXX42704701,1,Macro(dialfax,${EXTEN:-8})	; case with +3242704701
> exten => _XXX42704701,1,Macro(dialfax,${EXTEN:-8})		; case with 3242704701
> 
> I have try _.42704701 but the parser stop to check after the point "."    :-(
> 
> So did you have any suggestion ?

Ya you can't match anything after the '.' in pattern matching.

I'm not sure the pattern matcher is really capable of doing what you want here.
The only way to do it really is to match less restrictively and perform a check using dialplan applications/functions, and then if nothing is found, to fall through.

Perhaps something like:


exten => _XXXXXXXXXXX,1,NoOp()
   same => n,ExecIf($["${EXTEN:-8}" = "42704701"]?Macro(dialfax,${EXTEN:-8}))
   same => n,Verbose(2,Did not match -- falling through)
   same => n,Playback(invalid)
   same => n,Hangup()

I'm pretty sure that's the only way you can do it in a single line (the ExecIf() application).

Leif Madsen.

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list