<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <font face="monospace">Hi,<br>
      <br>
      Take a look at this
      <a class="moz-txt-link-freetext" href="https://blog.opensips.org/2016/11/15/cancel-request-and-reason-header/">https://blog.opensips.org/2016/11/15/cancel-request-and-reason-header/</a><br>
      <br>
      Regards,<br>
    </font>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a class="moz-txt-link-freetext" href="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>
  <a class="moz-txt-link-freetext" href="https://www.siphub.com">https://www.siphub.com</a></pre>
    <div class="moz-cite-prefix">On 14.08.2024 06:46, Mohamed OUALLA
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAGmsPDvhFXSkCs4s9os8TFjOZZLyPokU0J07mr1KsKP=AXENQA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div class="gmail_default"
          style="font-size:large;color:rgb(11,83,148)">
          <p style="font-family:monospace">Hello everyone,</p>
          <p style="font-family:monospace">  I am currently working with
            OpenSIPs in stateful mode, and I am encountering an issue
            with relaying a CANCEL request to cancel a pending initial
            SIP INVITE.</p>
          <p style="font-family:monospace">  The CANCEL request is
            hop-by-hop, so OpenSIPs act on it first "<b><i>send 200
                canceling</i></b>" then it generates a CANCEL SIP
            Request and relay it to the next hop. My goal is to add a
            custom SIP header, specifically "<b>X-Reason</b>", to this
            relayed CANCEL request. Unfortunately, I am only able to add
            the standard "<b>Reason</b>" header.</p>
          <p style="font-family:monospace">  The challenge I am facing
            is that FreeSWITCH, which receives the relayed CANCEL
            request, removes the "Reason" header due to a parameter I
            have set to disable adding Q.850 reasons. This parameter was
            initially enabled to prevent FreeSWITCH from adding the
            "Reason" header to negative SIP responses, but it's now also
            affecting the CANCEL request, leading to the removal of the
            "Reason" header!</p>
          <p style="font-family:monospace">Here’s my current OpenSIPs
            configuration that successfully adds the "Reason" header to
            the CANCEL request:</p>
          <p style="font-family:monospace">```</p>
          <p style=""><font face="verdana, sans-serif">if(!is_present_hf("Reason")){<br>
                  append_hf("Reason: Q.850;cause=32\r\n", "CSeq");</font> <font
              face="verdana, sans-serif">#the outgoing CANCEL request
              has the Reason header value now<br>
              }</font></p>
          <span style="font-family:monospace">```</span></div>
        <div class="gmail_default"
          style="font-size:large;color:rgb(11,83,148)">
          <p>  However, when I try to add headers like "<b>X-Reason</b>"
            or "<b>TestHeader</b>" for example, they don't seem to be
            included in the relayed CANCEL request:</p>
          <p><span style="font-family:monospace">```</span><br>
          </p>
          <p><font face="verdana, sans-serif">if(!is_present_hf("Reason")){<br>
                  append_hf("X-Reason: Q.850;cause=31\r\n", "CSeq");</font>
            <span style="font-family:verdana,sans-serif"># No changes
              are reflected in the relayed CANCEL request :-/</span><font
              face="verdana, sans-serif"><br>
                  # or<br>
                  append_hf("TestHeader: Q.850;cause=31\r\n", "CSeq");#
              No changes are reflected in the relayed CANCEL request :-/<br>
              }</font></p>
          <span style="font-family:monospace">```</span></div>
        <div class="gmail_default"
          style="font-size:large;color:rgb(11,83,148)">
          <p>  Has anyone faced a similar issue or have any suggestions
            on how I can successfully add a custom "<b>X-Reason</b>"
            header or any other custom "<b><i>X-Header</i></b>" to the
            relayed CANCEL request?</p>
          <p>Thanks in advance,</p>
          <p>Have a beautiful day</p>
        </div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-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>