Friday, April 23, 2010

Kamailio 3.0.x - DYK-07 - custom cfg parameters

Define your own config parameters

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: = value 'desc' description
Then you can get access to them via pseudo-variables as $sel( or selects as

Example - define a variable that can be used to control printing of some custom log messages:
local.dbg = 0 desc "Custom debug mode"
route {
xlog("My extra log message\n");
You can update it at runtime with sercmd:
sercmd cfg.set_now_int local dbg 1
I wrote a bit more in a previous post.

No comments:

Post a Comment