[Users] How to use script variables in switch-cases?

Bogdan-Andrei Iancu bogdan at voice-system.ro
Mon May 14 11:12:00 CEST 2007


Hi Peter,

the "case" syntax does not accept any variables, but only constant 
values (like in C also :) )

regards,
Bogdan

Peter Lemenkov wrote:
> Hello All!
> I want to do something like this (using svn checkout of OpenSER):
>
> switch ($src_ip)
> {
>  case $var(ip1):
>      # do smth
>      break;
>  case $var(ip2):
>      # do smth
>      break;
>  default:
>      # do smth
> }
>
> I've got an error message (syntax error).
> Is it possible to use variables in such manner at all?





More information about the Users mailing list