See also: Kamailio 3.0.x - DYK - Table of Content
Kamailio 3.0.0 introduced custom config global parameters. These are variables that can be declared in the global parameters part and can be used inside the routing logic. Very useful as well is the features of being able to change its value at runtime via RPC commands, without SIP server restart.
Defining a new cfg parameter has a special format:
group.id = value 'desc' descriptionThen you can get access to them via pseudo-variables as $sel(cfg_get.group.id) or selects as @cfg_get.group.id.
Example - define a variable that can be used to control printing of some custom log messages:
...You can update it at runtime with sercmd:
local.dbg = 0 desc "Custom debug mode"
...
route {
...
if($sel(cfg_get.local.dbg)==1)
xlog("My extra log message\n");
...
}
sercmd cfg.set_now_int local dbg 1I wrote a bit more in a previous post.
No comments:
Post a Comment