[SR-Dev] git:andrei/switch: script parsing: C style switch() & case support
Iñaki Baz Castillo
ibc at aliax.net
Wed Feb 4 22:40:33 CET 2009
El Miércoles, 4 de Febrero de 2009, Andrei Pelinescu-Onciul escribió:
> Yes, it's only for integers.
>
> For strings, ifs should be used, since the switch wouldn't bring any
> advantage.
*SER scripting language is a domain specific language. I expect it offers
higher level syntax than C provides. If not, which is the purpose of using a
DSL?
Kamailio now allows integers and strings (static or pseudo-varaibles) into
the 'switch' stament. It would be great also allowing regular expressions:
switch($rU)
{
case "101":
log("destination number is 101\n");
break;
case /^102/:
log("destination number begins with 102\n");
break;
default:
log("unknown destination number\n");
}
Perhaps this is too much, but allowing just integers (and just static?) is not
very useful IMHO. If so, it would be useful only to inspect some functions
return code or SIP response codes.
Just my opinion. Best regards.
--
Iñaki Baz Castillo
More information about the sr-dev
mailing list