[Kamailio-Devel] [ openser-Patches-2687309 ] new modparam("tm", "relay_reason_100", "Trying")

SourceForge.net noreply at sourceforge.net
Mon Mar 16 16:11:18 CET 2009


Patches item #2687309, was opened at 2009-03-15 03:13
Message generated for change (Comment added) made by aheise
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=2687309&group_id=139143

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: ver devel
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Andreas Heise (aheise)
Assigned to: Nobody/Anonymous (nobody)
Summary: new modparam("tm", "relay_reason_100", "Trying")

Initial Comment:

Hello,

attached is a patch against trunk version for a new modparam("tm", "relay_reason_100", "Trying") which
allow to modify the value without recompileing

following text should be added to the documentation:

1.3.21. relay_reason_100 (string)

   Define the text reason for the 100 reply generated
   by the TM module after receiving an INVITE request.

   Default value is "Giving a Try".

   Example 1.21. Set relay_reason_100 parameter
...
modparam("tm", "relay_reason_100", "Trying")
...

regards,
Andreas

----------------------------------------------------------------------

>Comment By: Andreas Heise (aheise)
Date: 2009-03-16 16:11

Message:
Hi Henning,

thanks for your help, but I've still trouble

I changed it to char*

tm.c:	char* relay_reason_100 = "Giving a Try";
tm.h:	extern char* relay_reason_100;

if I dump "relay_reason_100" in mod_init with LM_INFO then the string is
complete with the correct len

LM_INFO("relay_reason_100 value is <%s>, len=<%d>\n", relay_reason_100,
strlen(relay_reason_100));

Mar 16 15:44:31 [26094] INFO:tm:mod_init: relay_reason_100 value is <my
individual reason text>, len=<25>  


but if t_funcs.c call "t_reply( t, p_msg , 100 , &relay_reason_100);" then
the text is now "" instead of "my individual reason text"

I check some other modules, but I don't find an example which give a
STR_PARAM as char*
and provide it extern most of them are str like my first try. 

How could I update the len? How could change the char* to str?

Any additional hint would great, please note I'm not a full time
programmer as you ;-)


----------------------------------------------------------------------

Comment By: Henning Westerholt (henningw)
Date: 2009-03-16 11:38

Message:
Hi Andreas,

there are some small issues with the patch. You need to give the char * to
the modparam statement and not the str. And then you need to update the
length in the mod_init function of the module. Take a look at other modules
that uses str parameters for an example. This should also fix the problem
you observed.

Henning

----------------------------------------------------------------------

Comment By: Andreas Heise (aheise)
Date: 2009-03-15 03:52

Message:
after some testing I found an issue with the patch, the default value
"Giving a Try" is a string of 12 chars, but if the string is defined by the
modparam e.g. "Trying" then the string has still 12 chars, the len is not
updated that means the the string is truncated or filled by other values
and may be a risk of memory leak?. I don't found the cause for this issue
and hope an core developer can help to fix this issue.

many thanks,
Andreas

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=2687309&group_id=139143



More information about the Devel mailing list