<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
<div class="moz-cite-prefix">On 15/05/14 13:55, Sebastian Damm
wrote:<br>
</div>
<blockquote
cite="mid:CABkWSFxqzQEBJVvtUNso4Qoph-rVY0BWnKg6aQsAUrD9uUA9iA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>Hi Daniel,<br>
<br>
</div>
I'm using 4.1.3<br>
<br>
</div>
I used this, because I found it in an example written by
you.<br>
<a moz-do-not-send="true"
href="http://by-miconda.blogspot.de/2009/12/best-of-new-in-kamailio-300-9.html">http://by-miconda.blogspot.de/2009/12/best-of-new-in-kamailio-300-9.html</a><br>
<br>
</div>
Is there any other way I can initialize a hash with values
from a database table not explicitly designed for use with
htable module?</div>
</div>
</div>
</blockquote>
<br>
perhaps with lua or other embedded <br>
<blockquote
cite="mid:CABkWSFxqzQEBJVvtUNso4Qoph-rVY0BWnKg6aQsAUrD9uUA9iA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div> (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.)<br>
</div>
</div>
</div>
</blockquote>
<br>
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.<br>
<br>
<blockquote
cite="mid:CABkWSFxqzQEBJVvtUNso4Qoph-rVY0BWnKg6aQsAUrD9uUA9iA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<br>
</div>
<div>Thanks, Hugh, for pointing out the crash. I found a
couple of core files from my test on my file system, too. I
didn't see the "core was generated" message in the log, so I
didn't think there was one there.<br>
</div>
</div>
</div>
</blockquote>
<br>
can you give the backtrace for 4.1.3, what Hugh sent didn't match
the source code, maybe he has older version.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<blockquote
cite="mid:CABkWSFxqzQEBJVvtUNso4Qoph-rVY0BWnKg6aQsAUrD9uUA9iA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
</div>
<div><br>
</div>
Best Regards,<br>
</div>
Sebastian<br>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Thu, May 15, 2014 at 1:37 PM,
Daniel-Constantin Mierla <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:miconda@gmail.com"
target="_blank">miconda@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Indeed, the db
connection is not initialized at the time of executing
event_route[htable:mod-init]. This is executed after all
modules are initialized, but the sqlops connections are
initialized in child init.<br>
<br>
However, it should not cause this crash. What version
are you using? Because latest master and 4.1 have a
simple condition at sql_api.c:257.<br>
<br>
Cheers,<br>
Daniel
<div>
<div class="h5"><br>
<br>
<div>On 15/05/14 12:44, Waite, Hugh wrote:<br>
</div>
</div>
</div>
<blockquote type="cite">
<div>
<div class="h5">
<div>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I
added this to my config to try and it caused
a segfault on startup in sql_query.</span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">It
seems the db connection is not initialised
at this point.</span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p>
<p class="MsoNormal"><span>(gdb) bt</span></p>
<p class="MsoNormal"><span>#0
0x0000000000000000 in ?? ()</span></p>
<p class="MsoNormal"><span>#1
0x00007f47450517ef in sql_do_query
(con=0x7f474d573930, query=0x7ffffc18f350,
res=0x7f474d7220a0) at sql_api.c:257</span></p>
<p class="MsoNormal"><span>#2
0x00007f4745059a7b in sql_query
(msg=0x7f47484ea540, dbl=0x7f474d573930
"@;WMG\177", query=0x7f474d6780e8
"\250\016rMG\177", res=0x7f474d7220a0
"j8Wi") at sqlops.c:209</span></p>
<p class="MsoNormal"><span>#3
0x0000000000419ca2 in do_action
(h=0x7ffffc18fa50, a=0x7f474d7207b0,
msg=0x7f47484ea540) at action.c:1117</span></p>
<p class="MsoNormal"><span>#4
0x0000000000422878 in run_actions
(h=0x7ffffc18fa50, a=0x7f474d720420,
msg=0x7f47484ea540) at action.c:1599</span></p>
<p class="MsoNormal"><span>#5
0x0000000000423017 in run_top_route
(a=0x7f474d720420, msg=0x7f47484ea540,
c=0x7ffffc18fa50) at action.c:1685</span></p>
<p class="MsoNormal"><span>#6
0x00007f4742d1cbec in child_init (rank=-127)
at htable.c:223</span></p>
<p class="MsoNormal"><span>#7
0x00000000004f7ec2 in init_mod_child
(m=0x7f474d56dad8, rank=-127) at
sr_module.c:924</span></p>
<p class="MsoNormal"><span>#8
0x00000000004f7d65 in init_mod_child
(m=0x7f474d56e3e0, rank=-127) at
sr_module.c:921</span></p>
<p class="MsoNormal"><span>#9
0x00000000004f8048 in init_child (rank=-127)
at sr_module.c:948</span></p>
<p class="MsoNormal"><span>#10
0x000000000046ce42 in main_loop () at
main.c:1571</span></p>
<p class="MsoNormal"><span>#11
0x000000000047030b in main (argc=13,
argv=0x7ffffc18fec8) at main.c:2533</span></p>
<p class="MsoNormal"><span>(gdb) frame 1</span></p>
<p class="MsoNormal"><span>#1
0x00007f47450517ef in sql_do_query
(con=0x7f474d573930, query=0x7ffffc18f350,
res=0x7f474d7220a0) at sql_api.c:257</span></p>
<p class="MsoNormal"><b><span>257
if(con->dbf.raw_query(con->dbh,
query, &db_res)!=0)</span></b></p>
<p class="MsoNormal"><span>(gdb) p con</span></p>
<p class="MsoNormal"><span>$1 = (sql_con_t *)
0x7f474d573930</span></p>
<p class="MsoNormal"><span>(gdb) p con->dbf</span></p>
<p class="MsoNormal"><b><span>$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,</span></b></p>
<p class="MsoNormal"><b><span> affected_rows =
0, start_transaction = 0, end_transaction
= 0, abort_transaction = 0, query_lock =
0}</span></b></p>
<p class="MsoNormal"><span>(gdb)</span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Regards,</span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hugh</span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p>
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""
lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""
lang="EN-US"> <a moz-do-not-send="true"
href="mailto:sr-users-bounces@lists.sip-router.org"
target="_blank">sr-users-bounces@lists.sip-router.org</a>
[<a moz-do-not-send="true"
href="mailto:sr-users-bounces@lists.sip-router.org"
target="_blank">mailto:sr-users-bounces@lists.sip-router.org</a>]
<b>On Behalf Of </b>Sebastian Damm<br>
<b>Sent:</b> 15 May 2014 10:34<br>
<b>To:</b> SIP Router - Kamailio (OpenSER)
and SIP Express Router (SER) - Users Mailing
List<br>
<b>Subject:</b> [SR-Users] DB select
htable:mod-init doesn't work</span></p>
<p class="MsoNormal"> </p>
<div>
<div>
<div>
<div>
<p class="MsoNormal"
style="margin-bottom:12.0pt">Hi,</p>
</div>
<p class="MsoNormal"
style="margin-bottom:12.0pt">I'm trying
to fill a hash table on startup in the
htable:mod-init event route. But it
doesn't work. Kamailio doesn't start at
all, but doesn't print out an error in
the log.</p>
</div>
<p class="MsoNormal"
style="margin-bottom:12.0pt">This is what
the route looks like:<br>
<br>
event_route[htable:mod-init] {<br>
xlog("L_NOTICE", "Loading Carrier
domains into Hash table.\n");<br>
sql_query("ser", "select
domain_name from carrier_domains",
"domains");<br>
xlog("L_NOTICE", "Loaded from
database...\n");<br>
while($var(i)<$dbr(domains=>cols)) {<br>
xlog("L_NOTICE", "Entry:
$dbr(domains=>[$var(i),0])\n");<br>
$sht(carrierips=>$var(i)) =
$dbr(domains=>[$var(i),0]);<br>
$var(i) = $var(i) + 1;<br>
}<br>
}</p>
</div>
<p class="MsoNormal">Of course, the necessary
parameters are set.<br>
modparam("htable", "htable",
"carrierips=>size=6")<br>
modparam("sqlops","sqlcon","ser=>mysql://<a
moz-do-not-send="true"
href="http://user:password@127.0.0.1/ser"
target="_blank">user:password@127.0.0.1/ser</a>")<br
clear="all">
</p>
<div>
<div>
<div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"
style="margin-bottom:12.0pt">In the
log I see the following:<br>
May 15 11:25:33 linux
/usr/sbin/kamailio[20872]: NOTICE:
<script>: Loading Carrier
domains into Hash table.</p>
</div>
<div>
<p class="MsoNormal"
style="margin-bottom:12.0pt">As you
can see, there should be a lot more
output, but nothing happens anymore
after that. In ngrep I see other
queries going to the same database
from other modules, but my query
from the event route is never
executed.</p>
</div>
<div>
<p class="MsoNormal"
style="margin-bottom:12.0pt">Am I
missing something?</p>
</div>
<div>
<p class="MsoNormal">Best Regards,<br>
Sebastian</p>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<hr> <font color="Gray" face="Arial" size="1">This
e-mail and any attachment is for authorised use
by the intended recipient(s) only. It may
contain proprietary material, confidential
information and/or be subject to legal
privilege. It should not be copied, disclosed
to, retained or used by, any other party. If you
are not an intended recipient then please
promptly delete this e-mail and any attachment
and all copies and inform the sender. Thank you
for understanding.<br>
</font> <br clear="all">
<br>
<fieldset></fieldset>
<br>
</div>
</div>
<div class="">
<pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a moz-do-not-send="true" href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a moz-do-not-send="true" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</div>
</blockquote>
<span class="HOEnZb"><font color="#888888"> <br>
<pre cols="72">--
Daniel-Constantin Mierla - <a moz-do-not-send="true" href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
<a moz-do-not-send="true" href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a></pre>
</font></span></div>
<br>
_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users
mailing list<br>
<a moz-do-not-send="true"
href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a moz-do-not-send="true"
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a></pre>
</body>
</html>