#207 new modparam("tm", "auto_inv_100_reason", "Trying")

ver devel
closed-accepted
modules (140)
5
2009-03-19
2009-03-15
No

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

Discussion

  • Andreas Heise

    Andreas Heise - 2009-03-15

    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

     
  • Henning Westerholt

    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

     
  • Andreas Heise

    Andreas Heise - 2009-03-16

    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 ;-)

     
  • Henning Westerholt

    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.

     
  • Andreas Heise

    Andreas Heise - 2009-03-16

    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

     
  • Andreas Heise

    Andreas Heise - 2009-03-16
    • summary: new modparam("tm", "relay_reason_100", "Trying") --> new modparam("tm", "reply_reason_100", "Trying")
     
  • Nobody/Anonymous

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

     
  • Henning Westerholt

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

     
  • Andreas Heise

    Andreas Heise - 2009-03-17

    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

     
  • Andreas Heise

    Andreas Heise - 2009-03-17

    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

     
  • Andreas Heise

    Andreas Heise - 2009-03-17
    • summary: new modparam("tm", "reply_reason_100", "Trying") --> new modparam("tm", "auto_inv_100_reason", "Trying")
     
  • Andreas Heise

    Andreas Heise - 2009-03-17

    File Added: sip-router_auto_inv_100_reason.patch

     
  • Andreas Heise

    Andreas Heise - 2009-03-18

    Hi again,
    I've update the Kamailio patch to be compatible with the changes from Iñaki last night (revision 5718) and also renamed the param to "auto_inv_100_reason" to have the same name in Kamailio tm and sip-router tm.
    have a nice day,
    Andreas
    File Added: kamailio_auto_inv_100_reason.patch

     
  • Andreas Heise

    Andreas Heise - 2009-03-18

    I've deeper analyse the difference of Kamailio and sip-router tm modules and found that in sip-router tm the modparams are total different implemented as in Kamailio. sip-router use the config.* which is included by the tm.c. My sip-router patch is working, but I fear Jiri and Jan will not amused by breaking there rules ;-). I'll refurbish the sip-router patch and send the new patch directly to the sip-router devel list, so Jan could review the code to ensure the correct style before commit. Anyway I realized that the merge into sip-router will not be easy for all of us.

    For this ticket I prefer that you commit the Kamailio patch and update the documentation, so we could close this ticket after on Kamailio side.

     
  • Daniel-Constantin Mierla

    Hello,

    I will commit the patch, but not sure we need tm.h just for one external declaration. Can be done in t_funcs.c directly.

    As a note for sip-router patch, the license to additions in core and tm have to be under BSD.

    Thanks,
    Daniel

     
  • Daniel-Constantin Mierla

    Patch committed without tm.h. Thanks.

     
  • Daniel-Constantin Mierla

    • assigned_to: nobody --> miconda
    • status: open --> closed-accepted
     
  • Henning Westerholt

    now also in sip-router, commit 9d472adf9d2dd7241feeedd6b64699e2a6485fd0

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks