Kamailio Advanced Training
Click here for more details!

Learn how to build RTC services with Kamailio!

Sunday, July 3, 2011

10yearsSER - things done right - variables

The veteran users of this project probably remember that day in the summer of 2003 when xlog module was introduced in SIP Express Router (SER) by Elena-Ramona Modroiu.

Starting with that moment, the SER config files were invaded by many xlog(...) and xdbg(...) lines - it was a big step forward to allow SER administrators understand what is going internally during processing of SIP traffic.

Little 'bugs' starting with '%' (named at that time 'specifiers') present all over the config were replaced dynamically at runtime with values taken from SIP traffic or runtime environment, giving back meaningful information about current processing.

Driven by their popularity, the specifiers implemented inside xlog module were moved to core, the marker sign '%' was replaced by '$' and since then they were named 'variables' (aka pseudo-variables). (Note: this evolution happened initially through Kamailio (OpenSER) branch).

The 'little bugs' became free to fly everywhere inside configuration file, in expressions, in assignment operations, module parameters or function parameters. And they did so!

For example, adding the prefix 0049 to dialed number became as simple as:

$rU = "0049" + $rU;

Testing if the dialed number starts with 0049? Here it is:

if($rU =~ "^0049") { ... }

Looking over several configuration files I have these days running on production systems, the operations with variables have the leading role in defining the routing logic. Without them, none of these configs would have been possible, without them, many ideas of new services would have been impossible to implement.

In the year of 10th anniversary, it is the time of sending kudos to Elena-Ramona for her contributions to this project.

PS: to clarify, the terminology 'pseudo-variables' was used due to the fact that SER's configuration language variables concept is different than classic variables. For example: some are read only, some have the value in private memory or shared memory, some are single-value some are multi-value.

No comments:

Post a Comment