<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello,</p>
    <div class="moz-cite-prefix">On 18.08.20 08:05, Cindy Leung wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CA+J76DjPC4u4uQJj+E362FTUkEp7MKmrsXDCHARwrUO7ktt92g@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hello all,
        <div><br>
        </div>
        <div>Just started using v5.4.0 on our system and I noticed a
          change in behavior when doing the append_branch,
          t_load_contacts, and t_next_contacts combo.  Previously using
          v5.3.4 and it appears to be fine.</div>
        <div><br>
        </div>
        <div>Here's the call scenario: Kamailio receives a call to
          <a class="moz-txt-link-freetext" href="sip:1001@carrierB">sip:1001@carrierB</a>.  Kamailio sees carrierB and appends 2
          contacts: <a href="http://gateway1.carrierB.com"
            moz-do-not-send="true">gateway1.carrierB.com</a>;q=0.3 and <a
            href="http://gateway2.carrierB.com" moz-do-not-send="true">gateway2.carrierB.com</a>;q=0.2. 
          After t_load_branches(0),</div>
      </div>
    </blockquote>
    <p>first, I am not finding the t_load_branches() function, is it
      supposed to be t_load_contacts()?</p>
    <p>The, supposing it was the later, afaik, the load contacts was
      putting the branches in internal xavps, not pushing to the r-uri.
      The append_branch() was not changing the first branch (the r-uri)
      but adding extra. So if you have the invite coming in to <a class="moz-txt-link-abbreviated" href="mailto:u1@s.com">u1@s.com</a>
      and do append_branch(<a class="moz-txt-link-abbreviated" href="mailto:u2@s.com">u2@s.com</a>) and append_branch(<a class="moz-txt-link-abbreviated" href="mailto:u3@s.com">u3@s.com</a>), then
      it will be 3 branches that will go out in case of parallel
      forking.</p>
    <p>With t_load_contacts() and t_next_contacts(), these 3 branches
      should be prepared to do serial forking.</p>
    <p>Now, I haven't really used these functions myself to comment
      more, it is based on what append_branch() is doing: adding extra
      branches and keeping the first branch (r-uri) untouched.<br>
    </p>
    <p>But if you found a different behaviour than expected, open a bug
      on issue tracker and we can refer the developer of commit
      1399714fbba63732f94eb8034dabb1e565ca832a (which added proportional
      load) to review it.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <blockquote type="cite"
cite="mid:CA+J76DjPC4u4uQJj+E362FTUkEp7MKmrsXDCHARwrUO7ktt92g@mail.gmail.com">
      <div dir="ltr">
        <div> I expect to see $rd to be changed to <a
            href="http://gateway1.carrierB.com" moz-do-not-send="true">gateway1.carrierB.com</a>,
          but it's not.</div>
        <div><br>
        </div>
        <div>This is the piece of config I'm trying to debug:</div>
        <div>        <font face="monospace">xlog ("=== branch 0:
            $(branch(uri)[0]), $(branch(q)[0])\n");<br>
                xlog ("=== branch 1: $(branch(uri)[1]),
            $(branch(q)[1])\n");<br>
                t_load_contacts(0);<br>
                while (t_next_contacts()) {<br>
                    xlog ("=== rd = $rd\n");<br>
                }</font><br>
        </div>
        <div><br>
        </div>
        <div>This is the log I get.  It appears to use the backup
          contact first.</div>
        <div><font face="monospace">ERROR: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818053427-1-23@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818053427-1-23@172.18.1.21</a>:
            === branch 0: <a
              href="mailto:sip%3A1001@gateway2.carrierB.com"
              moz-do-not-send="true">sip:1001@gateway2.carrierB.com</a>;transport=udp,
            200<br>
            ERROR: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818053427-1-23@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818053427-1-23@172.18.1.21</a>:
            === branch 1: <a
              href="mailto:sip%3A1001@gateway1.carrierB.com"
              moz-do-not-send="true">sip:1001@gateway1.carrierB.com</a>;transport=tcp,
            300<br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818053427-1-23@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818053427-1-23@172.18.1.21</a>:
            tm [t_serial.c:522]: t_load_contacts(): load_contact mode
            selected: 0<br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818053427-1-23@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818053427-1-23@172.18.1.21</a>:
            tm [t_serial.c:340]: ki_t_load_contacts_mode(): nr_branches
            is 2<br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818053427-1-23@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818053427-1-23@172.18.1.21</a>:
            <core> [core/xavp.c:539]: xavp_destroy_list():
            destroying xavp list 0x7f983cb66608<br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818053427-1-23@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818053427-1-23@172.18.1.21</a>:
            tm [t_serial.c:890]: ki_t_next_contacts(): Appending branch
            <a href="mailto:uri-%27sip%3A1001@gateway1.carrierB.com"
              moz-do-not-send="true">uri-'sip:1001@gateway1.carrierB.com</a>;transport=tcp'
            dst-'' path-'' inst-'' ruid-'' location_ua-''<br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818053427-1-23@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818053427-1-23@172.18.1.21</a>:
            <core> [core/xavp.c:539]: xavp_destroy_list():
            destroying xavp list 0x7f983cb66350<br>
            ERROR: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818053427-1-23@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818053427-1-23@172.18.1.21</a>:
            === rd = carrierB<br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818053427-1-23@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818053427-1-23@172.18.1.21</a>:
            <core> [core/xavp.c:539]: xavp_destroy_list():
            destroying xavp list 0x7f983cb66078<br>
            ERROR: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818053427-1-23@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818053427-1-23@172.18.1.21</a>:
            === rd = <a href="http://gateway2.carrierB.com"
              moz-do-not-send="true">gateway2.carrierB.com</a><br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818053427-1-23@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818053427-1-23@172.18.1.21</a>:
            tm [t_serial.c:627]: ki_t_next_contacts(): no contacts in
            contacts_avp - we are done!</font><br>
        </div>
        <div><font face="monospace"><br>
          </font></div>
        <div><font face="arial, sans-serif">t_load_contacts(1) works a
            little better.  But we don't need the probability feature.</font></div>
        <div><font face="monospace">ERROR: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818054736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818054736-1-21@172.18.1.21</a>:
            === branch 0: <a
              href="mailto:sip%3A1001@gateway2.carrierB.com"
              moz-do-not-send="true">sip:1001@gateway2.carrierB.com</a>;transport=udp,
            200<br>
            ERROR: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818054736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818054736-1-21@172.18.1.21</a>:
            === branch 1: <a
              href="mailto:sip%3A1001@gateway1.carrierB.com"
              moz-do-not-send="true">sip:1001@gateway1.carrierB.com</a>;transport=tcp,
            300<br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818054736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818054736-1-21@172.18.1.21</a>:
            tm [t_serial.c:522]: t_load_contacts(): load_contact mode
            selected: 1<br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818054736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818054736-1-21@172.18.1.21</a>:
            tm [t_serial.c:340]: ki_t_load_contacts_mode(): nr_branches
            is 2<br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818054736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818054736-1-21@172.18.1.21</a>:
            tm [t_serial.c:280]: t_load_contacts_proportional():
            proportionally selected contact with uri: <a
              href="mailto:sip%3A1001@gateway1.carrierB.com"
              moz-do-not-send="true">sip:1001@gateway1.carrierB.com</a>;transport=tcp
            (q: 300, random: 287, q_index: 500, q_total: 500)<br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818054736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818054736-1-21@172.18.1.21</a>:
            tm [t_serial.c:280]: t_load_contacts_proportional():
            proportionally selected contact with uri: <a
              href="mailto:sip%3A1001@gateway2.carrierB.com"
              moz-do-not-send="true">sip:1001@gateway2.carrierB.com</a>;transport=udp
            (q: 200, random: 157, q_index: 200, q_total: 200)<br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818054736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818054736-1-21@172.18.1.21</a>:
            tm [t_serial.c:303]: t_load_contacts_proportional():
            proportionally added backup contact with uri:
            <a class="moz-txt-link-freetext" href="sip:1001@carrierB">sip:1001@carrierB</a> SIP/2.0#015#012Via: SIP/2.0/UDP
            172.18.1.21:5060;branch=z9hG4bK-21-1-0 blah blah blah (q:
            -1)<br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818054736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818054736-1-21@172.18.1.21</a>:
            <core> [core/xavp.c:539]: xavp_destroy_list():
            destroying xavp list 0x7f6e457ec078<br>
            ERROR: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818054736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818054736-1-21@172.18.1.21</a>:
            === rd = <a href="http://gateway1.carrierB.com"
              moz-do-not-send="true">gateway1.carrierB.com</a><br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818054736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818054736-1-21@172.18.1.21</a>:
            <core> [core/xavp.c:539]: xavp_destroy_list():
            destroying xavp list 0x7f6e457ec350<br>
            ERROR: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818054736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818054736-1-21@172.18.1.21</a>:
            === rd = <a href="http://gateway2.carrierB.com"
              moz-do-not-send="true">gateway2.carrierB.com</a><br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818054736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818054736-1-21@172.18.1.21</a>:
            <core> [core/xavp.c:539]: xavp_destroy_list():
            destroying xavp list 0x7f6e457ec608<br>
            ERROR: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818054736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818054736-1-21@172.18.1.21</a>:
            === rd = carrierB<br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818054736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818054736-1-21@172.18.1.21</a>:
            tm [t_serial.c:627]: ki_t_next_contacts(): no contacts in
            contacts_avp - we are done!</font><font face="arial,
            sans-serif"><br>
          </font></div>
        <div><font face="arial, sans-serif"><br>
          </font></div>
        <div><font face="arial, sans-serif">As a comparison, this is
            what we've been getting in 5.3.4</font></div>
        <div><font face="monospace">ERROR: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818055736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818055736-1-21@172.18.1.21</a>:
            === branch 0: <a
              href="mailto:sip%3A1001@gateway2.carrierB.com"
              moz-do-not-send="true">sip:1001@gateway2.carrierB.com</a>;transport=udp,
            200<br>
            ERROR: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818055736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818055736-1-21@172.18.1.21</a>:
            === branch 1: <a
              href="mailto:sip%3A1001@gateway1.carrierB.com"
              moz-do-not-send="true">sip:1001@gateway1.carrierB.com</a>;transport=tcp,
            300<br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818055736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818055736-1-21@172.18.1.21</a>:
            tm [t_serial.c:191]: ki_t_load_contacts(): nr_branches is 2<br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818055736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818055736-1-21@172.18.1.21</a>:
            <core> [core/xavp.c:529]: xavp_destroy_list():
            destroying xavp list 0x7fe13146a680<br>
            ERROR: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818055736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818055736-1-21@172.18.1.21</a>:
            === rd = <a href="http://gateway1.carrierB.com"
              moz-do-not-send="true">gateway1.carrierB.com</a><br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818055736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818055736-1-21@172.18.1.21</a>:
            <core> [core/xavp.c:529]: xavp_destroy_list():
            destroying xavp list 0x7fe13146a3a8<br>
            ERROR: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818055736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818055736-1-21@172.18.1.21</a>:
            === rd = <a href="http://gateway2.carrierB.com"
              moz-do-not-send="true">gateway2.carrierB.com</a><br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818055736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818055736-1-21@172.18.1.21</a>:
            <core> [core/xavp.c:529]: xavp_destroy_list():
            destroying xavp list 0x7fe13146a0d0<br>
            ERROR: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818055736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818055736-1-21@172.18.1.21</a>:
            === rd = carrierB<br>
            DEBUG: IBG_LOG: <a
              href="mailto:sipp-ci1-20200818055736-1-21@172.18.1.21"
              moz-do-not-send="true">sipp-ci1-20200818055736-1-21@172.18.1.21</a>:
            tm [t_serial.c:460]: ki_t_next_contacts(): no contacts in
            contacts_avp - we are done!</font><font face="arial,
            sans-serif"><br>
          </font></div>
        <div><span style="font-family:arial,sans-serif"><br>
          </span></div>
        <div><span style="font-family:arial,sans-serif">Is there
            anything else that's been changed in branch building that we
            should pay attention to?  Thanks.</span><br>
        </div>
        <div><span style="font-family:arial,sans-serif"><br>
          </span></div>
        <div><span style="font-family:arial,sans-serif"><br>
          </span></div>
        <div><span style="font-family:arial,sans-serif"><br>
          </span></div>
        <div><span style="font-family:arial,sans-serif">Cindy</span></div>
        <div><font face="arial, sans-serif"><br>
          </font></div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Funding: <a class="moz-txt-link-freetext" href="https://www.paypal.me/dcmierla">https://www.paypal.me/dcmierla</a></pre>
  </body>
</html>