[Asterisk-Users] regex and gotoif question

arno chnafou666-asterisk at yahoo.fr
Fri Aug 27 11:42:46 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 (like ^[0-9]{3}$, whcih match all 3 digit extensions)
...

Thank you for your help
A



More information about the asterisk-users mailing list