<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Rahul,<br>
    <br>
    As per RFC, in stateless mode there is no branch (for the newly
    added VIA) - as branch is transaction oriented. And the RFC3261
    recommends to reuse the previous VIA hdr (if exists).<br>
    <br>
    Regards,<br>
    <br>
    <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.05.2015 20:01, Gupta, Rahul
      wrote:<br>
    </div>
    <blockquote
cite="mid:5D7DF326E497124DACCD6F9DD6A1A2A089C9728A@NWKNJEXMBX1.corp.root.ipc.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 14 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-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;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
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;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle23
        {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="color:#1F497D">Hi Bogdan,<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">I want to use
            opensips as stateless proxy that’s why I tried forward()
            which is causing the branch  issue as shown below, the
            branch in both the Via headers are same.
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">CANCEL
            sip:XXXX@IP:PORT SIP/2.0<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">From: "Alan
Altman[3004]"&lt;sip:YYYY@IP:PORT&gt;;tag=389cc678-0-13c4-65014-16288-3d1c9b70-16288<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">To:
            &lt;sip:XXXX@IP:PORT&gt;<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Call-ID:
            10589b68-0-13c4-65014-16288-156334b2-16288<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">CSeq: 1 CANCEL<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Via:
            SIP/2.0/UDP
            IP:PORT;branch=z9hG4bK-16288-568e507-60d8e02-38903830<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Via:
            SIP/2.0/UDP
            IP:PORT;branch=z9hG4bK-16288-568e507-60d8e02-38903830<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Reason:
            SIP;cause=200;text="User Release"<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Max-Forwards:
            69<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Supported:
timer,replaces,from-change,histinfo,answermode,eventlist,recipient-list-subscribe<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">User-Agent:
            test user agent<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Content-Length:
            0<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">X-testHeader:
            RAHUL<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">If we use
            t_relay(), I want to forward X-testHeader to the endpoint.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #B5C4DF
            1.0pt;padding:3.0pt 0in 0in 0in">
            <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext">From:</span></b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&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> Thursday, May 07, 2015 12:39 PM<br>
                <b>To:</b> OpenSIPS users mailling list; Gupta, Rahul<br>
                <b>Subject:</b> Re: [OpenSIPS-Users] CANCEL in t_relay()
                not forwarding user defined Headers<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>As per RFC3261, the stateful CANCELs are hop-by-hop -
              which means each hop consumes the incoming CANCEL and
              generates a new one for the next hop.</tt><br>
            <tt>This is why the headers do not propagate.</tt><br>
            <br>
            <tt>What kind of headers are looking to be passed further ?</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 06.05.2015 20:45, Gupta, Rahul wrote:<o:p></o:p></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;background:white">I
              am using opensips as a proxy, when a CANCEL to an INVITE
              comes in, its processed as follows<span
                class="apple-converted-space"> </span></span><span
style="font-size:10.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;"><br>
              <br>
              <span style="background:white">        # CANCEL processing<span
                  class="apple-converted-space"> </span></span><br>
              <span style="background:white">        if
                (is_method("CANCEL"))<span class="apple-converted-space"> </span></span><br>
              <span style="background:white">        {<span
                  class="apple-converted-space"> </span></span><br>
              <span style="background:white">                if
                (t_check_trans())<span class="apple-converted-space"> </span></span><br>
              <span style="background:white">                       
                t_relay();<span class="apple-converted-space"> </span></span><br>
              <span style="background:white">                exit;<span
                  class="apple-converted-space"> </span></span><br>
              <span style="background:white">        }<span
                  class="apple-converted-space"> </span></span><br>
              <br>
              <span style="background:white">in t_relay() seems like its
                creating new transaction for CANCEL and forwarding to
                the destination. However its not copying user-defined
                Headers which comes as a part of CANCEL. Is there a way
                to forward the other Headers ?<span
                  class="apple-converted-space"> </span></span><br>
              <br>
              <span style="background:white">I also tried using
                forward(). In this case, all the headers are getting
                forwarded, however, the branch in Via header is getting
                duplicated from the incoming VIA header which is causing
                issues with the endpoint.<span
                  class="apple-converted-space"> </span></span><br>
              <br>
              <span style="background:white">Question 1) If I use
                t_realy() for CANCEL, then how do I forward user defined
                Headers ?<span class="apple-converted-space"> </span></span><br>
              <span style="background:white">Question 2) If I use
                forward() for CANCEL, then how do I get the Via Header
                with proper branch as created in INVITE ?<span
                  class="apple-converted-space"> </span></span></span><o:p></o:p></p>
          <p><span
style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:gray">------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</span><o:p></o:p></p>
          <p><span
style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:gray">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><o:p></o:p></p>
          <p class="MsoNormal"><span
              style="font-size:12.0pt;font-family:&quot;Times New
              Roman&quot;,&quot;serif&quot;"><br>
              <br>
              <br>
              <br>
              <o:p></o:p></span></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"><span
            style="font-size:12.0pt;font-family:&quot;Times New
            Roman&quot;,&quot;serif&quot;"><o:p> </o:p></span></p>
      </div>
    </blockquote>
    <br>
  </body>
</html>