<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>First, most of the module functions return negative or positive
      integer values, not boolean. You have to check with <0 for
      what's usually false in native kamailio.cfg if conditions and
      >0 for true.<br>
    </p>
    <p>Then, also double check it does not execute it via a different
      config path, like the branch route callback (which happens in the
      default native kamailio.org).</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 31.08.22 12:00, Lewis Hutchinson
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CWXP265MB2517D61BD6551C6E39A6FD7BC5789@CWXP265MB2517.GBRP265.PROD.OUTLOOK.COM">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:"Calibri",sans-serif;}.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}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="MsoPlainText">Ok so making progress but still a little
          confused, hopefully this forum can shed some light on this
          behaviour.<br>
          <br>
          Using the hints provided (thanks all so far) and the latency
          logging from the cookbook I have managed to isolate the issue
          down to RTPengine introducing the delay.<br>
          <br>
          <span style="font-family:"Courier New"">INFO:
            app_python3 [apy_kemi.c:1820]: sr_apy_kemi_exec_func():
            alert - action KSR.rtpengine.rtpengine_manage(...) took too
            long [1003089 ms] (<a class="moz-txt-link-freetext" href="file:(null)">file:(null)</a> func:(null) line:252)</span><br>
          <br>
          What is confusing is, I don’t believe this block should be
          being called.<br>
          <br>
          when the BYE is triggered, it routes to <span
            style="font-family:"Courier New"">ksr_route_withindlg</span>
          <br>
          <br>
          <span style="font-family:"Courier New"">        #
            handle requests within SIP dialogs<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">        if self.ksr_route_withindlg(msg)==-255 :<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">            return 1</span><br>
          <br>
          <br>
          from within the <span style="font-family:"Courier
            New"">ksr_route_withindlg</span> a check is done to see
          if any RTPengine work needs doing<br>
          <br>
          <span style="font-family:"Courier New"">    # Handle
            requests within SIP dialogs<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">    def ksr_route_withindlg(self, msg):<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">        if KSR.siputils.has_totag()<0 :<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">            return 1<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New""><o:p> </o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">        # RTPEngine handling for UPDATES &
            reINVITES with sdp<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">        if self.ksr_route_rtpengine(msg) == -255:<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">            return 1</span><br>
          <br>
          <br>
          RTPengine is configured in a way to step in whenever there is
          an SDP present based on
          <span style="font-family:"Courier New"">Content-Type:
            application/sdp</span><br>
          <br>
          <span style="font-family:"Courier New"">    #
            RTPengine handle anything with SDP<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">    def ksr_route_rtpengine(self, msg):<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">        if
            KSR.textops.has_body_type("application/sdp"):<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">           KSR.rtpengine.rtpengine_manage(<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">               "RTP/AVP
            replace-session-connection replace-origin ICE=remove")<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New""><o:p> </o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">        return 1</span><br>
          <br>
          <br>
          What I can understand is why is this being called and erroring
          introducing the delay when there is no
          <span style="font-family:"Courier New"">Content-Type:
            application/sdp</span> in a BYE ???<br>
          <br>
          <br>
          As a quick fix I have put this in which stops the problem (I
          am sure there is better ways to handle this but for now this
          works in a DEV environment)<br>
          <br>
          <span style="font-family:"Courier New"">    def
            ksr_route_rtpengine(self, msg):<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">        if KSR.is_BYE():<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">           return 1<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New""><o:p> </o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">        if
            KSR.textops.has_body_type("application/sdp"):<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">           KSR.rtpengine.rtpengine_manage(<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">               "RTP/AVP
            replace-session-connection replace-origin ICE=remove")<o:p></o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New""><o:p> </o:p></span></p>
        <p class="MsoPlainText"><span style="font-family:"Courier
            New"">        return 1</span><br>
          <br>
          Can anyone see why this would occur? Why is <span
            style="font-family:"Courier New"">
            sr_apy_kemi_exec_func(): alert - action
            KSR.rtpengine.rtpengine_manage(...)</span> even being called
          for this BYE ? when there is no
          <span style="font-family:"Courier New"">Content-Type:
            application/sdp</span><o:p></o:p></p>
        <p class="MsoPlainText"><br>
          <br>
          <o:p></o:p></p>
        <p class="MsoPlainText"><span style="mso-fareast-language:EN-GB">Lewis
          </span><o:p></o:p></p>
        <p class="MsoPlainText"><o:p> </o:p></p>
        <p class="MsoNormal"><span style="mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
        <p class="MsoNormal"><o:p> </o:p></p>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * <a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
  * <a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a></pre>
  </body>
</html>