[sr-dev] why new tcp connection?

Juha Heinanen jh at tutpro.com
Sun Nov 15 10:26:49 CET 2009


while doing quite extensive tests on
add_contact_alias()/handle_ruri_alias() functions, i
noticed a flaw in the reply processing example:

   if (!isbflagset("TO_PROXY") {
       if (is_avp_set("$avp(rr_count)")) { 
            if ($rr_count == $avp(rr_count) + 1) {
               route(ADD_CONTACT_ALIAS);
            };
       } else {
            route(ADD_CONTACT_ALIAS);
       }
    }

the flaw is that proxy may add double record route instead of a single
one and if is does so, then test

            if ($rr_count == $avp(rr_count) + 1) {

is wrong.  i solved the problem by introducing a second pv
$rr_top_count, which has value 2 if top rr is a double one and 1 if not.
using it, the test can be written correctly as

            if ($rr_count == $avp(rr_count) + $rr_top_count) {

i have updated nathelper.c and alias_example.txt in
http://box.tutpro.com/tmp, but would really like to commit the
new nathelper.c and update docs to sr_3.0.  since these new functions
and pvs don't touch any of the existing nathelper code, the commit
should be a safe thing to do.

-- juha



More information about the sr-dev mailing list