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.
Tihomir,
Actually, yes, You need to call rtpengine_delete()
Like this
request_route { .... if (is_method("CANCEL")) { if (t_check_trans()) { xlog("L_INFO", "[REQUEST_ROUTE] Relaying in-transaction CANCEL\n");
# Free previously reserved resourced rtpengine_delete(); ... } exit; } }
route[WITHINDLG] { if (has_totag()) { if (loose_route()) { ... if (is_method("BYE")) { xlog("L_INFO", "[WITHINDLG] In-dialog BYE. Invoking rtpengine_delete\n");
rtpengine_delete(); } ... }
failure_route[MANAGE_FAILURE] { if ($rs > 299) { xlog("L_INFO", "[MANAGE_FAILURE] Transaction failed with $rs > 299, invoking deleting of call on rtpengine\n");
rtpengine_delete(); } }
This is where I do this usually, but you might need to adapt it to your cases.
Le mar. 22 oct. 2024 à 08:27, Tihomir Culjaga via sr-users < sr-users@lists.kamailio.org> a écrit :
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.
Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Hello,
generally speaking, calling rtpengine_manage() should be enough in most cases. Compare e.g. to the kamailio default configuration and the docs of the module: https://kamailio.org/docs/modules/5.8.x/modules/rtpengine.html#rtpengine.f.r...
Cheers,
Henning
From: Ihor Olkhovskyi via sr-users sr-users@lists.kamailio.org Sent: Tuesday, October 22, 2024 9:58 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Cc: Ihor Olkhovskyi igorolhovskiy@gmail.com Subject: [SR-Users] Re: Kamailio not deleteing rtp sessions
Tihomir,
Actually, yes, You need to call rtpengine_delete()
Like this
request_route { .... if (is_method("CANCEL")) { if (t_check_trans()) { xlog("L_INFO", "[REQUEST_ROUTE] Relaying in-transaction CANCEL\n");
# Free previously reserved resourced rtpengine_delete(); ... } exit; } }
route[WITHINDLG] { if (has_totag()) { if (loose_route()) { ... if (is_method("BYE")) { xlog("L_INFO", "[WITHINDLG] In-dialog BYE. Invoking rtpengine_delete\n");
rtpengine_delete(); } ... }
failure_route[MANAGE_FAILURE] { if ($rs > 299) { xlog("L_INFO", "[MANAGE_FAILURE] Transaction failed with $rs > 299, invoking deleting of call on rtpengine\n");
rtpengine_delete(); } }
This is where I do this usually, but you might need to adapt it to your cases.
Le mar. 22 oct. 2024 à 08:27, Tihomir Culjaga via sr-users <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> a écrit : 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.
__________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.orgmailto:sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
-- Best regards, Ihor (Igor)
Hi Hennig,
i tought rtpengine_manage can do the trick of handling offer, answer and delete ... but for some reason the delete is not actually performed
Total statistics (does not include current running sessions):
Uptime of rtpengine :20075 seconds Total managed sessions :27298 Total rejected sessions :0 Total timed-out sessions via TIMEOUT :27288 Total timed-out sessions via SILENT_TIMEOUT :10 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
In the default kamailio configuration rtpengine_manage is under route[NATMANAGE].
#!ifdef WITH_RTPENGINE if(nat_uac_test("8")) { rtpengine_manage("SIP-source-address replace-origin replace-session-connection"); } else { rtpengine_manage("replace-origin replace-session-connection"); } #!else
Here i have it on route[RELAY] and onreply_route[MANAGE_REPLY]
maybe NATMANAGE is a better place to engage RTPEngine.
On Tue, 22 Oct 2024 at 11:23, Henning Westerholt via sr-users < sr-users@lists.kamailio.org> wrote:
Hello,
generally speaking, calling rtpengine_manage() should be enough in most cases. Compare e.g. to the kamailio default configuration and the docs of the module:
https://kamailio.org/docs/modules/5.8.x/modules/rtpengine.html#rtpengine.f.r...
Cheers,
Henning
*From:* Ihor Olkhovskyi via sr-users sr-users@lists.kamailio.org *Sent:* Tuesday, October 22, 2024 9:58 AM *To:* Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org *Cc:* Ihor Olkhovskyi igorolhovskiy@gmail.com *Subject:* [SR-Users] Re: Kamailio not deleteing rtp sessions
Tihomir,
Actually, yes, You need to call rtpengine_delete()
Like this
request_route {
.... if (is_method("CANCEL")) { if (t_check_trans()) { xlog("L_INFO", "[REQUEST_ROUTE] Relaying in-transaction
CANCEL\n");
# Free previously reserved resourced rtpengine_delete(); ... } exit; }
}
route[WITHINDLG] { if (has_totag()) { if (loose_route()) { ... if (is_method("BYE")) {
xlog("L_INFO", "[WITHINDLG] In-dialog BYE. Invoking
rtpengine_delete\n");
rtpengine_delete(); }
...
}
failure_route[MANAGE_FAILURE] {
if ($rs > 299) { xlog("L_INFO", "[MANAGE_FAILURE] Transaction failed with $rs >
299, invoking deleting of call on rtpengine\n");
rtpengine_delete(); }
}
This is where I do this usually, but you might need to adapt it to your cases.
Le mar. 22 oct. 2024 à 08:27, Tihomir Culjaga via sr-users < sr-users@lists.kamailio.org> a écrit :
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.
Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
--
Best regards,
Ihor (Igor) __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Hi Tihomir,
in your case it surely does not properly delete the sessions in (almost) all cases, so clearly there is a cfg error somewhere. My previous comment was about the general case, that rtpengine_manage also contains rtpengine_delete if properly used.
I would suggest to add some more logging around the rtpengine calls and then do a few test calls in your lab to see what it does and if maybe there are cases missing. If you activate debug logging for kamailio and/or rtpengine, you will also get much more information.
Cheers,
Henning
From: Tihomir Culjaga via sr-users sr-users@lists.kamailio.org Sent: Tuesday, October 22, 2024 11:53 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Cc: Tihomir Culjaga tculjaga@gmail.com Subject: [SR-Users] Re: Kamailio not deleteing rtp sessions
Hi Hennig,
i tought rtpengine_manage can do the trick of handling offer, answer and delete ... but for some reason the delete is not actually performed
Total statistics (does not include current running sessions):
Uptime of rtpengine :20075 seconds Total managed sessions :27298 Total rejected sessions :0 Total timed-out sessions via TIMEOUT :27288 Total timed-out sessions via SILENT_TIMEOUT :10 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
In the default kamailio configuration rtpengine_manage is under route[NATMANAGE].
#!ifdef WITH_RTPENGINE if(nat_uac_test("8")) { rtpengine_manage("SIP-source-address replace-origin replace-session-connection"); } else { rtpengine_manage("replace-origin replace-session-connection"); } #!else
Here i have it on route[RELAY] and onreply_route[MANAGE_REPLY]
maybe NATMANAGE is a better place to engage RTPEngine.
On Tue, 22 Oct 2024 at 11:23, Henning Westerholt via sr-users <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> wrote: Hello,
generally speaking, calling rtpengine_manage() should be enough in most cases. Compare e.g. to the kamailio default configuration and the docs of the module: https://kamailio.org/docs/modules/5.8.x/modules/rtpengine.html#rtpengine.f.r...
Cheers,
Henning
From: Ihor Olkhovskyi via sr-users <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Sent: Tuesday, October 22, 2024 9:58 AM To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Cc: Ihor Olkhovskyi <igorolhovskiy@gmail.commailto:igorolhovskiy@gmail.com> Subject: [SR-Users] Re: Kamailio not deleteing rtp sessions
Tihomir,
Actually, yes, You need to call rtpengine_delete()
Like this
request_route { .... if (is_method("CANCEL")) { if (t_check_trans()) { xlog("L_INFO", "[REQUEST_ROUTE] Relaying in-transaction CANCEL\n");
# Free previously reserved resourced rtpengine_delete(); ... } exit; } }
route[WITHINDLG] { if (has_totag()) { if (loose_route()) { ... if (is_method("BYE")) { xlog("L_INFO", "[WITHINDLG] In-dialog BYE. Invoking rtpengine_delete\n");
rtpengine_delete(); } ... }
failure_route[MANAGE_FAILURE] { if ($rs > 299) { xlog("L_INFO", "[MANAGE_FAILURE] Transaction failed with $rs > 299, invoking deleting of call on rtpengine\n");
rtpengine_delete(); } }
This is where I do this usually, but you might need to adapt it to your cases.
Le mar. 22 oct. 2024 à 08:27, Tihomir Culjaga via sr-users <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> a écrit : 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.
__________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.orgmailto:sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
-- Best regards, Ihor (Igor) __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.orgmailto:sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
On 22/10/2024 05.53, Tihomir Culjaga via sr-users wrote:
Hi Hennig,
i tought rtpengine_manage can do the trick of handling offer, answer and delete ... but for some reason the delete is not actually performed
Is the delete not performed at all? It would show in the log if it was. If it isn't, then the problem lies in the Kamailio script not invoking it. If it is but it doesn't fully close the sessions, then most likely there's a problem with branched calls and some branches not being closed (i.e. sessions being left half open).
Cheers
Hi Ihor, Thanks for your response. This can explain the lingering rtp sessions on RTPEngine. I moved the timeout from default 60 sec down to 5 sec. But still it would be better if I close them directly.
On Tue, 22 Oct 2024 at 10:40, Ihor Olkhovskyi via sr-users < sr-users@lists.kamailio.org> wrote:
Tihomir,
Actually, yes, You need to call rtpengine_delete()
Like this
request_route { .... if (is_method("CANCEL")) { if (t_check_trans()) { xlog("L_INFO", "[REQUEST_ROUTE] Relaying in-transaction CANCEL\n");
# Free previously reserved resourced rtpengine_delete(); ... } exit; }
}
route[WITHINDLG] { if (has_totag()) { if (loose_route()) { ... if (is_method("BYE")) { xlog("L_INFO", "[WITHINDLG] In-dialog BYE. Invoking rtpengine_delete\n");
rtpengine_delete(); }
... }
failure_route[MANAGE_FAILURE] { if ($rs > 299) { xlog("L_INFO", "[MANAGE_FAILURE] Transaction failed with $rs > 299, invoking deleting of call on rtpengine\n");
rtpengine_delete(); }
}
This is where I do this usually, but you might need to adapt it to your cases.
Le mar. 22 oct. 2024 à 08:27, Tihomir Culjaga via sr-users < sr-users@lists.kamailio.org> a écrit :
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.
Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
-- Best regards, Ihor (Igor) __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe: