[SR-Users] cfg values read from Database possible?

Daniel Vukicevic daniel.vukicevic at finocom.de
Mon May 19 11:21:52 CEST 2014

kamailio -V
version: kamailio 3.2.2 (x86_64/linux)

I am setting different cfg Parameters via XMLRPC. Which is good for changing parameters per runtime and being independent from database lookups when kamailio is running.
Unfortunately cfg settings will be lost and empty after Restarting Kamailio if cfg values aren’t set before the request_route. So the idea was to look if cfg value is set, if not look into database and take the last cfg setting which was set. (Last cfg values will updated via SQL Query in the XMLRPC branch).

# check if abc.test is defined
        if (strempty($sel(cfg_get.abc.test))) {
	sql_xquery("ca", "SELECT * from cfg where abc=‚test'", "ra“);

The problem is that it seems, that there is no way to read out the values from database and to set the cfg variable again when kamailio is starting, because
there is no way to inject cfg values into kamailio, when kamailio is already started.

Here i need something like this: abc.test = "$xavp(ra=>LB01)" desc „TEST“; <<which doesn’t work in this form. (just to make it clear what i want)

I found http://kamailio.org/docs/modules/stable/modules/cfg_db.html , but documentation is quite bad. Are there any other possibilities for me?

The only way it might work for me (which is in my opinion quite dirty), to exec_dset an external command and to inject the new cfg via XMLRPC.
The new cfg value is updated into database via XMLRPC again (which works, just for the sake of completeness):

route[XMLRPC] {
 # Keeping values for Kamailio Restart
 sql_query("ca", "UPDATE cfg set LB01='$sel(cfg_get.abc.test)' where abc=‚test‘");

Mabye of one of you guys have a hint for me to solve this problem?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140519/33f459a0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140519/33f459a0/attachment.pgp>

More information about the sr-users mailing list