[Asterisk-Users] match a set of numbers in GoToIf against a variable

Samy Antoun samyantoun at yahoo.com
Fri Oct 14 17:26:05 MST 2005


--- John Millican <john at millican.us> wrote:
> Hello all,
> Okay when you are done laughing at the simplicity of
> this question could 
> someone show me please what I have wrong in the
> following statement?
> GoToIf($[${numdial} != [1-9] ]?15:3);
> What this is supposed to do is if numdial is not a
> single digit from 1 to 9 
> inclusive goto 15, if it is a singledigit from 1 to
> 9 inclusive goto 3.  
> Should be pretty simple but not working for me,
> always goes to 15.  from what 
> I read on the wiki this should work, but obviously I
> must have read it wrong.
> 
> I can get this to work:
> exten => 1,2, GoToIf($[${numdial} = 1 ]?15:3);
> exten => 1,3, GoToIf($[${numdial} = 2 ]?15:4);
> exten => 1,4 ,GoToIf($[${numdial} = 3 ]?15:5);
> ...
> exten => 1,15, do other stuff
> but I don't want to put this in 9 times.
> 
> Thanks in advance,
> John M

John,

Will this meet your needs:

exten => _Z,1,Will match any single digit from 1 to 9
exten => i,1,will match enything else (invalid)



		
__________________________________ 
Start your day with Yahoo! - Make it your home page! 
http://www.yahoo.com/r/hs



More information about the asterisk-users mailing list