Hello,
On 10/28/10 3:35 PM, "Nicolas RĂ¼ger" wrote:
Hello,
I wonder if there's a chance to use SWITCH in kamailio.cfg with intervals or ranges???
no it is not possible now, you can have many 'case' values like:
swiych($var(x)) { case 1: case 2: case 4: case 8: .... break; ... }
Apart of doing "if" conditions with greater and less ops, an option, just for a nicer look maybe, would be to convert to some string and use regexp matching in switch:
$var(match) = "#" + $var(x) + "#";
switch($var(match)) { case /"#1#2#4#8#": ... }
But still no interval, so you need to list always all the values.
Cheers, Daniel
There's nothing to find in core cookbook about ranges with SWITCH.
something like:
switch ( $var(i) ){
case 1..10: # instructions... break; case [11-20]: # instructions... break; default: # default instructions
}
Thank you...
Regards,
Nicolas