<div><div dir="auto">Isn’t “message_apply_changes” applied automatically?</div><div dir="auto"><br></div><div dir="auto">But I think Alfonso is talking specifically about CANCELs generated by Kamailio on timeouts.</div></div><div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 18 Nov 2020 at 09:58, Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">
  
    
  
  <div>
    <p>Hello,<br>
    </p>
    <div>On 18.11.20 10:39, Denys Pozniak wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">Hello!
        <div><br>
        </div>
        <div>Call flow: FreeSWITCH --> SBC --> Edge Proxy  </div>
        <div> <br>
        </div>
        <div>In my case, the problem is related to the fact that the SBC
          deletes the Reason header from FreeSWITCH and I am trying to
          recover it on the Kamailio side (Edge Proxy).<br>
        </div>
        <div>It is especially important to recover the message: "Call
          completed elsewhere" because this disables the missed call
          notification on the destination phone in case of hunt-groups.<br>
        </div>
        <div>
          <div>The option to forward the call through the stateless loop
            works well but it complicates the logic unnecessarily.<br>
          </div>
        </div>
        <div><br>
        </div>
        <div>So would be great to have a tm function to setup custom
          Reason, like below:</div>
        <div><i>...</i><br>
        </div>
        <i>t_cancel_reason("Reason: SIP ;cause=200 ;text=\"Call
          completed elsewhere\"\r\n");<br>
          t_relay();</i>
        <div><i>....</i></div>
        <div>
          <div><br>
          </div>
        </div>
      </div>
    </blockquote>
    <p>iirc, the Reason header should be propagated if it is in incoming
      CANCEL, so for this particular case, it should work if you do:</p>
    <p><br>
    </p>
    <p>if(is_method("CANCEL")) {</p>
    <p>append_hf("Reason: ...\r\n");</p>
    <p>msg_apply_changes();<br>
    </p>
    <p>t_realy();</p>
    <p>exit;</p>
    <p>}</p>
    <p>Cheers,<br>
      Daniel<br>
    </p></div><div>
    <blockquote type="cite">
      <div dir="ltr">
        <div>
          <div><br>
          </div>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">ср, 18 нояб. 2020 г. в
              11:16, Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>>:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">
              <div>
                <p>Same question here like in my other reply:</p>
                <p>  * <a href="https://lists.kamailio.org/pipermail/sr-users/2020-November/111123.html" target="_blank">https://lists.kamailio.org/pipermail/sr-users/2020-November/111123.html</a></p>
                <p>How do you expect to fill the value of the header?</p>
                <p>Cheers,<br>
                  Daniel<br>
                </p>
                <div>On 17.11.20 19:20, David Villasmil wrote:<br>
                </div>
                <blockquote type="cite">
                  <div dir="auto">And on internally generated CANCELs</div>
                  <div><br>
                    <div class="gmail_quote">
                      <div dir="ltr" class="gmail_attr">On Tue, 17 Nov
                        2020 at 14:20, Denys Pozniak <<a href="mailto:denys.pozniak@gmail.com" target="_blank">denys.pozniak@gmail.com</a>>
                        wrote:<br>
                      </div>
                      <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">
                        <div dir="ltr">Hello!
                          <div><br>
                          </div>
                          <div>We need to append our own Reason header
                            for the "relayed" CANCEL message, if it is
                            not on the input.</div>
                          <div>Like below:</div>
                          <div><br>
                          </div>
                          <div><i>if ( is_method("CANCEL") &&
                              !is_present_hf("Reason") ) {<br>
                            </i></div>
                          <div><i>  append_hf("Reason: ....);</i></div>
                          <div><i>  t_relay();</i></div>
                          <div><i>...</i></div>
                          <div><i><br>
                            </i></div>
                          <div><br>
                          </div>
                          <div><br>
                          </div>
                        </div>
                        <br>
                        <div class="gmail_quote">
                          <div dir="ltr" class="gmail_attr">вт, 17 нояб.
                            2020 г. в 13:00, Daniel-Constantin Mierla
                            <<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>>:<br>
                          </div>
                        </div>
                        <div class="gmail_quote">
                          <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">
                            <div>
                              <p>Hello,</p>
                              <p>what is exactly the problem? The header
                                is not added if you enable:</p>
                              <p>  * <a href="http://kamailio.org/docs/modules/stable/modules/tm.html#local_cancel_reason" target="_blank">http://kamailio.org/docs/modules/stable/modules/tm.html#local_cancel_reason</a></p>
                              <p>Cheers,<br>
                                Daniel<br>
                              </p>
                              <div>On 16.11.20 20:43, Denys Pozniak
                                wrote:<br>
                              </div>
                              <blockquote type="cite">
                                <div dir="ltr">Hello guys,<br>
                                  <br>
                                  We have faced almost the same problem
                                  adding <b>Reason:
                                    SIP;cause=200;text="Call completed
                                    elsewhere"</b> to the t_relayed
                                  CANCEL request.
                                  <div>Is there an elegant solution to
                                    add this header?</div>
                                  <div><br>
                                  </div>
                                  <div>PS. Switching to the stateless
                                    mode does not look pretty for us...<br>
                                     <br>
                                  </div>
                                </div>
                                <br>
                                <div class="gmail_quote">
                                  <div dir="ltr" class="gmail_attr">сб,
                                    1 февр. 2020 г. в 06:04, Alfonso
                                    Pinto <<a href="mailto:alfonso.pinto@gmail.com" target="_blank">alfonso.pinto@gmail.com</a>>:<br>
                                  </div>
                                  <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">
                                    <div>
                                      <div dir="auto">Hi guys,</div>
                                    </div>
                                    <div dir="auto"><br>
                                    </div>
                                    <div dir="auto">Thanks for your
                                      answers.</div>
                                    <div dir="auto">I did try
                                      local_cancel_reason and it’s not
                                      doing anything for the CANCELs
                                      generated by kamailio. Isn’t that
                                      parameter intended for the CANCELs
                                      received and then relayed?</div>
                                    <div dir="auto"><br>
                                    </div>
                                    <div dir="auto">As Alex and David
                                      mentioned, what I need is to add
                                      my own reason header. There are
                                      some cases that requires to set
                                      the Reason header to something
                                      specific. IE: terminal supported
                                      call waiting in IMS.</div>
                                    <div dir="auto"><br>
                                    </div>
                                    <div dir="auto">Thanks for the piece
                                      of code, I will check what can be
                                      done here.</div>
                                    <div dir="auto"><br>
                                    </div>
                                    <div dir="auto">Regards,</div>
                                    <div dir="auto">Alfonso</div>
                                    <div><br>
                                      <div class="gmail_quote">
                                        <div dir="ltr" class="gmail_attr">El El vie,
                                          31 ene 2020 a las 22:10,
                                          Henning Westerholt <<a href="mailto:hw@skalatan.de" target="_blank">hw@skalatan.de</a>>
                                          escribió:<br>
                                        </div>
                                        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">Hi
                                          Alex,<br>
                                          <br>
                                          ok, I was reading that he
                                          wants to get just one reason
                                          header, not one dynamic
                                          generated.<br>
                                          <br>
                                          Just looked briefly, this
                                          seems to be the code:<br>
                                          <br>
                                          t_msgbuilder.c<br>
                                          /* Build a local request based
                                          on a previous request; main<br>
                                           * customers of this function
                                          are local ACK and local CANCEL<br>
                                           */<br>
                                          char *build_local(struct cell
                                          *Trans,unsigned int branch,<br>
                                                  unsigned int *len,
                                          char *method, int method_len,
                                          str *to<br>
                                                  , struct
                                          cancel_reason* reason<br>
                                                  )<br>
                                          <br>
                                          Cheers,<br>
                                          <br>
                                          Henning<br>
                                          <br>
                                          -- <br>
                                          Henning Westerholt – <a href="https://skalatan.de/blog/" rel="noreferrer" target="_blank">https://skalatan.de/blog/</a><br>
                                          Kamailio services – <a href="https://gilawa.com" rel="noreferrer" target="_blank">https://gilawa.com</a>
                                          <br>
                                          <br>
                                          -----Original Message-----<br>
                                          From: sr-users <<a href="mailto:sr-users-bounces@lists.kamailio.org" target="_blank">sr-users-bounces@lists.kamailio.org</a>>
                                          On Behalf Of Alex Balashov<br>
                                          Sent: Friday, January 31, 2020
                                          9:45 PM<br>
                                          To: <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
                                          Subject: Re: [SR-Users] Add
                                          Reason Header to kamailio
                                          generated CANCEL<br>
                                          <br>
                                          I understood Alfonso's
                                          question to implicitly be: how
                                          can I add a dynamic and
                                          variable Reason header to
                                          outgoing CANCELs?<br>
                                          <br>
                                          Perhaps I was mistaken. But if
                                          I'm not, as far as I know
                                          there is no means of doing
                                          that. Right?<br>
                                          <br>
                                          On Fri, Jan 31, 2020 at
                                          08:37:48PM +0000, Henning
                                          Westerholt wrote:<br>
                                          <br>
                                          > Hello,<br>
                                          > <br>
                                          > have you tried to use
                                          this parameter:<br>
                                          > <br>
                                          > <a href="http://kamailio.org/docs/modules/stable/modules/tm.html#local_cancel_r" rel="noreferrer" target="_blank">http://kamailio.org/docs/modules/stable/modules/tm.html#local_cancel_r</a><br>
                                          > eason<br>
                                          > <br>
                                          > Cheers,<br>
                                          > <br>
                                          > Henning<br>
                                          > <br>
                                          > --<br>
                                          > Henning Westerholt – <a href="https://skalatan.de/blog/" rel="noreferrer" target="_blank">https://skalatan.de/blog/</a>
                                          Kamailio services – <br>
                                          > <a href="https://gilawa.com" rel="noreferrer" target="_blank">https://gilawa.com</a><<a href="https://gilawa.com/" rel="noreferrer" target="_blank">https://gilawa.com/</a>><br>
                                          > <br>
                                          > From: sr-users <<a href="mailto:sr-users-bounces@lists.kamailio.org" target="_blank">sr-users-bounces@lists.kamailio.org</a>>
                                          On Behalf Of <br>
                                          > Alfonso Pinto<br>
                                          > Sent: Wednesday, January
                                          29, 2020 8:04 PM<br>
                                          > To: Kamailio (SER) -
                                          Users Mailing List <<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>><br>
                                          > Subject: [SR-Users] Add
                                          Reason Header to kamailio
                                          generated CANCEL<br>
                                          > <br>
                                          > Hi everyone,<br>
                                          > <br>
                                          > I've got a specific case:
                                          when the inv_fr times out, I
                                          need to add a Reason header to
                                          the CANCEL generated by
                                          kamailio. I've tried to see if
                                          I could do it in the
                                          onsend_route, but that one is
                                          not triggered for the
                                          generated CANCEL. I also
                                          checked
                                          event_route[tm:local-request],
                                          but that one isn't triggered
                                          either for the generated
                                          CANCEL.<br>
                                          > <br>
                                          > Is there any way to do
                                          it? Or maybe to have any
                                          pointer about where to look in
                                          the code so I may try to
                                          trigger
                                          event_route[tm:local-request]
                                          for these generated CANCELs?<br>
                                          > <br>
                                          > Regards,<br>
                                          > Alfonso<br>
                                          <br>
                                          >
                                          _______________________________________________<br>
                                          > Kamailio (SER) - Users
                                          Mailing List<br>
                                          > <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
                                          > <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                                          <br>
                                          <br>
                                          --<br>
                                          Alex Balashov | Principal |
                                          Evariste Systems LLC<br>
                                          <br>
                                          Tel: +1-706-510-6800 /
                                          +1-800-250-5920 (toll-free)<br>
                                          Web: <a href="http://www.evaristesys.com/" rel="noreferrer" target="_blank">http://www.evaristesys.com/</a>,
                                          <a href="http://www.csrpswitch.com/" rel="noreferrer" target="_blank">http://www.csrpswitch.com/</a><br>
                                          <br>
_______________________________________________<br>
                                          Kamailio (SER) - Users Mailing
                                          List<br>
                                          <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
                                          <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                                        </blockquote>
                                      </div>
                                    </div>
_______________________________________________<br>
                                    Kamailio (SER) - Users Mailing List<br>
                                    <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
                                    <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                                  </blockquote>
                                </div>
                                <br clear="all">
                                <div><br>
                                </div>
                                -- <br>
                                <div dir="ltr">
                                  <div dir="ltr"><br>
                                    <div>
                                      <div>BR,</div>
                                      <div>Denys Pozniak<br>
                                      </div>
                                      <div><br>
                                      </div>
                                      <div><br>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                                <br>
                                <fieldset></fieldset>
                                <pre style="font-family:monospace">_______________________________________________
Kamailio (SER) - Users Mailing List
<a href="mailto:sr-users@lists.kamailio.org" style="font-family:monospace" target="_blank">sr-users@lists.kamailio.org</a>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" style="font-family:monospace" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
                              </blockquote>
                              <pre cols="72" style="font-family:monospace">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" style="font-family:monospace" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" style="font-family:monospace" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" style="font-family:monospace" target="_blank">www.linkedin.com/in/miconda</a>
Funding: <a href="https://www.paypal.me/dcmierla" style="font-family:monospace" target="_blank">https://www.paypal.me/dcmierla</a></pre>
                            </div>
                          </blockquote>
                        </div>
                        <br clear="all">
                        <div><br>
                        </div>
                        -- <br>
                        <div dir="ltr">
                          <div dir="ltr"><br>
                            <div>
                              <div>BR,</div>
                              <div>Denys Pozniak<br>
                              </div>
                              <div><br>
                              </div>
                              <div><br>
                              </div>
                            </div>
                          </div>
                        </div>
                        _______________________________________________<br>
                        Kamailio (SER) - Users Mailing List<br>
                        <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
                        <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                      </blockquote>
                    </div>
                  </div>
                  -- <br>
                  <div dir="ltr">
                    <div dir="ltr">
                      <div>Regards,</div>
                      <div><br>
                      </div>
                      David Villasmil
                      <div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div>
                      <div>phone: +34669448337</div>
                    </div>
                  </div>
                </blockquote>
                <pre cols="72" style="font-family:monospace">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" style="font-family:monospace" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" style="font-family:monospace" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" style="font-family:monospace" target="_blank">www.linkedin.com/in/miconda</a>
Funding: <a href="https://www.paypal.me/dcmierla" style="font-family:monospace" target="_blank">https://www.paypal.me/dcmierla</a></pre>
              </div>
              _______________________________________________<br>
              Kamailio (SER) - Users Mailing List<br>
              <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
              <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
            </blockquote>
          </div>
        </div>
      </div>
      <br clear="all">
      <div><br>
      </div>
      -- <br>
      <div dir="ltr">
        <div dir="ltr"><br>
          <div>
            <div>BR,</div>
            <div>Denys Pozniak<br>
            </div>
            <div><br>
            </div>
            <div><br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <pre cols="72" style="font-family:monospace">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" style="font-family:monospace" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" style="font-family:monospace" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" style="font-family:monospace" target="_blank">www.linkedin.com/in/miconda</a>
Funding: <a href="https://www.paypal.me/dcmierla" style="font-family:monospace" target="_blank">https://www.paypal.me/dcmierla</a></pre>
  </div>

</blockquote></div></div>
</div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div>