Hi All,
I am trying to create a new module under the kamailio source base, as part of understanding the framework. But when i start the Kamailio, i am seeing a core dump occuring when my new module is getting initiated and when the database is getting initialised. PFA the files attached containing the config file and source files used for creating module files.
I am using the "DEFAULT_DB_URL" as database uri. The core dump backtrace shows that the module init fails at the following point: (gdb) bt #0 0x00000000 in ?? () #1 0x00ef390d in child_init (rank=9172352) at my_mod.c:239 #2 0x081226be in init_mod (m=0xb7515a04) at sr_module.c:922 #3 0x08122630 in init_mod (m=0xb7515c78) at sr_module.c:919
The line 239 in my module file points to the child-init function which initializes the database connectivity ==> "mymod_dbh = mymod_dbf.init(&db_url);"
I have written the module using the template provided under the kamailio website. All the parameters are defined properly. Have no idea as to what is going wrong.
I tried debugging the core dump using gdb but of no much help. I am not able to run the gdb during runti sr-users@lists.sip-router.orgme due to which i am not able to add break points and check. Not sure what the problem is. That's why i generated core dump file and analysed the backtrace, but i can't add break points and run it again as the executable is not involved.
Can anyone please let me know what is the issue is or any pointers if i have missed some part of the code due to which the connectivity to db is not happening. Due to this i am not able to proceed further with the testing of my new module. Also any tips on how to do get the gdb debugging during runtime will also be very helpful.
Any help is appreciated :).
Hello,
can you paste here the mod_init() and child_init() functions and say which one is line 239 (inside child init)? I expect some db init step for your module was not done.
Also, the output of 'bt full' might be useful.
Cheers, Daniel
On 12/3/11 6:35 AM, Jagdeep S wrote:
Hi All,
I am trying to create a new module under the kamailio source base, as part of understanding the framework. But when i start the Kamailio, i am seeing a core dump occuring when my new module is getting initiated and when the database is getting initialised. PFA the files attached containing the config file and source files used for creating module files.
I am using the "DEFAULT_DB_URL" as database uri. The core dump backtrace shows that the module init fails at the following point: (gdb) bt #0 0x00000000 in ?? () #1 0x00ef390d in child_init (rank=9172352) at my_mod.c:239 #2 0x081226be in init_mod (m=0xb7515a04) at sr_module.c:922 #3 0x08122630 in init_mod (m=0xb7515c78) at sr_module.c:919
The line 239 in my module file points to the child-init function which initializes the database connectivity ==> "mymod_dbh = mymod_dbf.init(&db_url);"
I have written the module using the template provided under the kamailio website. All the parameters are defined properly. Have no idea as to what is going wrong.
I tried debugging the core dump using gdb but of no much help. I am not able to run the gdb during runti sr-users@lists.sip-router.orgme due to which i am not able to add break points and check. Not sure what the problem is. That's why i generated core dump file and analysed the backtrace, but i can't add break points and run it again as the executable is not involved.
Can anyone please let me know what is the issue is or any pointers if i have missed some part of the code due to which the connectivity to db is not happening. Due to this i am not able to proceed further with the testing of my new module. Also any tips on how to do get the gdb debugging during runtime will also be very helpful.
Any help is appreciated :).
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,
Thanks for the reply. I was just seeing differences in various module initialization over the weekend and saw that the exports structure was slightly different from what i had taken from the template in the kamailio website. I think the extra parameters/methods added in the latest versions were missing in my exports structure due to which my initialization used to fail. And during initialization i pass "pseudo variable" as argument to my method but i was not having the pseudo variable member in the structure. Since it was not initialized the db initialization failed.
I just changed the following structure from:
struct module_exports exports= { "mymodule", /* module's name */ DEFAULT_DLFLAGS, /*!< dlopen flags */ cmds, /* exported functions */ mod_params, /* param exports */ mod_stats, /* exported statistics */ mod_init, /* module initialization function */ 0, /* reply processing function FIXME Not sure when this is used */ mod_destroy, /* Destroy function */ child_init /* per-child init function */ };
to the following structure: struct module_exports exports= { "mymodule", /* module's name */ DEFAULT_DLFLAGS, /* dlopen flags */ cmds, /* Exported functions */ mod_params, /* Exported parameters */ mod_stats, /* exported statistics */ 0, /* exported MI functions */ 0, /* exported pseudo-variables */ 0, /* extra processes */ mod_init, /* module initialization function */ 0, /* response function */ mod_destroy,/* destroy function */ child_init /* child initialization function */ };
Now i am able to start the kamailio server with db initialized :) Anyways thanks for the response.
Regards, Jagdeep S
On 12/6/11, Daniel-Constantin Mierla miconda@gmail.com wrote:
Hello,
can you paste here the mod_init() and child_init() functions and say which one is line 239 (inside child init)? I expect some db init step for your module was not done.
Also, the output of 'bt full' might be useful.
Cheers, Daniel
On 12/3/11 6:35 AM, Jagdeep S wrote:
Hi All,
I am trying to create a new module under the kamailio source base, as part of understanding the framework. But when i start the Kamailio, i am seeing a core dump occuring when my new module is getting initiated and when the database is getting initialised. PFA the files attached containing the config file and source files used for creating module files.
I am using the "DEFAULT_DB_URL" as database uri. The core dump backtrace shows that the module init fails at the following point: (gdb) bt #0 0x00000000 in ?? () #1 0x00ef390d in child_init (rank=9172352) at my_mod.c:239 #2 0x081226be in init_mod (m=0xb7515a04) at sr_module.c:922 #3 0x08122630 in init_mod (m=0xb7515c78) at sr_module.c:919
The line 239 in my module file points to the child-init function which initializes the database connectivity ==> "mymod_dbh = mymod_dbf.init(&db_url);"
I have written the module using the template provided under the kamailio website. All the parameters are defined properly. Have no idea as to what is going wrong.
I tried debugging the core dump using gdb but of no much help. I am not able to run the gdb during runti sr-users@lists.sip-router.orgme due to which i am not able to add break points and check. Not sure what the problem is. That's why i generated core dump file and analysed the backtrace, but i can't add break points and run it again as the executable is not involved.
Can anyone please let me know what is the issue is or any pointers if i have missed some part of the code due to which the connectivity to db is not happening. Due to this i am not able to proceed further with the testing of my new module. Also any tips on how to do get the gdb debugging during runtime will also be very helpful.
Any help is appreciated :).
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
-- Daniel-Constantin Mierla -- http://www.asipto.com http://linkedin.com/in/miconda -- http://twitter.com/miconda
Hello,
On 12/6/11 5:28 AM, Jagdeep S wrote:
Hi Daniel,
Thanks for the reply. I was just seeing differences in various module initialization over the weekend and saw that the exports structure was slightly different from what i had taken from the template in the kamailio website.
ok, probably that doc is for older version. Was it a wiki page? If you can give the link, we can update it and make a note about versions and validity of the content.
Cheers, Daniel
I think the extra parameters/methods added in the latest versions were missing in my exports structure due to which my initialization used to fail. And during initialization i pass "pseudo variable" as argument to my method but i was not having the pseudo variable member in the structure. Since it was not initialized the db initialization failed.
I just changed the following structure from:
struct module_exports exports= { "mymodule", /* module's name */ DEFAULT_DLFLAGS, /*!< dlopen flags */ cmds, /* exported functions */ mod_params, /* param exports */ mod_stats, /* exported statistics */ mod_init, /* module initialization function */ 0, /* reply processing function FIXME Not sure when this is used */ mod_destroy, /* Destroy function */ child_init /* per-child init function */ };
to the following structure: struct module_exports exports= { "mymodule", /* module's name */ DEFAULT_DLFLAGS, /* dlopen flags */ cmds, /* Exported functions */ mod_params, /* Exported parameters */ mod_stats, /* exported statistics */ 0, /* exported MI functions */ 0, /* exported pseudo-variables */ 0, /* extra processes */ mod_init, /* module initialization function */ 0, /* response function */ mod_destroy,/* destroy function */ child_init /* child initialization function */ };
Now i am able to start the kamailio server with db initialized :) Anyways thanks for the response.
Regards, Jagdeep S
On 12/6/11, Daniel-Constantin Mierlamiconda@gmail.com wrote:
Hello,
can you paste here the mod_init() and child_init() functions and say which one is line 239 (inside child init)? I expect some db init step for your module was not done.
Also, the output of 'bt full' might be useful.
Cheers, Daniel
On 12/3/11 6:35 AM, Jagdeep S wrote:
Hi All,
I am trying to create a new module under the kamailio source base, as part of understanding the framework. But when i start the Kamailio, i am seeing a core dump occuring when my new module is getting initiated and when the database is getting initialised. PFA the files attached containing the config file and source files used for creating module files.
I am using the "DEFAULT_DB_URL" as database uri. The core dump backtrace shows that the module init fails at the following point: (gdb) bt #0 0x00000000 in ?? () #1 0x00ef390d in child_init (rank=9172352) at my_mod.c:239 #2 0x081226be in init_mod (m=0xb7515a04) at sr_module.c:922 #3 0x08122630 in init_mod (m=0xb7515c78) at sr_module.c:919
The line 239 in my module file points to the child-init function which initializes the database connectivity ==> "mymod_dbh = mymod_dbf.init(&db_url);"
I have written the module using the template provided under the kamailio website. All the parameters are defined properly. Have no idea as to what is going wrong.
I tried debugging the core dump using gdb but of no much help. I am not able to run the gdb during runti sr-users@lists.sip-router.orgme due to which i am not able to add break points and check. Not sure what the problem is. That's why i generated core dump file and analysed the backtrace, but i can't add break points and run it again as the executable is not involved.
Can anyone please let me know what is the issue is or any pointers if i have missed some part of the code due to which the connectivity to db is not happening. Due to this i am not able to proceed further with the testing of my new module. Also any tips on how to do get the gdb debugging during runtime will also be very helpful.
Any help is appreciated :).
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
-- Daniel-Constantin Mierla -- http://www.asipto.com http://linkedin.com/in/miconda -- http://twitter.com/miconda
Hil,
Please find the wiki link below: http://www.kamailio.org/dokuwiki/doku.php/development:write-module
I had one more query on the psuedo variable. In the config file i am try to invoke a method as below:
if (!mymodulesave("mymodule", "$au"))
where "mymodule" is the database name of my new module. $au is the username pseudo variable.
The function prototype i have used in mymodule.h is as below:
int infygeosave(struct sip_msg* msg, str* _d, char* username)
when i print the username variable in the method i am getting the value as $au itself. Should i just pass the argument as (.., $au); rather than doing (.., "$au");
Please let me know your inputs.
Regards, Jagdeep S
On 12/6/11, Daniel-Constantin Mierla miconda@gmail.com wrote:
Hello,
On 12/6/11 5:28 AM, Jagdeep S wrote:
Hi Daniel,
Thanks for the reply. I was just seeing differences in various module initialization over the weekend and saw that the exports structure was slightly different from what i had taken from the template in the kamailio website.
ok, probably that doc is for older version. Was it a wiki page? If you can give the link, we can update it and make a note about versions and validity of the content.
Cheers, Daniel
I think the extra parameters/methods added in the latest versions were missing in my exports structure due to which my initialization used to fail. And during initialization i pass "pseudo variable" as argument to my method but i was not having the pseudo variable member in the structure. Since it was not initialized the db initialization failed.
I just changed the following structure from:
struct module_exports exports= { "mymodule", /* module's name */ DEFAULT_DLFLAGS, /*!< dlopen flags */ cmds, /* exported functions */ mod_params, /* param exports */ mod_stats, /* exported statistics */ mod_init, /* module initialization function */ 0, /* reply processing function FIXME Not sure when this is used */ mod_destroy, /* Destroy function */ child_init /* per-child init function */ };
to the following structure: struct module_exports exports= { "mymodule", /* module's name */ DEFAULT_DLFLAGS, /* dlopen flags */ cmds, /* Exported functions */ mod_params, /* Exported parameters */ mod_stats, /* exported statistics */ 0, /* exported MI functions */ 0, /* exported pseudo-variables */ 0, /* extra processes */ mod_init, /* module initialization function */ 0, /* response function */ mod_destroy,/* destroy function */ child_init /* child initialization function */ };
Now i am able to start the kamailio server with db initialized :) Anyways thanks for the response.
Regards, Jagdeep S
On 12/6/11, Daniel-Constantin Mierlamiconda@gmail.com wrote:
Hello,
can you paste here the mod_init() and child_init() functions and say which one is line 239 (inside child init)? I expect some db init step for your module was not done.
Also, the output of 'bt full' might be useful.
Cheers, Daniel
On 12/3/11 6:35 AM, Jagdeep S wrote:
Hi All,
I am trying to create a new module under the kamailio source base, as part of understanding the framework. But when i start the Kamailio, i am seeing a core dump occuring when my new module is getting initiated and when the database is getting initialised. PFA the files attached containing the config file and source files used for creating module files.
I am using the "DEFAULT_DB_URL" as database uri. The core dump backtrace shows that the module init fails at the following point: (gdb) bt #0 0x00000000 in ?? () #1 0x00ef390d in child_init (rank=9172352) at my_mod.c:239 #2 0x081226be in init_mod (m=0xb7515a04) at sr_module.c:922 #3 0x08122630 in init_mod (m=0xb7515c78) at sr_module.c:919
The line 239 in my module file points to the child-init function which initializes the database connectivity ==> "mymod_dbh = mymod_dbf.init(&db_url);"
I have written the module using the template provided under the kamailio website. All the parameters are defined properly. Have no idea as to what is going wrong.
I tried debugging the core dump using gdb but of no much help. I am not able to run the gdb during runti sr-users@lists.sip-router.orgme due to which i am not able to add break points and check. Not sure what the problem is. That's why i generated core dump file and analysed the backtrace, but i can't add break points and run it again as the executable is not involved.
Can anyone please let me know what is the issue is or any pointers if i have missed some part of the code due to which the connectivity to db is not happening. Due to this i am not able to proceed further with the testing of my new module. Also any tips on how to do get the gdb debugging during runtime will also be very helpful.
Any help is appreciated :).
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
-- Daniel-Constantin Mierla -- http://www.asipto.com http://linkedin.com/in/miconda -- http://twitter.com/miconda
-- Daniel-Constantin Mierla -- http://www.asipto.com http://linkedin.com/in/miconda -- http://twitter.com/miconda