[Asterisk-Users] Using regular expression in dialplan

Selim selimbh at gmail.com
Fri Aug 27 06:05:35 MST 2004


Hi all,

Did anyone manage to make the GotoIf command work with regular expression ?

I would like to make the following thing:

${DTMSeq} contains a menu choice. Only 1, 2 and 3 are allowed menu choices.

If
         DTMFSeq contains 1 or 2 or 3 => OK, Goto 4
else
         Goto 2

I've tried the follwoing syntax but it is alway going to 2 whatever
the value of DTMFSeq:

exten => s,1,GotoIf($[${DTMFSeq} : 123]?4:2)
exten => s,2,SetVar(InvalidCount=$[${InvalidCount} + 1])
....
exten => s,4,SetVar(Result=ok)

The only way I managed to make it work is the following :

exten => s,1,GotoIf($[${DTMFSeq} : 1|2|3]?s|4:s|2)

But I'm not totaly satisfied with it as I'm going to check more
complex regex later ...

Thank you for your help



More information about the asterisk-users mailing list