[SR-Users] How to set variable externally

Daniel-Constantin Mierla miconda at gmail.com
Fri Dec 21 17:18:49 CET 2012


On 12/21/12 5:15 PM, Olle E. Johansson wrote:
> 21 dec 2012 kl. 17:10 skrev Ovidiu Sas <osas at voipembedded.com>:
>
>> If you just want to control the debug level externally, take a look at
>> the debug parameter:
>> http://www.kamailio.org/wiki/cookbooks/3.3.x/core#debug
>> It can be controlled via sercmd (kamcmd in future versions).
>>
>> If you want to play with global flags, take a look at cfgutils:
>> http://kamailio.org/docs/modules/3.3.x/modules_k/cfgutils.html
>> http://kamailio.org/docs/modules/3.3.x/modules_k/cfgutils.html#id2533439
>> http://kamailio.org/docs/modules/3.3.x/modules_k/cfgutils.html#id2494518
>> http://kamailio.org/docs/modules/3.3.x/modules_k/cfgutils.html#id2494559
>
> For your own logs:
>
> I usually declare a shared variable called "debug" in the pv module modparams.
>
> When logging i do
>
> if ($shv(debug) > 0)
>     xlog(....)
>
> All shared variables, like Daniel said, can be changed with kamctl/sercmd.
More for the sake of archiving, one can even do:

xlog("$shv(debug)", ...);

and if $shv(debug) > than the value of debug parameter, then the message 
is not printed, otherwise will be printed to the level corresponding to 
its value.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda




More information about the sr-users mailing list