[Kamailio-Devel] Porting modules from OpenSER-1.2

Daniel Corbe daniel.junkmail at gmail.com
Fri Nov 7 15:26:39 CET 2008


I have a few questions about porting modules from OpenSER 1.2
1) Obviously the LOG function has been replaced with LM_* (LM_INFO, LM_DBG,
etc)

2) There seems to be extra parameters now to functions when they're being
called from the config file, and I'm not sure why they're there and what
they're needed for.  I tried to make some sense of it from the cfgutils
module with no luck.  Take the m_sleep function for example (called with
sleep() from the config):

static int m_sleep(struct sip_msg *msg, char *time, char *str2);


People seem to randomly name these extra function parameters:

static int dbg_abort(struct sip_msg* msg, char* foo, char* bar);


The reason this is throwing a stone into my shoe is because I'm trying to
figure out how the usrloc module works.  I am attempting to "cache" register
requests by sending them upstream and trapping the response.  To do this,
obviously I need to reimplement the save command, which uses such
paramaters:


int save(struct sip_msg* _m, char* _d, char* _cflags);


If I understand this correctly, the paramaters are arbitrary, they're always
char* (meaning passing ints requires a fixup function).


Does this mean that I'm always limited to only two parameters per function?
 Even if I need more or less?


Supposing I need to func(param, param, param), would I add an extra char*
and define the function like:


int func(struct sip_msg *m, char *p1, char *p2, char *p3);


3) Any other gotchas I should be aware of?


Thanks.


-Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kamailio.org/pipermail/devel/attachments/20081107/e62991dc/attachment.htm 


More information about the Devel mailing list