Wednesday, April 21, 2010

Kamailio 3.0.x - DYK-05 - switch and break

Break out from inside case block within switch

See also: Kamailio 3.0.x - DYK - Table of Content

Another enhancement Kamailio 3.0.x brought is usage of break inside case branches of switch statement. With older versions, break can be used only at the end of case branch:
switch($ru) {
case "101":
# actions here
break;
case "102":
# actions here
break;
}
It was no way to break out from inside the actions list. With 3.0 you can do it:
switch($ru) {
case "101":
# some actions here
if(condition) {
break;
}
# other actions here
break;
case "102":
# some actions here
break;
}
Very good to make the execution of switch more optimized and the actions list inside simpler.

No comments:

Post a Comment