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

SourceForge.net noreply at sourceforge.net
Tue Mar 17 19:14:45 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", "auto_inv_100_reason", "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-17 19:14

Message:
Hi Henning, Hi Klaus,

as requested I've ported the patch to 
sip-router :-)

I renamed the param to "auto_inv_100_reason" 
as sip-router has a param "auto_inv_100" to 
decide if the reply 100 is send automatically 
or not.

After some changes the patch was compiled 
without warnings and tested with following 
git tree "http://git.sip-router.org/sip-router"


new doc part because of other default value and 
relation to "auto_inv_100" param in sip-router TM:

1.3.25. auto_inv_100_reason (string)

Define the text reason for the 100 reply which is
automatically generated by the TM module after 
receiving an INVITE request if "auto_inv_100" = 1 (default).

Default value is "trying -- your call is important to us".

Example 25. Set auto_inv_100_reason parameter
...
modparam("tm", "auto_inv_100_reason", "Trying")
...


regards,
Andreas
File Added: sip-router_reply_reason_100.patch

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

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

Message:
OK, then I would suggest that you apply the patch first to Kamailio trunk
and I'll will
provide a working patch for sip-router in a second step (as soon as I
fixed my trouble with git) ;-)

OK for you?

regards,
Andreas

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

Comment By: Henning Westerholt (henningw)
Date: 2009-03-17 15:13

Message:
Yes, this is true. I just tested to apply it to the sip-router tm, as
expected it don't work.

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

Comment By: Nobody/Anonymous (nobody)
Date: 2009-03-17 14:22

Message:
IMO it is a useful feature. Nevertheless it should be implemented in
sip-router tm module.
klaus

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

Comment By: Andreas Heise (aheise)
Date: 2009-03-16 19:32

Message:

Hi Henning,

I found my initial mistake, I called "strlen" in the function "mod_init"
after the return so it was never executed. Now it's fix and tested.

New patch is attached please review and commit, please also add the
following changed description to the TM module documentation.


1.3.21. reply_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 reply_reason_100 parameter
...
modparam("tm", "reply_reason_100", "Trying")
...


many thanks again,
Andreas
 
File Added: relay_reason_100_ed02.patch

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

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

Message:
Using a str is fine, you don't need to change it to a char*. For an example
take a look at the domain module, domain_mod.c file, the db_url parameter.
In the module parameter you just give the str.s, and put a str.len =
strlen(str.s) in the mod_init. You declare it as extern in the .h file, and
in the .c you initialize it with the default content as normal str. More
examples can be also found in the carrierroute.c file of cr.

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

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