Thanks for everyone’s help on this, it turns out it was something as simple as a missing > 0 in the code which caused the below and sometimes resulted in noticeable delay / BYE retransmission. I suspect this would have caused issues for any within dialog messages with no SDP so glad it is resolved now.

INFO: app_python3 [apy_kemi.c:1820]: sr_apy_kemi_exec_func(): alert - action KSR.rtpengine.rtpengine_manage(...) took too long [1003089 ms] (file:(null) func:(null) line:252)

Thanks for the help tracking this down, it was proving a bit of a pain but a fresh pair of eyes can see things familiar ones sometimes cannot.

 

Lewis

 

From: Daniel-Constantin Mierla <miconda@gmail.com>
Sent: 31 August 2022 11:21
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>; Lewis Hutchinson <lewis.hutchinson@missionlabs.co.uk>
Subject: Re: [SR-Users] Intermittent delays relaying BYE (up to 1s)

 

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.

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).

Cheers,
Daniel

On 31.08.22 12:00, Lewis Hutchinson wrote:

Ok so making progress but still a little confused, hopefully this forum can shed some light on this behaviour.

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.

INFO: app_python3 [apy_kemi.c:1820]: sr_apy_kemi_exec_func(): alert - action KSR.rtpengine.rtpengine_manage(...) took too long [1003089 ms] (file:(null) func:(null) line:252)

What is confusing is, I don’t believe this block should be being called.

when the BYE is triggered, it routes to ksr_route_withindlg

        # handle requests within SIP dialogs

        if self.ksr_route_withindlg(msg)==-255 :

            return 1


from within the ksr_route_withindlg a check is done to see if any RTPengine work needs doing

    # Handle requests within SIP dialogs

    def ksr_route_withindlg(self, msg):

        if KSR.siputils.has_totag()<0 :

            return 1

 

        # RTPEngine handling for UPDATES & reINVITES with sdp

        if self.ksr_route_rtpengine(msg) == -255:

            return 1


RTPengine is configured in a way to step in whenever there is an SDP present based on Content-Type: application/sdp

    # RTPengine handle anything with SDP

    def ksr_route_rtpengine(self, msg):

        if KSR.textops.has_body_type("application/sdp"):

           KSR.rtpengine.rtpengine_manage(

               "RTP/AVP replace-session-connection replace-origin ICE=remove")

 

        return 1


What I can understand is why is this being called and erroring introducing the delay when there is no Content-Type: application/sdp in a BYE ???


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)

    def ksr_route_rtpengine(self, msg):

        if KSR.is_BYE():

           return 1

 

        if KSR.textops.has_body_type("application/sdp"):

           KSR.rtpengine.rtpengine_manage(

               "RTP/AVP replace-session-connection replace-origin ICE=remove")

 

        return 1

Can anyone see why this would occur? Why is sr_apy_kemi_exec_func(): alert - action KSR.rtpengine.rtpengine_manage(...) even being called for this BYE ? when there is no Content-Type: application/sdp




Lewis

 

 

 



__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda