[SR-Users] DB select htable:mod-init doesn't work

Sebastian Damm damm at sipgate.de
Thu May 15 18:15:39 CEST 2014


Hi Daniel,

On Thu, May 15, 2014 at 4:10 PM, Daniel-Constantin Mierla <miconda at gmail.com
> wrote:

>
>  I used this, because I found it in an example written by you.
> http://by-miconda.blogspot.de/2009/12/best-of-new-in-kamailio-300-9.html
>
>  Is there any other way I can initialize a hash with values from a
> database table not explicitly designed for use with htable module?
>
>
> perhaps with lua or other embedded
>

So this is not a bug? The docs say, the init event route is run after
everything else is initalized. Why is the connection not there at this
moment?

>   (The other way I could solve my problem would be if I could use the
> is_domain_local() from the domain module also in the onreply_route.)
>
>  I see no reason not to be allowed there, as the parameter is given from
> script. Maybe you can use is_myself() with domain module having parameter
> register_myself set.
>

What I would like to do is check the to domain header of the reply against
the entries in the domain table. The system I would like to use it is a
stateless loadbalancer, so I can't save anything for the reply. (I have to
admit, I'm already abusing the module for checking against foreign domains,
where this system is only an outbound proxy for.) But while thinking about
a solution, I think I'll just rewrite this part of the config and use a
hash table for it.


> can you give the backtrace for 4.1.3, what Hugh sent didn't match the
> source code, maybe he has older version.
>

Of course. This is what my backtrace looks like:

(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007f7c416c5c1f in sql_do_query (con=con at entry=0x7f7c469b5de8,
query=query at entry=0x7fff7c517d80, res=res at entry=0x7f7c46c10f80) at
sql_api.c:262
#2  0x00007f7c416cf400 in sql_query (msg=<optimized out>,
dbl=0x7f7c469b5de8 "\b]\233F|\177", query=<optimized out>,
res=0x7f7c46c10f80 "j8Wi") at sqlops.c:209
#3  0x00000000004224a0 in do_action (h=h at entry=0x7fff7c518430,
a=a at entry=0x7f7c46c0fb00,
msg=msg at entry=0x7f7c45b252a0) at action.c:1117
#4  0x0000000000420940 in run_actions (h=h at entry=0x7fff7c518430,
a=a at entry=0x7f7c46c0f5a0,
msg=msg at entry=0x7f7c45b252a0) at action.c:1599
#5  0x0000000000429a50 in run_top_route (a=0x7f7c46c0f5a0,
msg=0x7f7c45b252a0, c=c at entry=0x7fff7c518430) at action.c:1685
#6  0x00007f7c414b89fa in child_init (rank=<optimized out>) at htable.c:223
#7  0x0000000000512c54 in init_mod_child (m=0x7f7c469b2fc8,
rank=rank at entry=-127)
at sr_module.c:924
#8  0x0000000000512bb2 in init_mod_child (m=0x7f7c469b38d8,
rank=rank at entry=-127)
at sr_module.c:921
#9  0x0000000000512bb2 in init_mod_child (m=0x7f7c469b3bb0,
rank=rank at entry=-127)
at sr_module.c:921
#10 0x00000000005139fe in init_child (rank=rank at entry=-127) at
sr_module.c:948
#11 0x00000000004808f0 in main_loop () at main.c:1571
#12 0x0000000000420585 in main (argc=<optimized out>, argv=<optimized out>)
at main.c:2533
(gdb) frame 1
#1  0x00007f7c416c5c1f in sql_do_query (con=con at entry=0x7f7c469b5de8,
query=query at entry=0x7fff7c517d80, res=res at entry=0x7f7c46c10f80) at
sql_api.c:262
262    sql_api.c: No such file or directory.
(gdb) p con
$1 = (sql_con_t *) 0x7f7c469b5de8
(gdb) p con->dbf
$2 = {cap = 0, use_table = 0, init = 0, init2 = 0, close = 0, query = 0,
fetch_result = 0, raw_query = 0, free_result = 0, insert = 0, delete = 0,
update = 0, replace = 0, last_inserted_id = 0, insert_update = 0,
  insert_delayed = 0, affected_rows = 0, start_transaction = 0,
end_transaction = 0, abort_transaction = 0, query_lock = 0}

I don't really understand the "sql_api.c: No such file or directory" line.
sqlops is already working on this system.

Best Regards,
Sebastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140515/38e318ea/attachment.html>


More information about the sr-users mailing list