[OpenSIPS-Users] switch / case behaviour
Richard Revels
rrevels at bandwidth.com
Mon Apr 9 09:38:54 EDT 2018
I am unsure of the expected behaviour in the config switch / case block
when the break is not defined between a defined case and the default case
but what I'm seeing right now is not what I expect. Wanted to get some
input before opening a bug tracker on it.
--code--
route[testswitch]
{
switch( $avp(testvalue) )
{
case "defined break":
xlog("L_INFO", "log only this line \n");
break;
case "non defined break":
xlog("L_INFO", "log this line and fall through to
also and then to default \n");
case "also non defined":
xlog("L_INFO", "log this line and fall through to
default \n");
default:
xlog("L_ERR", "log default line \n");
}
xlog("L_ERR", "at end of switch block with $avp(testvalue) \n");
}
...
$avp(testvalue) := "defined break";
route(testswitch);
$avp(testvalue) := "non defined break";
route(testswitch);
$avp(testvalue) := "also non defined";
route(testswitch);
$avp(testvalue) := "non defined value";
route(testswitch);
--end code--
--log--
2018-04-09T13:13:28.092141+00:00 pidflo-01 /sbin/opensips[25651]: log only
this line
2018-04-09T13:13:28.092150+00:00 pidflo-01 /sbin/opensips[25651]: at end of
switch block with defined break
2018-04-09T13:13:28.092158+00:00 pidflo-01 /sbin/opensips[25651]: log this
line and fall through to also and then to default
2018-04-09T13:13:28.092161+00:00 pidflo-01 /sbin/opensips[25651]: log this
line and fall through to default
2018-04-09T13:13:28.092164+00:00 pidflo-01 /sbin/opensips[25651]: at end of
switch block with non defined break
2018-04-09T13:13:28.092168+00:00 pidflo-01 /sbin/opensips[25651]: log this
line and fall through to default
2018-04-09T13:13:28.092171+00:00 pidflo-01 /sbin/opensips[25651]: at end of
switch block with also non defined
2018-04-09T13:13:28.092176+00:00 pidflo-01 /sbin/opensips[25651]: log
default line
2018-04-09T13:13:28.092179+00:00 pidflo-01 /sbin/opensips[25651]: at end of
switch block with non defined value
--end log--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20180409/f4d88b4d/attachment.html>
More information about the Users
mailing list