<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><tt>Hi Rodrigo,</tt></p>
    <p><br>
    </p>
    <p><tt>Just trying to understand the flow here - could it be
        actually a Re-INVITE that goes through your sequential routing
        block, thus lookup() is not called, leaving $avp(attr) NULL
        throughout that transaction?<br>
      </tt></p>
    <p><tt><br>
      </tt></p>
    <p><tt>Regardless of the above, in OpenSIPS terms, each "branch"
        points to a different destination. In our case, we're talking
        about a retry, not a serial/parallel forked call. Which means
        that you should only bother with $T_branch_idx if a lookup()
        could yield more than one device to be contacted for the same
        AoR.</tt></p>
    <p><tt><br>
      </tt></p>
    <p><tt>Best regards,<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 29.08.2017 18:05, Rodrigo Pimenta
      Carvalho wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:DM5PR02MB321291E32C824C707B11D5D4B59F0@DM5PR02MB3212.namprd02.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
      <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;"
        dir="ltr">
        <p><br>
        </p>
        <p>Dear SIPusers,</p>
        <p><br>
        </p>
        <p>In my project I use to keep a valuable information in table
          location. This is about the state of a subscriber's
          localization.</p>
        <p>I have to read such information for the callees, every time a
          new branch is created and every time a INVITE is answered with
          SIP OK.</p>
        <p>So, my OpenSIPS configuration has something similar to the
          following code:</p>
        <p><br>
        </p>
        <p><span>1    route{</span></p>
        <p>2           ...  // hidden code for simplification.<br>
        </p>
        <p>3           <span>lookup("location","m")</span></p>
        <p>4           ...<br>
        </p>
        <p>5       <span>    route(relay);</span><br>
        </p>
        <p>6    }</p>
        <p><br>
        </p>
        <p><span>7    route[relay]</span>{</p>
        <div>8       if (is_method("INVITE"))
{                                                                                                                                                                         
           <br>
          9                ...<br>
          10               
t_on_branch("per_branch_ops");                                                                                                                                                                                 
           <br>
          11               
t_on_reply("handle_nat");                                                                                                                                                                                  
           <br>
          12               
t_on_failure("missed_call");                                                                                                                                       
           <br>
          13     }  </div>
        14     ...
        <p>15  }</p>
        <p><br>
        </p>
        <p><span>16    branch_route[per_branch_ops] { <br>
            17        ....</span></p>
        <p><span><span>18        $(avp(attr)[$T_branch_idx])</span><br>
          </span></p>
        <p><span>19        ...<br>
          </span></p>
        <p><span>20    }</span></p>
        <p><span><br>
          </span></p>
        <p><span><span>21    onreply_route[handle_nat] {</span><br>
          </span></p>
        <p><span>22        ...</span></p>
        <p><span>23        <span>$(avp(attr)[$T_branch_idx])</span><br>
          </span></p>
        <p><span>24        ...<br>
          </span></p>
        <p><span>25    }</span></p>
        <p>26    ...<br>
        </p>
        <p><br>
        </p>
        <p>In a determined call, when the OpenSIPS receives the INVITE
          and then a SIP OK (200), the code gets right value in lines 18
          and 23.</p>
        <p>In such call, the SIP OK (from callee) offers a kind of video
          that the caller can't support. In this case the caller sends
          another SIP INVITE with inactive video (SDP).</p>
        <p>In this moment, OpenSIPS gets this second INVITE and create a
          new branch.</p>
        <p>However, for this new branch, lines 18 and 23 give me NULL
          for <span><span>$(avp(attr)[$T_branch_idx])</span></span>.</p>
        <p><br>
        </p>
        <p>How to solve this issue?</p>
        <p><br>
        </p>
        <p>Any hint will be very helpful!!</p>
        <p><br>
        </p>
        <p>Best regards!</p>
        <p><br>
        </p>
        <p>P.S.: I'm not expert in SIP.<br>
        </p>
        <p><br>
        </p>
        <div id="Signature">
          <div name="divtagdefaultwrapper"
            style="font-family:Calibri,Arial,Helvetica,sans-serif;
            font-size:; margin:0">
            <div class="BodyFragment"><font size="2">
                <div class="PlainText">RODRIGO PIMENTA CARVALHO<br>
                  Inatel Competence Center<br>
                  Software<br>
                  Ph: +55 35 3471 9200 RAMAL 979<br>
                </div>
              </font></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>