<div dir="ltr">Thank you Bogdan,<div><br><div>It seems that replacing remove_hf with uac_replace_from has resolved the issue. </div><div>Just a quick question: if I use remove_hf("Contact") during INVITE, will TM become aware of this change?<br></div><div><br></div><div><br></div><div><br></div><div>Regards,</div><div>Jason      </div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 5 Jan 2024 at 23:55, Bogdan-Andrei Iancu <<a href="mailto:bogdan@opensips.org">bogdan@opensips.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>

  
    
  
  <div>
    <font face="monospace">Hi Jason,<br>
      <br>
      For changing the FROM hdr (at INVITE time), better use the
      uac_replace_from() function [1] - by doing this, the TM will
      become aware of the change and reflect it into CANCEL too.<br>
      <br>
      <br>
      [1]
<a href="https://opensips.org/html/docs/modules/3.4.x/uac.html#func_uac_replace_from" target="_blank">https://opensips.org/html/docs/modules/3.4.x/uac.html#func_uac_replace_from</a><br>
      <br>
      Regards,<br>
    </font>
    <pre cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a href="https://www.opensips-solutions.com" target="_blank">https://www.opensips-solutions.com</a>
  <a href="https://www.siphub.com" target="_blank">https://www.siphub.com</a></pre>
    <div>On 24.12.2023 13:33, nz deals wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">Hi Bogdan,
        <div>Agreed that the RFC3261 CANCEL is truly built using INVITE.
          In my case, somehow CANCEL is not the same as the initial
          INVITE. Due to the complexity of my case I have hard times to
          fix the issue. Let me explain a bit. </div>
        <div>On the INVITE i change the From Header, which i can see has
          also been changed during Authorization. </div>
        <div>If i CANCEL then the From header is different (it's the
          same as i have before making my change). </div>
        <div><br>
        </div>
        <div>I am also using topology_hiding(). </div>
        <div>  </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>under the main route i change the From header for INVITE</div>
        <div><br>
        </div>
        <div>        set_advertised_address("104.13.xx.xx "); # same as
          i have used in the advertised_address</div>
        <div>
          <div>        # this is my cancel processing</div>
          <div>        if (is_method("CANCEL")) {<br>
                            if (t_check_trans())<br>
                                    t_relay(8);<br>
                            exit;<br>
                    }</div>
        </div>
        <div>        if (has_totag()) { </div>
        <div>            if(topology_hiding_match())  {</div>
        <div>                                   # remove and add a
          custom one</div>
        <div>                                   remove_hf("From");</div>
        <div>                                   append_hf("From:
          \"$fU\"<a><sip:$fU@$td;custom=$var(custom)></a>;tag=$ft\r\n");</div>
        <div>                                 
           force_send_socket("tls:192.xx.xx.xx:5061");</div>
        <div>             }</div>
        <div>        }</div>
        <div>   </div>
        <div>My opensips version is 3.4.2</div>
        <div>My listening socket is socket=tls:ens192:5061 tag ens192   
           (its the same 192.xx.xx.xx IP that you see in the
          force_send_socket)</div>
        <div>I am also using public ip as follows</div>
        advertised_address=104.13.xx.xx<br>
        alias=104.13.xx.xx<br>
        <div>    </div>
        <div><br>
        </div>
        <div>Regards,</div>
        <div>Jason         </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Thu, 21 Dec 2023 at 02:31,
          Bogdan-Andrei Iancu <<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div> <font face="monospace">Hi Jason,<br>
              <br>
              In transactional stateful SIP, the CANCEL requests are hop
              by hop - each hop in the path is generating its own CANCEL
              requests to the next hop, which consumes it; there is no
              actual relaying of the CANCELs. So, the replacing (which
              works in relaying mode only) doesn't fit here.<br>
              <br>
              Even more, the RFC3261 gives a rigorous way for building
              the CANCEL requests, they are to be built 100% based on
              the INVITE request only (nothing more). OpenSIPS
              internally builds the CANCEL in accordance to the
              corresponding INVITE, so you should not need any such
              changes.<br>
              <br>
              May you detail why you think you need this FROM
              replacement?<br>
              <br>
              Regards, <br>
            </font>
            <pre cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a href="https://www.opensips-solutions.com" target="_blank">https://www.opensips-solutions.com</a>
  <a href="https://www.siphub.com" target="_blank">https://www.siphub.com</a></pre>
            <div>On 20.12.2023 12:38, nz deals wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">Hi,
                <div>I've been attempting to modify the From header in
                  the CANCEL, but it seems the changes aren't taking
                  effect. I've also experimented with remove_hf and
                  append_hf, but unfortunately, these methods didn't
                  work either. Could someone kindly offer suggestions if
                  I might be overlooking something?<br>
                </div>
                <div><br>
                </div>
                <div>This is in the main request route </div>
                <div><br>
                </div>
                        if (is_method("CANCEL")) {<br>
                                uac_replace_from("","<a href="mailto:sip%3Atest@test.com" target="_blank">sip:test@test.com</a>");<br>
                                if (t_check_trans())<br>
                                        t_relay(8);<br>
                                exit;<br>
                        }<br>
                <div> 
                  <div><br>
                  </div>
                  <div><br>
                  </div>
                  <div><br>
                  </div>
                  <div>
                    <div>Regards,</div>
                    <div>Jason</div>
                  </div>
                </div>
              </div>
              <br>
              <fieldset></fieldset>
              <pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
            </blockquote>
            <br>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </div>

</blockquote></div>