[SR-Users] help to config cfg_db module in kamailio 3.0.1

Daniel-Constantin Mierla miconda at gmail.com
Wed Aug 18 19:45:54 CEST 2010


  Hello,

that is only the part to configure the cfg_db module. That creates the 
config variables, but you need to use them somewhere in routing blocks, 
like:

if($sel(cfg_get.my.route_addr)=="some value") ...

Or at least you can use xlog to print the value of this variable:

xlog("my var value is: $sel(cfg_get.my.route_addr)\n");

Then you can see if the right value is loaded.

Cheers,
Daniel


On 8/18/10 7:36 PM, truong ngoc THANH wrote:
> dear Daniel,
> my configure as :
>
> I add My config in kamalio.cfg
>
> ==============
>
> Loadmodule “cfg_db.so <http://cfg_db.so/>”
>
> modparam("cfg_db", "db_url", "mysql://openser:openserrw <at> 
> localhost/kamailio")
>
> modparam("cfg_db", "transl_tbl", "cfg_transl")
>
> modparam("cfg_db", "custom_tbl", "cfg_custom")
>
> I add and insert in mysql as:
>
> ===============
>
> cfg_transl table:
>
> group_name|name|cfg_table|cfg_table_group_name_field|cfg_table_name_field|cfg_table_value_field
>
> core|use_dst_blacklist|cfg_dns|||
>
> core|dst_blacklist_mem|cfg_dns|||
>
> core|dst_blacklist_expire|||
>
> my|route_addr|cfg_my|my_group_name|my_name|my_value ; overrides 
> <default> values
>
> my|use_rtp_proxy|cfg_my|my_group_name|my_name|my_value
>
> *|*|||| ; matches all param ids, points to tables defined in row <default>
>
> <default>||cfg_var|group_name|name|value ; default cfg_table* values
>
> cfg_custom table:
>
> group_name|name|value_type|min_value|max_value|description
>
> my|route_addr|S|||Routing address
>
> my|use_rtp_proxy|I|0|1|Use RTP proxy
>
> cfg_var table:
>
> group_name|my_name|value
>
> core|debug|4
>
> cfg_my table:
>
> my_group_name|my_name|my_value
>
> my|route_addr|127.0.0.1
>
> my|use_rtp_proxy|1
>
> cfg_dns table:
>
> group_name|name|value
>
> dns|use_dst_blacklist|1
>
> dns|dst_blacklist_mem|1024
>
> dns|dst_blacklist_expire|60
>
>
> so please suggest me to test or insert some variables to make it work.
>
> thanks so much.
>
>
>
> TRUONG NGOC THANH
> Telecommunications Engineer
> Tel: 0984 480 646
> Y!M: ngoc217thanh
>
>
> ------------------------------------------------------------------------
> *From:* Daniel-Constantin Mierla <miconda at gmail.com>
> *To:* truong ngoc THANH <ngoc217thanh at yahoo.com>
> *Cc:* kamailio <sr-users at lists.sip-router.org>
> *Sent:* Thu, August 19, 2010 12:26:27 AM
> *Subject:* Re: [SR-Users] help to config cfg_db module in kamailio 3.0.1
>
>
>
> On 8/18/10 7:20 PM, truong ngoc THANH wrote:
>> i don`t know, the kamailio is start ok,
>
> is command 'ps auxw|grep kamailio' showing you some running kamailio 
> processes?
>
>> but my configure in cfg_db is not work.
>> please suggest what i do and what happen ?
>
> How you figure out is not working? How do you use those variables in 
> your config?
>
> Cheers,
> Daniel
>
>> thanks for help me.
>> TRUONG NGOC THANH
>> Telecommunications Engineer
>> Tel: 0984 480 646
>> Y!M: ngoc217thanh
>>
>>
>> ------------------------------------------------------------------------
>> *From:* Daniel-Constantin Mierla <miconda at gmail.com>
>> *To:* truong ngoc THANH <ngoc217thanh at yahoo.com>
>> *Cc:* kamailio <sr-users at lists.sip-router.org>
>> *Sent:* Thu, August 19, 2010 12:16:40 AM
>> *Subject:* Re: [SR-Users] help to config cfg_db module in kamailio 3.0.1
>>
>> Hello,
>>
>> On 8/18/10 6:34 PM, truong ngoc THANH wrote:
>>> Thanks so much,
>>> but the log is more.
>>>
>>> 0(2285) DEBUG: <core> [main.c:1800]: read 972552225 from /dev/urandom
>>>  0(2285) DEBUG: <core> [main.c:1806]: seeding PRNG with 2254742755
>>>  0(2285) DEBUG: <core> [main.c:1810]: test random numbers 1619886338 
>>> 1418625528 2344803195
>>> loading modules under 
>>> /usr/local/lib/kamailio/modules_k/:/usr/local/lib/kamailio/modules/
>>>  0(2285) WARNING: <core> [socket_info.c:896]: WARNING: fix_hostname: 
>>> could not rev. resolve 192.168.1.40
>>> Listening on
>>>              udp: 192.168.1.40:5060
>>> Aliases:
>>>
>>>  0(2285) DEBUG: <core> [cfg/cfg.c:172]: DEBUG: register_cfg_def(): 
>>> new config group has been registered: 'core' (num=35, size=140)
>>>  0(2285) DEBUG: <core> [cfg/cfg.c:172]: DEBUG: register_cfg_def(): 
>>> new config group has been registered: 'tcp' (num=24, size=96)
>>>  0(2285) DEBUG: <core> [timer.c:270]: init_timer: starting with 
>>> *ticks=52682242
>>>  0(2285) DEBUG: <core> [timer.c:312]: init_timer: timer_list between 
>>> 0xb5f49268 and 0xb5f6b268
>>>  0(2285) INFO: <core> [tcp_main.c:4150]: init_tcp: using epoll_lt as 
>>> the io watch method (auto detected)
>>>  0(2289) DEBUG: <core> [daemonize.c:364]: core dump limits set to 
>>> 4294967295
>>>  0(2289) DEBUG: <core> [sr_module.c:857]: DEBUG: init_mod: db_mysql
>>>  0(2289) DEBUG: db_mysql [km_db_mysql.c:92]: MySQL client version is 
>>> 5.0.77
>>>  0(2289) DEBUG: <core> [sr_module.c:871]: DEBUG: init_mod: mi_fifo
>>>  0(2289) DEBUG: mi_fifo [mi_fifo.c:122]: testing mi_fifo existance ...
>>>  0(2289) DEBUG: <core> [sr_module.c:871]: DEBUG: init_mod: kex
>>>  0(2289) DEBUG: <core> [statistics.c:105]: statistics manager 
>>> successfully initialized
>>>  0(2289) DEBUG: <core> [sr_module.c:857]: DEBUG: init_mod: tm
>>> [root at appliance kamailio]#  0(2289) DEBUG: tm [tm.c:706]: TM - 
>>> (sizeof cell=3152, sip_msg=860) initializing...
>>>  0(2289) DEBUG: tm [callid.c:101]: Call-ID initialization: '5fffff36'
>>>  0(2289) DEBUG: tm [lock.c:87]: DEBUG: lock_initialize: lock 
>>> initialization started
>>>  0(2289) DEBUG: tm [timer.c:242]: tm: tm_init_timers: fr=480 
>>> fr_inv=1920 wait=80 delete=4 t1=8 t2=64 max_inv_lifetime=2880 
>>> max_noninv_lifetime=512
>>>  0(2289) DEBUG: <core> [cfg/cfg.c:172]: DEBUG: register_cfg_def(): 
>>> new config group has been registered: 'tm' (num=33, size=136)
>>>  0(2289) DEBUG: <core> [md5utils.c:87]: DEBUG: MD5 calculated: 
>>> 203c2e849e2a007f7c0b097d3f734545
>>>  0(2289) DEBUG: <core> [md5utils.c:87]: DEBUG: MD5 calculated: 
>>> 78d79373441c680dd4e4ed1a014efb8e
>>>  0(2289) DEBUG: <core> [sr_module.c:871]: DEBUG: init_mod: tmx
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <load_tm> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <register_tmcb> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_newtran> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_relay_to_tcp> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_relay_to_udp> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_relay> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_reply_with_body> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_is_local> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_get_trans_ident> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_lookup_ident> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_add_blind> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_forward_nonack> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_request_within> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_request_outside> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_request> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <new_dlg_uac> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <dlg_response_uac> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <new_dlg_uas> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <update_dlg_uas> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <dlg_request_uas> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <set_dlg_target> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <free_dlg> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <print_dlg> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_gett> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <calculate_hooks> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_uac> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_uac_with_ids> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_release> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_unref> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <run_failure_handlers> in module tm 
>>> [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <cancel_uacs> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <cancel_all_uacs> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_suspend> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:506]: find_export_record: found 
>>> <t_continue> in module tm [/usr/local/lib/kamailio/modules/tm.so]
>>>  0(2289) DEBUG: <core> [sr_module.c:871]: DEBUG: init_mod: sl
>>>
>>>
>>> more and more....
>>> i have just see one error in my cfg_custom table. after i corect it. 
>>> i start kamailio ok, but i don`t see any change when cfg_db work ?
>> yes, the log is more, and I do not see the error message here. What 
>> do you mean with last question, does it start ok now?
>>
>> Cheers,
>> Daniel
>> -- 
>> Daniel-Constantin Mierla
>> http://www.asipto.com/
>>
>
> -- 
> Daniel-Constantin Mierla
> http://www.asipto.com/
>

-- 
Daniel-Constantin Mierla
http://www.asipto.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20100818/5fe051ef/attachment-0001.htm>


More information about the sr-users mailing list