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
Sebastian Damm writes:
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; } }
i don't see $var(i) initialized.
-- juha
Hi Juha,
you're right, but if that was the problem, we should at least see the second log line after the sql_query. $var(i) is used only after this.
Any other hints?
Best Regards, Sebastian
On Thu, May 15, 2014 at 11:44 AM, Juha Heinanen jh@tutpro.com wrote:
Sebastian Damm writes:
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; } }
i don't see $var(i) initialized.
-- juha
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
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-bounces@lists.sip-router.org [mailto:sr-users-bounces@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/serhttp://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.
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-bounces@lists.sip-router.org [mailto:sr-users-bounces@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 http://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 list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
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 <miconda@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-bounces@lists.sip-router.org [ mailto:sr-users-bounces@lists.sip-router.orgsr-users-bounces@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-users@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
Hello,
On 15/05/14 13:55, Sebastian Damm wrote:
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?
perhaps with lua or other embedded
(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.
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.
can you give the backtrace for 4.1.3, what Hugh sent didn't match the source code, maybe he has older version.
Cheers, Daniel
Best Regards, Sebastian
On Thu, May 15, 2014 at 1:37 PM, Daniel-Constantin Mierla <miconda@gmail.com mailto:miconda@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-bounces@lists.sip-router.org <mailto:sr-users-bounces@lists.sip-router.org> [mailto:sr-users-bounces@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 <http://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 list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla -http://www.asipto.com http://twitter.com/#!/miconda <http://twitter.com/#%21/miconda> -http://www.linkedin.com/in/miconda _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hi Daniel,
On Thu, May 15, 2014 at 4:10 PM, Daniel-Constantin Mierla <miconda@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@entry=0x7f7c469b5de8, query=query@entry=0x7fff7c517d80, res=res@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@entry=0x7fff7c518430, a=a@entry=0x7f7c46c0fb00, msg=msg@entry=0x7f7c45b252a0) at action.c:1117 #4 0x0000000000420940 in run_actions (h=h@entry=0x7fff7c518430, a=a@entry=0x7f7c46c0f5a0, msg=msg@entry=0x7f7c45b252a0) at action.c:1599 #5 0x0000000000429a50 in run_top_route (a=0x7f7c46c0f5a0, msg=0x7f7c45b252a0, c=c@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@entry=-127) at sr_module.c:924 #8 0x0000000000512bb2 in init_mod_child (m=0x7f7c469b38d8, rank=rank@entry=-127) at sr_module.c:921 #9 0x0000000000512bb2 in init_mod_child (m=0x7f7c469b3bb0, rank=rank@entry=-127) at sr_module.c:921 #10 0x00000000005139fe in init_child (rank=rank@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@entry=0x7f7c469b5de8, query=query@entry=0x7fff7c517d80, res=res@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