<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <tt>Hi Rahul,<br>
      <br>
      The re<tt>ceived VIA hdr (with the .44 IP) is <tt>properly p<tt>reserved
            when forwarding (in the outbound message).<br>
            <br>
            <tt>The VIA hdr added by O<tt>pen<tt>SIPS ( .156 IP) is a
                  completely new VIA a<tt>nd its b<tt>ranch <tt>value
                        is <tt>completely</tt> <tt>independent</tt>
                        from the <tt>branch</tt> <tt>of other VIA
                          hdrs.<br>
                          <br>
                          <tt>Why <tt>do they look the sa<tt>me ? <tt>The
                                  RFC3261 says that <tt>for stateless
                                    fw<tt>d (when basically there is no
                                      transaction, so no branch value),
                                      to avoid <tt>populating <tt>its</tt>
                                        <tt>VIA with ";branch=0" , </tt></tt>the
                                      pro<tt>xy <tt>may</tt><tt> "copy"
                                          and use a branch value <tt>from
                                            an older VIA (a received
                                            VIA)<tt> - ke<tt>ep in mind
                                                i<tt>t does not say to c<tt>opy
                                                    it <tt>entirely or
                                                      part. So<tt>,
                                                        OpenSIPS copies
                                                        <tt>a
                                                          MAX_BRANCH_PARAM_LEN
                                                          <tt>length
                                                          string from
                                                          the previous <tt>branch
                                                          param.<br>
                                                          <br>
                                                          <tt>Everything
                                                          is correct and
                                                          lega<tt>l
                                                          (from RFC
                                                          perspecti<tt>ve).</tt></tt></tt></tt></tt>
                                                          <br>
                                                          <br>
                                                          <tt>PS: if you
                                                          would us<tt>e
                                                          t_relay<tt>()
                                                          instead <tt>of
                                                          for<tt>ward<tt>()
                                                          - doing
                                                          statefull <tt>proxy
                                                          <tt>-, you
                                                          will see that
                                                          the branch in
                                                          the VIA added
                                                          by OpenSIPS <tt>will
                                                          be complet<tt>ly
                                                          di<tt>fferent
                                                          from the value
                                                          in the <tt>previous
                                                          VIA.</tt></tt></tt></tt></tt></tt></tt></tt></tt></tt></tt></tt></tt></tt></tt>
                                                  </tt></tt></tt></tt></tt></tt></tt></tt></tt></tt></tt></tt></tt><br>
                        </tt></tt></tt></tt></tt></tt></tt></tt></tt></tt><br>
      <tt>Best re<tt>gards,</tt></tt><br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and 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 07.07.2016 03:42, Gupta, Rahul
      wrote:<br>
    </div>
    <blockquote
cite="mid:CY1PR15MB0441C33A53524A1F0F3FDC38F43B0@CY1PR15MB0441.namprd15.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:"Calibri Light";
        panose-1:2 15 3 2 2 2 4 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
p.emailquote, li.emailquote, div.emailquote
        {mso-style-name:emailquote;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:1.0pt;
        border:none;
        padding:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Hi
            Bogdan,<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Here
            is a Ethernet trace (pcap) file that has a successful and an
            unsuccessful registration.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Frames
            1-8 illustrate the successful case with Frames 2 and 6 show
            how opensips adds an extra VIA header that has a full
            VIA;branch<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Frame:2<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Via:
            SIP/2.0/UDP
            10.204.70.156:5060;branch=z9hG4bK-c45d6-2ff0ce63-4583dc45-6bd144f8<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Via:
            SIP/2.0/UDP
            10.204.45.122:5060;branch=z9hG4bK-c45d6-2ff0ce63-4583dc45-6bd144f8<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Frames
            9-16 illustrate the unsuccessful case where Frames 10 and 14
            show how opensips adds an extra VIA header that has a
            truncated branch.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Frame
            10:<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Via:
            SIP/2.0/UDP
10.204.70.156:5060;branch=z9hG4bK1c68e33e-848e-412a-9137-4fb065a7b7eb_0efbfc5e_11391<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Via:
            SIP/2.0/UDP
10.205.236.44:5060;branch=z9hG4bK1c68e33e-848e-412a-9137-4fb065a7b7eb_0efbfc5e_11391</span><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:red;background:yellow;mso-highlight:yellow">5620064228_MTAuMTIuMy4xMQ</span><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"
          style="margin-bottom:3.0pt;page-break-after:avoid"><b><span
              style="font-size:11.0pt;font-family:&quot;Calibri
              Light&quot;,&quot;sans-serif&quot;;color:#1F4E79"
              lang="EN-GB">Thanks<o:p></o:p></span></b></p>
        <p class="MsoNormal"
          style="margin-bottom:3.0pt;page-break-after:avoid"><b><span
              style="font-size:11.0pt;font-family:&quot;Calibri
              Light&quot;,&quot;sans-serif&quot;;color:#1F4E79"
              lang="EN-GB">Rahul Gupta</span></b><b><span
              style="font-size:11.0pt;font-family:&quot;Calibri
              Light&quot;,&quot;sans-serif&quot;;color:#1F4E79"
              lang="EN-GB"><o:p></o:p></span></b></p>
        <p class="MsoNormal"
          style="margin-bottom:6.0pt;page-break-after:avoid"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F4E79"
            lang="EN-GB">Systems Architect</span><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F4E79"
            lang="EN-GB"><o:p></o:p></span></p>
        <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"
              lang="FR">T</span></b><span
style="font-size:10.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"
            lang="FR"> +1 732-690-3845 
          </span><span
            style="font-size:10.0pt;font-family:Symbol;color:#5B9BD5">|</span><span
style="font-size:10.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"
            lang="FR">  
            <b>E</b> <a moz-do-not-send="true"
              href="mailto:rahul.gupta@ipc.com"><span
                style="color:#0563C1">rahul.gupta@ipc.com</span></a>
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><img
              id="Picture_x0020_2"
              src="cid:part2.02000602.03050509@opensips.org"
              alt="cid:image006.jpg@01D1940F.3E021840" height="68"
              width="163" border="0"><o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #E1E1E1
            1.0pt;padding:3.0pt 0in 0in 0in">
            <p class="MsoNormal"><b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:windowtext">From:</span></b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:windowtext">
                Bogdan-Andrei Iancu [<a class="moz-txt-link-freetext" href="mailto:bogdan@opensips.org">mailto:bogdan@opensips.org</a>]
                <br>
                <b>Sent:</b> Wednesday, July 06, 2016 5:38 AM<br>
                <b>To:</b> OpenSIPS users mailling list<br>
                <b>Cc:</b> Elliott, Ray; Gupta, Rahul<br>
                <b>Subject:</b> Re: [OpenSIPS-Users] Truncated Branch in
                Via<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><tt><span style="font-size:10.0pt">Hi
              Rahul,</span></tt><span
            style="font-size:10.0pt;font-family:&quot;Courier New&quot;"><br>
            <br>
            <tt>That define is used to calculate the the max VIA len
              when OpenSIPS is generating its own VIA headers. That max
              len does not impact the VIA headers which were received.</tt><br>
            <br>
            <tt>I do not understand exactly (in your example) what's the
              flow of that VIA header. If you want, send me off-list the
              pcap/ngrep showing the SIP package (before and after
              OpenSIPS) and how it is affected.</tt><br>
            <br>
            <tt>Regards,</tt><br>
            <br>
          </span><o:p></o:p></p>
        <pre>Bogdan-Andrei Iancu<o:p></o:p></pre>
        <pre>OpenSIPS Founder and Developer<o:p></o:p></pre>
        <pre><a moz-do-not-send="true" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a><o:p></o:p></pre>
        <div>
          <p class="MsoNormal">On 05.07.2016 20:57, Gupta, Rahul wrote:<o:p></o:p></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <div>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">We
                are using opensips 1.11.5 as a stateless proxy and
                seeing a truncated Branch in Via for my REGISTER
                message. After some code digging, the MAX length is
                calculated using the following formula and seems like
                its truncating the branch after 55 characters. This is
                causing the REGISTER to fail in our case. Is there a
                config level solution to this ?<o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"> <o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"><b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">#define
                  MAX_BRANCH_PARAM_LEN  (MCOOKIE_LEN+8 /*!&lt;int2hex*/
                  + 1 /*sep*/ + \</span></b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"><o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"><b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">                               
                  MD5_LEN + 1 /*!&lt;sep*/ + 8 /*int2hex*/ + \</span></b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"><o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"><b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">                               
                  1 /*extra space, needed by t_calc_branch*/)</span></b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"><o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"> <o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"> <o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">truncated
                from opensips
              </span><span
                style="font-size:11.0pt;font-family:Wingdings;color:#1F497D">ą</span><span
                style="font-size:11.0pt;color:#1F497D">      </span><span
style="font-size:11.0pt;font-family:Wingdings;color:#1F497D">
              </span><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Via:
                SIP/2.0/UDP
XX.XX.XX.XX:5060;branch=z9hG4bK0fddbbc9-1487-4755-a0b3-0c319155b8c3_0efbfc5e_11160                                                                             </span><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"><o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Via
                from EndPoint    </span><span
                style="font-size:11.0pt;font-family:Wingdings;color:#1F497D">ą</span><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">                  

                Via: SIP/2.0/UDP
XX.XX.XX.XX:5060;branch=z9hG4bK0fddbbc9-1487-4755-a0b3-0c319155b8c3_0efbfc5e_11160<span
                  style="background:yellow">78308924346_MTAuMTIuMy4xMQ</span>            </span><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"><o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"> <o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"> <o:p></o:p></span></p>
          </div>
          <div style="margin-bottom:3.0pt">
            <p class="MsoNormal"><b><span
                  style="font-size:11.0pt;font-family:&quot;Calibri
                  Light&quot;,&quot;sans-serif&quot;;color:#1F4E79">Thanks</span></b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"><o:p></o:p></span></p>
          </div>
          <div style="margin-bottom:3.0pt">
            <p class="MsoNormal"><b><span
                  style="font-size:11.0pt;font-family:&quot;Calibri
                  Light&quot;,&quot;sans-serif&quot;;color:#1F4E79">Rahul
                  Gupta</span></b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"><o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"> <o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"> <o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal">DISCLAIMER: This e-mail may contain
              information that is confidential, privileged or otherwise
              protected from disclosure. If you are not an intended
              recipient of this e-mail, do not duplicate or redistribute
              it by any means. Please delete it and any attachments and
              notify the sender that you have received it in error.
              Unintended recipients are prohibited from taking action on
              the basis of information in this e-mail. E-mail messages
              may contain computer viruses or other defects, may not be
              accurately replicated on other systems, or may be
              intercepted, deleted or interfered with without the
              knowledge of the sender or the intended recipient. If you
              are not comfortable with the risks associated with e-mail
              messages, you may decide not to use e-mail to communicate
              with IPC. IPC reserves the right, to the extent and under
              circumstances permitted by applicable law, to retain,
              monitor and intercept e-mail messages to and from its
              systems.
              <span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"><o:p></o:p></span></p>
          </div>
          <p class="MsoNormal"><br>
            <br>
            <br>
            <o:p></o:p></p>
          <pre>_______________________________________________<o:p></o:p></pre>
          <pre>Users mailing list<o:p></o:p></pre>
          <pre><a moz-do-not-send="true" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><o:p></o:p></pre>
          <pre><a moz-do-not-send="true" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><o:p></o:p></pre>
        </blockquote>
        <p class="MsoNormal"><o:p> </o:p></p>
      </div>
    </blockquote>
    <br>
  </body>
</html>