<html>
<head>
<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>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi.</p>
<p><br>
</p>
<p>Very good.</p>
<p><br>
</p>
<p>Thank you very much!</p>
<p><br>
</p>
<p><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>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>De:</b> Users <users-bounces@lists.opensips.org> em nome de Liviu Chircu <liviu@opensips.org><br>
<b>Enviado:</b> quarta-feira, 30 de agosto de 2017 06:44<br>
<b>Para:</b> users@lists.opensips.org<br>
<b>Assunto:</b> Re: [OpenSIPS-Users] $(avp(attr)[$T_branch_idx]) is NULL for second INVITE. How to solve it ?</font>
<div> </div>
</div>
<div>
<p><tt>You could persist it at dialog level, once the 200 OK reply arrives in an onreply_route, like so:</tt></p>
<p><tt><br>
</tt></p>
<p><tt>onreply_route [store_attr] {<br>
</tt></p>
<p><tt>    $dlg_val(callee_attr) = </tt><tt><span><span>$(avp(attr)[$T_branch_idx])</span></span></tt></p>
<p><tt><span><span>}</span></span></tt></p>
<pre class="moz-signature" cols="72">Liviu Chircu
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com" id="LPlnk919120" previewremoved="true">http://www.opensips-solutions.com</a></pre>
<div id="LPBorder_GT_15040836303710.05556029735680246" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_15040836303660.4383783604947702" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);" role="presentation" cellspacing="0">
<tbody>
<tr style="border-spacing: 0px;" valign="top">
<td id="ImageCell_15040836303670.16654056962295782" style="width: 250px; position: relative; display: table-cell; padding-right: 20px;" colspan="1">
<div id="LPImageContainer_15040836303680.487354396510119" style="background-color: rgb(255, 255, 255); height: 99px; position: relative; margin: auto; display: table; width: 250px;">
<a id="LPImageAnchor_15040836303680.8904573846345033" style="display: table-cell; text-align: center;" href="http://www.opensips-solutions.com/" target="_blank"><img style="display: inline-block; max-width: 250px; max-height: 250px; height: 99px; width: 250px; border-width: 0px; vertical-align: bottom;" id="LPThumbnailImageID_15040836303690.4517853241285775" width="250" height="99" src="http://www.opensips-solutions.com/imgs/slideshow/slide1.jpg"></a></div>
</td>
<td id="TextCell_15040836303690.7468990510829023" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;" colspan="2">
<div id="LPRemovePreviewContainer_15040836303690.3137759011119623"></div>
<div id="LPTitle_15040836303690.7230087121795188" style="top: 0px; color: rgb(0, 120, 215); font-weight: 400; font-size: 21px; font-family: "wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_15040836303700.4488012715081642" style="text-decoration: none;" href="http://www.opensips-solutions.com/" target="_blank">Home — OpenSIPS Solutions</a></div>
<div id="LPMetadata_15040836303700.930635040040179" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; line-height: 14px;">
www.opensips-solutions.com</div>
<div id="LPDescription_15040836303710.428429163010414" style="display: block; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
OpenSIPS is a mature Open Source implementation of a SIP server. OpenSIPS is more than a SIP proxy/router as it includes application-level functionalities.</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="moz-cite-prefix">On 29.08.2017 20:33, Rodrigo Pimenta Carvalho wrote:<br>
</div>
<blockquote type="cite">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>Hi Liviu.</p>
<p><br>
</p>
<p>Thank you for your reply!</p>
<p><br>
</p>
<p>I guess the second INVITE is a Re-INVITE, as you commented.</p>
<p>In this case, is it possible to keep stored the value of <tt>$avp(attr)</tt> and use it when necessary even after receiving the Re-INVITE?</p>
<p><br>
</p>
<p>----------<br>
</p>
<p><br>
</p>
<p>Yes we have a retry, not a parallel forked call, but just when the Re-INVITE is received by OpenSIPS. By other side, the first INVITE is for a parallel forked call, if I'm well understanding the SIP here.</p>
<p>The first INVITE is:</p>
<p><br>
</p>
<div>    SIP Message: INVITE <a class="moz-txt-link-freetext" href="sip:g1r2u3p4o5@127.0.0.1">
sip:g1r2u3p4o5@127.0.0.1</a> SIP/2.0<br>
<span>    </span>Via: SIP/2.0/TLS 127.0.0.1:42194;rport;branch=z9hG4bKPjd3128578-0158-4c58-8c1c-676aa864d8ca;alias<br>
<span>    </span>Max-Forwards: 70<br>
<span>    </span>From: "ext1" <a class="moz-txt-link-rfc2396E" href="sip:intercomB_RYg7tf4xx6JV@127.0.0.1">
<sip:intercomB_RYg7tf4xx6JV@127.0.0.1></a>;tag=469b3a48-1548-4af6-8e03-a5c855ce85f4<br>
<span>    </span>To: <a class="moz-txt-link-rfc2396E" href="sip:g1r2u3p4o5@127.0.0.1">
<sip:g1r2u3p4o5@127.0.0.1></a><br>
<span>    </span>Contact: "ext1" <a class="moz-txt-link-rfc2396E" href="sip:intercomB_RYg7tf4xx6JV@127.0.0.1:42194;transport=TLS;ob">
<sip:intercomB_RYg7tf4xx6JV@127.0.0.1:42194;transport=TLS;ob></a>;+sip.ice<br>
<span>    </span>Call-ID: 22cb74fc-3d3b-4a37-9572-32f48c9943ff<br>
<span>    </span>CSeq: 21431 INVITE<br>
<span>    </span>Route: <a class="moz-txt-link-rfc2396E" href="sip:intercomB_RYg7tf4xx6JV@127.0.0.1;transport=tls;lr">
<sip:intercomB_RYg7tf4xx6JV@127.0.0.1;transport=tls;lr></a><br>
<span>    </span>Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS<br>
<span>    </span>Supported: replaces, 100rel, timer, norefersub<br>
<span>    </span>Session-Expires: 1800<br>
<span>    </span>Min-SE: 90<br>
<span>    </span>Content-Type: application/sdp<br>
<span>    </span>Content-Length:  1267<br>
<br>
There is more than one registered (on-line) subscriber <span>g1r2u3p4o5. So, <span>
g1r2u3p4o5</span> has more than one AOR. I have 3 devices online for the subscriber
<span><span>g1r2u3p4o5</span></span>.<br>
The reply SIP OK comes from another network (not the local one), from IP <span>10.0.60.246</span>. After such reply, the Re-INVITE is:<br>
</span><span><br>
</span></div>
<br>
<div><span>    </span>SIP Message: INVITE <a class="moz-txt-link-freetext" href="sip:g1r2u3p4o5@10.0.60.246:59673;transport=TLS">
sip:g1r2u3p4o5@10.0.60.246:59673;transport=TLS</a> SIP/2.0<br>
<span>    </span>Via: SIP/2.0/TLS 192.168.0.81:54188;rport;branch=z9hG4bKPjdde63995-7ed0-436a-983f-61d0e5df9498;alias<br>
<span>    </span>Max-Forwards: 70<br>
<span>    </span>From: "ext1" <a class="moz-txt-link-rfc2396E" href="sip:intercomB_RYg7tf4xx6JV@127.0.0.1">
<sip:intercomB_RYg7tf4xx6JV@127.0.0.1></a>;tag=469b3a48-1548-4af6-8e03-a5c855ce85f4<br>
<span>    </span>To: <a class="moz-txt-link-rfc2396E" href="sip:g1r2u3p4o5@127.0.0.1">
<sip:g1r2u3p4o5@127.0.0.1></a>;tag=393a402c<br>
<span>    </span>Contact: "ext1" <a class="moz-txt-link-rfc2396E" href="sip:intercomB_RYg7tf4xx6JV@127.0.0.1:42194;transport=TLS;ob">
<sip:intercomB_RYg7tf4xx6JV@127.0.0.1:42194;transport=TLS;ob></a>;+sip.ice<br>
<span>    </span>Call-ID: 22cb74fc-3d3b-4a37-9572-32f48c9943ff<br>
<span>    </span>CSeq: 21433 INVITE<br>
<span>    </span>Route: <a class="moz-txt-link-rfc2396E" href="sip:icchw.jflddns.com.br:5061;transport=tls;lr;did=d53.353e0122">
<sip:icchw.jflddns.com.br:5061;transport=tls;lr;did=d53.353e0122></a><br>
<span>    </span>Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS<br>
<span>    </span>Supported: replaces, 100rel, timer, norefersub<br>
<span>    </span>Session-Expires: 1800;refresher=uac<br>
<span>    </span>Min-SE: 90<br>
<span>    </span>Content-Type: application/sdp<br>
<span>    </span>Content-Length:   332<br>
<br>
In this moment I need to know if the device (callee) is in another network, in fact, to take some fixes in SDP of INVITEs and SIP OKs.<br>
The <span><span>$(avp(attr)[$T_branch_idx])</span></span> should have the information that I need.<br>
<br>
If it is not possible to keep the <span><span>$(avp(attr)[$T_branch_idx])</span></span> stored, is it possible to know if a device is in another network when it is a callee?<br>
<br>
Any hint will be very helpful !!<br>
<br>
Best regards.<br>
</div>
<br>
<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>
<br>
<br>
<div style="color:rgb(0,0,0)">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>De:</b> Users
<a class="moz-txt-link-rfc2396E" href="mailto:users-bounces@lists.opensips.org"><users-bounces@lists.opensips.org></a> em nome de Liviu Chircu
<a class="moz-txt-link-rfc2396E" href="mailto:liviu@opensips.org"><liviu@opensips.org></a><br>
<b>Enviado:</b> terça-feira, 29 de agosto de 2017 12:34<br>
<b>Para:</b> <a class="moz-txt-link-abbreviated" href="mailto:users@lists.opensips.org">
users@lists.opensips.org</a><br>
<b>Assunto:</b> Re: [OpenSIPS-Users] $(avp(attr)[$T_branch_idx]) is NULL for second INVITE. How to solve it ?</font>
<div> </div>
</div>
<div>
<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" id="LPlnk492951" previewremoved="true">http://www.opensips-solutions.com</a></pre>
<div id="LPBorder_GT_15040148287380.9785614214686198" style="margin-bottom:20px; overflow:auto; width:100%; text-indent:0px" contenteditable="false">
<table id="LPContainer_15040148287290.21704393825438584" style="width:90%; background-color:rgb(255,255,255); overflow:auto; padding-top:20px; padding-bottom:20px; margin-top:20px; border-top:1px
                dotted rgb(200,200,200); border-bottom:1px dotted
                rgb(200,200,200)" cellspacing="0">
<tbody>
<tr style="border-spacing:0px" valign="top">
<td id="ImageCell_15040148287310.7979478550895254" colspan="1" style="width:250px; display:table-cell; padding-right:20px">
<div id="LPImageContainer_15040148287310.09573089787478506" style="background-color:rgb(255,255,255); height:99px; margin:auto; display:table; width:250px">
<a id="LPImageAnchor_15040148287340.5835800227317395" href="http://www.opensips-solutions.com/" target="_blank" style="display:table-cell; text-align:center"><img id="LPThumbnailImageID_15040148287340.5067056213848349" style="display:inline-block; max-width:250px; max-height:250px; height:99px; width:250px; border-width:0px; vertical-align:bottom" width="250" height="99" src="http://www.opensips-solutions.com/imgs/slideshow/slide1.jpg"></a></div>
</td>
<td id="TextCell_15040148287340.83891077390406" colspan="2" style="vertical-align:top; padding:0px; display:table-cell">
<div id="LPTitle_15040148287340.34781778494028914" style=""><a id="LPUrlAnchor_15040148287370.694472448015153" href="http://www.opensips-solutions.com/" target="_blank" style="text-decoration:none">Home — OpenSIPS Solutions</a></div>
<div id="LPMetadata_15040148287370.17017131167218047" style=""><a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></div>
<div id="LPDescription_15040148287380.3454259755833783" style="">OpenSIPS is a mature Open Source implementation of a SIP server. OpenSIPS is more than a SIP proxy/router as it includes application-level functionalities.</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="moz-cite-prefix">On 29.08.2017 18:05, Rodrigo Pimenta Carvalho wrote:<br>
</div>
<blockquote type="cite">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<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>_______________________________________________
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>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset> <br>
<pre>_______________________________________________
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>
</div>
</div>
</div>
</body>
</html>