Hello, 

I'm using Kamailio + RTPEngine. Everything works well except one thing. I noticed rtp sessions are not being deleted after call termination. Instead, they remain lingering on RTPEngine waiting for a timeout.

kamailio --version
version: kamailio 5.5.2 (x86_64/linux) 55e232
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 55e232
compiled on 14:13:04 Aug 25 2021 with gcc 8.4.1

rtpengine --version
Version: 9.5.1.1-1.el8


rtpengine-ctl list totals tells me every session went to timeout :)

--- snip ---
Total statistics (does not include current running sessions):

 Uptime of rtpengine                             :914 seconds
 Total managed sessions                          :51
 Total rejected sessions                         :0
 Total timed-out sessions via TIMEOUT            :51
 Total timed-out sessions via SILENT_TIMEOUT     :0
 Total timed-out sessions via FINAL_TIMEOUT      :0
 Total timed-out sessions via OFFER_TIMEOUT      :0
 Total regular terminated sessions               :0
 Total forced terminated sessions                :0
--- snip ---




I'm using rtpengine_manage in two routes "route[RELAY]" and onreply_route[MANAGE_REPLY] . Do I need to add a specific rtpengine_delete somewhere ?



route[RELAY] {

        ...

        $xavp(r=>$T_branch_idx) = "replace-origin replace-session-connection";
        if (!nat_uac_test("8")) {
                $xavp(r=>$T_branch_idx) = $xavp(r=>$T_branch_idx) + " trust-address";
        }
        if (!has_totag()) {
                xlog("L_INFO", "NEXIOS: proto = [$proto], ru = [$ru]");
                if ($proto =~ "ws" && !($ru =~ "transport=ws")) {
                        xlog("L_INFO", "####################### FROM WS to any ########################\n");
                        $xavp(r=>$T_branch_idx) = $xavp(r=>$T_branch_idx) + " rtcp-mux-demux DTLS=off SDES-off ICE=remove RTP/AVP direction=external direction=internal";

                } else if (!($proto =~ "ws") && $ru =~ "transport=ws") {
                        xlog("L_INFO", "####################### FROM any to WS ########################\n");
                        setbflag(FLB_TOWEBRTC);
                        $xavp(r=>$T_branch_idx) = $xavp(r=>$T_branch_idx) + " rtcp-mux-offer generate-mid DTLS=active SDES-off ICE=force RTP/SAVPF direction=internal direction=external";

                } else if (($proto =~ "udp") && $ru =~ "transport=udp" && $fs =~ "MY_IP2_ADDR") {
                        xlog("L_INFO", "####################### FROM ?? to ?? $ru ########################\n");

                }
        }
        # we engage RTPEngine
        if (has_body("application/sdp")) {
                xlog("L_INFO", "NEXIOS: # $xavp(r=>$T_branch_idx) #\n");
                rtpengine_manage($xavp(r=>$T_branch_idx));
        }

        if (!t_relay()) {
                sl_reply_error();
        }
        exit;
}


onreply_route[MANAGE_REPLY] {
       
        ...

        $xavp(r=>$T_branch_idx) = "replace-origin replace-session-connection";
        if (!nat_uac_test("8")) {
                $xavp(r=>$T_branch_idx) = $xavp(r=>$T_branch_idx) + " trust-address";
        }
        if (has_totag()) {
                xlog("L_INFO", "onreply_route proto = [$proto], ru = [$ru]");
                if ($proto =~ "ws" && !($ru =~ "transport=ws")) {
                        xlog("L_INFO", "onreply_route ####################### FROM WS to any ########################\n");
                        $xavp(r=>$T_branch_idx) = $xavp(r=>$T_branch_idx) + " rtcp-mux-demux DTLS=off SDES-off ICE=remove RTP/AVP direction=external direction=internal";

                } else if (!($proto =~ "ws") && $ru =~ "transport=ws") {
                        xlog("L_INFO", "onreply_route ####################### FROM any to WS ########################\n");

                        setbflag(FLB_TOWEBRTC);
                        $xavp(r=>$T_branch_idx) = $xavp(r=>$T_branch_idx) + " rtcp-mux-offer generate-mid DTLS=active SDES-off ICE=force RTP/SAVPF direction=internal direction=external";

                } else if (($proto =~ "udp") && $ru =~ "transport=udp" && $fs =~ "MY_IP2_ADDR") {
                        xlog("L_INFO", "onreply_route ####################### FROM ?? to ?? $ru ########################\n");

                }

        }
        if (has_body("application/sdp")) {
                xlog("L_INFO", "onreply_route # $xavp(r=>$T_branch_idx) #\n");
                rtpengine_manage($xavp(r=>$T_branch_idx));
        }
}



Any ideas are appreciated.

Regards,
Tihomir.