[sr-dev] problem with topoh module development

marius zbihlei marius.zbihlei at 1and1.ro
Mon Jun 14 11:20:19 CEST 2010


jerome.marchet at orange-ftgroup.com wrote:
>
> Hi all,
>
>
> I use Kamailio 3.0.0 currently, but I have a problem with the topoh 
> module.
>
>
> Indeed, I want to create an exported function called 
> « topoh_required »( so, to be used in the config file) for this 
> module, I read and execute the instruction of the devel guide to do this:
>
>
> in topoh_mod.c, I add or modify:
>
>
> int th_param_mask = 0;
>
>
> ...
>
>
> static cmd_export_t cmds[] = {
>
> {"topoh_required", (cmd_function)m_topoh, 1, fixup_uint_null , 
> REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE},
>
> {0, 0, 0, 0, 0}
>
> };
>
>
> ...
>
>
> struct module_exports exports= {
>
> "topoh",
>
> DEFAULT_DLFLAGS, /* dlopen flags */
>
> *cmds, /*added*/*
>
> params,
>
> 0, /* exported statistics */
>
> 0, /* exported MI functions */
>
> 0, /* exported pseudo-variables */
>
> 0, /* extra processes */
>
> mod_init, /* module initialization function */
>
> 0,
>
> 0,
>
> 0 /* per-child init function */
>
> };
>
>
> ...
>
>
> static int m_topoh(struct sip_msg *msg, char *value)
>
> {
>
> unsigned int temp = (unsigned int) value;
>
> if(temp==1)
>
> {
>
> th_param_mask=1;
>
> return 1;
>
> }
>
> else if (temp==0)
>
> {
>
> th_param_mask=0;
>
> return 0;
>
> }
>
> else return -1;
>
> }
>
>
> I do make module and make ... no problem,
>
>

Hello Jerome

Have you installed your module? Can you double check that the module 
loaded from the config is the same as your patched one? You can also use 
full paths to load module, so I suggest to do a

loadmodule "/home/path/to/kamailio/modules/topoh/topoh.so"

Also check if the m_topoh function is compiled by looking at the symbol 
table in the topoh.so file

nm -a topoh.so | grep m_topoh should work just fine.

As I look thru your code, I can't see any possible errors. I will look 
more closely if with these suggestions don't work

Cheers
Marius


> but when I start Kamailio with the function topoh_required(« 1 »); in 
> the config file, it says:
>
>
>
> Not starting kamailio: invalid configuration file!
>
>
> 0(19524) : <core> [cfg.y:3329]: parse error in config file 
> /usr/local/etc/kamailio/kamailio.cfg, line 328, column 20: unknown 
> command, missing loadmodule?
>
>
> ERROR: bad config file (1 errors)
>
>
> So It doesn't know the topoh_required function. But I don't know how 
> to solve this problem.
>
>
> Can somebody help me please? Thank you very much for your help.
>
>
> Jérôme
>
>
>




More information about the sr-dev mailing list