<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p><tt>Hi Artem!</tt></p>
    <p><tt><br>
        Here are a few examples, so you better understand how the branch
        array gets populated after you do a lookup():</tt></p>
    <p><tt>lookup();<br>
      </tt></p>
    <p><tt>- with 1 device  behind an AoR: R-URI is updated (branch #1),
        $branch array has 0 elements</tt><br>
      <tt>- with 2 devices behind an AoR: R-URI is updated (branch #1),
        $branch array has 1 element (index 0, corresponding to branch
        #2)</tt><br>
      <tt>- with 3 devices behind an AoR: R-URI is updated (branch #1),
        $branch array has 2 elements (indexes 0 and 1, corresponding to
        branches #2 and #3)</tt></p>
    <p><tt>...</tt></p>
    <p><tt>Regarding deleting/adding branches vs. increasing
        MAX_BRANCHES (in config.h), I'd choose the second option. It
        will only cost you a bit more memory for each transaction.<br>
      </tt></p>
    <pre class="moz-signature" cols="72">Liviu Chircu
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 23.08.2016 18:31, Чалков Артём
      wrote:<br>
    </div>
    <blockquote cite="mid:10091471966304@web11m.yandex.ru" type="cite">
      <div> </div>
      <div> </div>
      <div>Ok, i found my mistake with 2nd part (deleting branches) - it
        seems like i cant delete branches from failure_route by
        $T_branch_idx because outside branch_route it always have value
        0. Okay, so, can i somehow delete "expired" branches (to not
        reach branch limit. yes, i know that i can extend the limit, but
        i think its a bad idea) or its totally impossible?
        <div> </div>
        <div>Also, first part of my question (about accessing data) is
          still actual.<br>
          <br>
          <div>23.08.2016, 17:21, "Чалков Артём" &lt;<a
              moz-do-not-send="true" href="mailto:achalkov@ya.ru">achalkov@ya.ru</a>&gt;:</div>
          <blockquote type="cite">
            <div>
              <p>Hi all!<br>
                Could you tell me how can i get access to the data of
                branches, generated by lookup()?</p>
              <p>I have something like that:</p>
              <p>...<br>
                route[LOOKUP] {<br>
                ...<br>
                lookup("location");<br>
                t_on_branch("ON_BRANCH");<br>
                ...<br>
                }</p>
              <p>branch_route["ON_BRANCH"] {<br>
                ...<br>
                xlog("L_INFO", "[ON_BRANCH] Current branch data: idx =
                $T_branch_idx, uri = $(branch(uri)[$T_branch_idx])");<br>
                ...<br>
                }<br>
                ...</p>
              <p>When lookup found more than 1 contact it appending a
                new branches, but i could read any data only from first
                of them:</p>
              <p>Aug 23 16:56:03 opensips-test
                /usr/sbin/opensips[18629]: [ON_BRANCH] Current branch
                data: idx = 0, uri = sip:name@domain<br>
                Aug 23 16:56:03 opensips-test /usr/sbin/opensips[18629]:
                [ON_BRANCH] Current branch data: idx = 1, uri =
                &lt;null&gt;<br>
                Aug 23 16:56:03 opensips-test /usr/sbin/opensips[18629]:
                [ON_BRANCH] Current branch data: idx = 2, uri =
                &lt;null&gt;</p>
              <p> </p>
              <p>So, i can't access to any data of any branch except
                first one. Even more:</p>
              <p>I need to delete branches after they fires fr_times
                (local 408 is received). To do that, i trying to call
                remove_branch($T_branch_idx) from failure_route:</p>
              <p>...<br>
                failure_route[ON_FAIL] {<br>
                ...<br>
                if (t_check_status("408")) {<br>
                ...<br>
                remove_branch($T_branch_idx);<br>
                route(LOOKUP);<br>
                }<br>
                ...<br>
                }</p>
              <p>but after that, all branches still on their places. So,
                can i somehow delete these "expired" branches?</p>
              <p>version: opensips 2.1.4 (x86_64/linux)</p>
            </div>
            <div>
              <p>_______________________________________________<br>
                Users mailing list<br>
                <a moz-do-not-send="true">Users@lists.opensips.org</a><br>
                <a moz-do-not-send="true"
                  href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
                  target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a></p>
            </div>
          </blockquote>
          <div> </div>
          <div> </div>
          <div> </div>
          <div> </div>
        </div>
      </div>
      <div> </div>
      <div>-------- Завершение пересылаемого сообщения --------</div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>