Hi Daniel, I'm using 4.1.3
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? (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.) 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. Best Regards, Sebastian On Thu, May 15, 2014 at 1:37 PM, Daniel-Constantin Mierla <mico...@gmail.com > wrote: > 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. > > 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. > > Cheers, > Daniel > > > On 15/05/14 12:44, Waite, Hugh wrote: > > I added this to my config to try and it caused a segfault on startup in > sql_query. > > It seems the db connection is not initialised at this point. > > > > (gdb) bt > > #0 0x0000000000000000 in ?? () > > #1 0x00007f47450517ef in sql_do_query (con=0x7f474d573930, > query=0x7ffffc18f350, res=0x7f474d7220a0) at sql_api.c:257 > > #2 0x00007f4745059a7b in sql_query (msg=0x7f47484ea540, > dbl=0x7f474d573930 "@;WMG\177", query=0x7f474d6780e8 "\250\016rMG\177", > res=0x7f474d7220a0 "j8Wi") at sqlops.c:209 > > #3 0x0000000000419ca2 in do_action (h=0x7ffffc18fa50, a=0x7f474d7207b0, > msg=0x7f47484ea540) at action.c:1117 > > #4 0x0000000000422878 in run_actions (h=0x7ffffc18fa50, a=0x7f474d720420, > msg=0x7f47484ea540) at action.c:1599 > > #5 0x0000000000423017 in run_top_route (a=0x7f474d720420, > msg=0x7f47484ea540, c=0x7ffffc18fa50) at action.c:1685 > > #6 0x00007f4742d1cbec in child_init (rank=-127) at htable.c:223 > > #7 0x00000000004f7ec2 in init_mod_child (m=0x7f474d56dad8, rank=-127) at > sr_module.c:924 > > #8 0x00000000004f7d65 in init_mod_child (m=0x7f474d56e3e0, rank=-127) at > sr_module.c:921 > > #9 0x00000000004f8048 in init_child (rank=-127) at sr_module.c:948 > > #10 0x000000000046ce42 in main_loop () at main.c:1571 > > #11 0x000000000047030b in main (argc=13, argv=0x7ffffc18fec8) at > main.c:2533 > > (gdb) frame 1 > > #1 0x00007f47450517ef in sql_do_query (con=0x7f474d573930, > query=0x7ffffc18f350, res=0x7f474d7220a0) at sql_api.c:257 > > *257 if(con->dbf.raw_query(con->dbh, query, &db_res)!=0)* > > (gdb) p con > > $1 = (sql_con_t *) 0x7f474d573930 > > (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}* > > (gdb) > > > > Regards, > > Hugh > > > > *From:* sr-users-boun...@lists.sip-router.org [ > mailto:sr-users-boun...@lists.sip-router.org<sr-users-boun...@lists.sip-router.org>] > *On Behalf Of *Sebastian Damm > *Sent:* 15 May 2014 10:34 > *To:* SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - > Users Mailing List > *Subject:* [SR-Users] DB select htable:mod-init doesn't work > > > > Hi, > > 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. > > This is what the route looks like: > > event_route[htable:mod-init] { > xlog("L_NOTICE", "Loading Carrier domains into Hash table.\n"); > sql_query("ser", "select domain_name from carrier_domains", > "domains"); > xlog("L_NOTICE", "Loaded from database...\n"); > while($var(i)<$dbr(domains=>cols)) { > xlog("L_NOTICE", "Entry: $dbr(domains=>[$var(i),0])\n"); > $sht(carrierips=>$var(i)) = $dbr(domains=>[$var(i),0]); > $var(i) = $var(i) + 1; > } > } > > Of course, the necessary parameters are set. > modparam("htable", "htable", "carrierips=>size=6") > modparam("sqlops","sqlcon","ser=>mysql://user:password@127.0.0.1/ser") > > > > In the log I see the following: > May 15 11:25:33 linux /usr/sbin/kamailio[20872]: NOTICE: <script>: Loading > Carrier domains into Hash table. > > 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. > > Am I missing something? > > Best Regards, > Sebastian > > ------------------------------ > 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. > > > > _______________________________________________ > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing > listsr-us...@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users > > > -- > Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda > - http://www.linkedin.com/in/miconda > > > _______________________________________________ > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list > sr-users@lists.sip-router.org > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users > > <http://www.sipgate.co.uk>
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users