Andrei Pelinescu-Onciul a écrit :
On Jun 14, 2010 at 17:07, marius zbihlei <marius.zbihlei@1and1.ro> wrote:
  
jerome.marchet@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}

};

      
Hello Jerome,

It seems the prototype is wrong in the devel guide.

The cmd_export_t should have 6 members instead of 5. It works with

static cmd_export_t cmds[] = {

{"topoh_required", (cmd_function)m_topoh, 1, fixup_uint_null , 0,
REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE},

{0, 0, 0, 0, 0, 0}

};


Can you give me the exact URL of the docs so I can also update them?
    

Actually it depends on which module interface one uses.
The ser modules interface uses 5 parameters, while the kamailio one 6
 (kamailio has an extra free_fixup).
To find out what version a module uses:
grep MOD_INTERFACE modules*/mod_name/Makefile .

Andrei
  

Ok Thank you for you answer Marius and Andrei. I thought this module interface used only  5 parameters. In the devel guide, the example is with 6 parameters.

http://www.asipto.com/pub/kamailio-devel-guide/#c16_add_cmd_function

But when I studied the code of Sanity module,  only 5 parameters  are used for sanity_check.

static cmd_export_t cmds[] = {
    {"sanity_check", (cmd_function)sanity_check, 0, 0, REQUEST_ROUTE},
    {"sanity_check", (cmd_function)sanity_check, 1, sanity_fixup, REQUEST_ROUTE},
    {"sanity_check", (cmd_function)sanity_check, 2, sanity_fixup, REQUEST_ROUTE},
    {0, 0, 0, 0}
};

That why i made this mistake

Sorry

and thank you for your help.

Regards,

Jérôme