Hi Ron,
if you want to have same function but with different no of params, you
have to exported twice, for each no params:
static cmd_export_t commands[] = {
{"route_fubar", fubar, 1, 0, REQUEST_ROUTE },
{"route_fubar", fubar, 0, 0, REQUEST_ROUTE },
{0, 0, 0, 0, 0}
};
the param no is used to lookup the functions!
The unused params are set to zero.
regards,
bogdan
Ron Winacott wrote:
Hello all,
I have a question about the module C function arguments. After you map the
route function to the module C function, the C function has three arguments,
the struct sip_msg* msg, char* str1 and char* str2.
So my question is, if the routing function is called without passing any
arguments will str1 and str2 be NULL or are they pointing at "junk on the
stack"?
I would like to create a function that has an optional flag that may or may
not be passed as str1 and the code would look something like:
module:
static cmd_export_t commands[] = {
{"route_fubar", fubar, 1, 0, REQUEST_ROUTE },
{0, 0, 0, 0, 0}
};
static int
fubar(struct sip_msg* msg, char* str1, char* str2) {
if (str1) {
do_optional_stuff()
}
...
}
ser.cfg :
if (method=="INVITE") {
fubar("flag");
}
else {
fubar();
}
Thanks
ronw.
_______________________________________________
Devel mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/devel