See also: Kamailio 3.0.x - DYK - Table of Content
Starting with 3.0.0, you can use regular expressions to match switch cases - you have to use a '/' (slash) before case value to tell it is regular expression. For example, match dialed number against country codes:
switch($rU) {First, it is one statement construct, therefore is faster than a set of IFs:
case /"^\+1": # calls to USA
...
break;
case /"^\+49": # calls to Germany
...
break;
default: # calls to other destinations
}
if($rU=~"^\+1") {...}Then, the config file is better structured, being easier now to manage and follow prefix based routing rules.
else if($rU=~"^\+49") {...}
else {...}
No comments:
Post a Comment