OpenSER is a multiprocess application. Sometimes, as an VoIP administrator of an OpenSER based platform, you feel the need to have a variable whose value is visible in all OpenSER processes.
Few days ago, the cfgutils module introduced this feature. A shared variable is specified via $shv(name), name can be any string of alpha-numeric characters. The shared variables can be initialized via a parameter of the cfgutils module. Also, they can be set via MI commands, giving the possibility to control routing logic in a nice way, without restarting OpenSER.
xlog was enhanced to take the log lever from any pseudo-variable, including shared variables. Now you can enable/disable printing of the log messages via MI.
Example of usage:
modparam("cfgutils", "shvset", "debug=i:4")
xlog("$shv(debug)", "request [$rm] from [$fu] to [$ru]\n");
To get your xlog message printed, issue the command:
# openserct fifo shv_set debug int 3
More details at:
Kamailio Advanced Training
March 25-27, 2019, in Washington DC, USA
Click here for more details!
Learn how to build RTC services with Kamailio!
Thursday, February 7, 2008
Shared variables in configuration script
Posted by Daniel-Constantin Mierla at 4:15 PM
Subscribe to: Post Comments (Atom)
Post a Comment