### Description
I want to use Session timers to refresh SDP on RTPengine node failure. If call RTP streams established via first RTPengine node, and then this RTPengine node is stopped, then rtpengine Kamailio module do not try to use other RTPengine nodes.
### Troubleshooting
#### Reproduction
Update /etc/kamailio/kamailio.cfg using patch like ```diff diff --git a/etc/kamailio.cfg b/etc/kamailio.cfg index be71dbb54a..1a6788f79f 100644 --- a/etc/kamailio.cfg +++ b/etc/kamailio.cfg @@ -1,4 +1,7 @@ #!KAMAILIO +#!define WITH_DEBUG +#!define WITH_NAT +#!define WITH_RTPENGINE # # Kamailio SIP Server v5.5 - default configuration script # - web: https://www.kamailio.org @@ -195,6 +198,8 @@ children=8 * listen=[proto]:[localip]:[lport] advertise [publicip]:[pport] * - it can be set many times to add more sockets to listen to */ # listen=udp:10.0.0.10:5060 +listen=tcp:3.236.25.6:5060 +listen=tcp:[2600:1f18:578:5700::6]:5060
/* life time of TCP connection when there is no traffic * - a bit higher than registration expires to cope with UA behind NAT */ @@ -456,7 +461,7 @@ modparam("presence_xml", "force_active", 1) #!ifdef WITH_NAT #!ifdef WITH_RTPENGINE # ----- rtpengine params ----- -modparam("rtpengine", "rtpengine_sock", "udp:127.0.0.1:2223") +modparam("rtpengine", "rtpengine_sock", "udp6:rtp-us-east-1a-6.nga911.com:2223 udp6:rtp-us-east-1a-7.nga911.com:2223") #!else # ----- rtpproxy params ----- modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:7722") @@ -528,6 +533,11 @@ request_route { # handle requests within SIP dialogs route(WITHINDLG);
+ if (loose_route()) { + route(NATMANAGE); + record_route(); + route(RELAY); + } ### only initial requests (no To tag)
# authentication @@ -850,10 +860,11 @@ route[NATMANAGE] { if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB))) return;
#!ifdef WITH_RTPENGINE - if(nat_uac_test("8")) { - rtpengine_manage("SIP-source-address replace-origin replace-session-connection"); + if($avp(rtpengine_offer) == "done") { + rtpengine_answer("ICE=remove address-family=IP4 SDES=off"); } else { - rtpengine_manage("replace-origin replace-session-connection"); + rtpengine_offer("ICE=remove address-family=IP6 SDES=off"); + $avp(rtpengine_offer) = "done"; } #!else if(nat_uac_test("8")) { ```
Establish call via this Kamailio. In my case used `Route` header in initial INVITE. When a call is established, then need stop RTPengine daemon on node used for media proxing. Wait when the caller sends a session refresh. According to Kamailio logs not attempt to reach another RTPengine node if the first node not available more.
#### Log Messages In [kam.log](https://github.com/kamailio/kamailio/files/6330914/kam.log) please check messages related to ``` Call-ID: 6aac81b6-a028-11eb-8bf8-870daa274dfe CSeq: 34815260 INVITE ``` In log you will find at string 3437 ``` 11(31837) exec: {1 34815260 INVITE 6aac81b6-a028-11eb-8bf8-870daa274dfe} *** cfgtrace:dbg_cfg_trace(): branch_route=[NATMANAGE] c=[/root/kamailio/etc/kamailio.cfg] l=866 a=25 n=rtpengine_offer 11(31837) DEBUG: {1 34815260 INVITE 6aac81b6-a028-11eb-8bf8-870daa274dfe} rtpengine [rtpengine_funcs.c:144]: check_content_type(): type <application/sdp> found valid 11(31837) DEBUG: {1 34815260 INVITE 6aac81b6-a028-11eb-8bf8-870daa274dfe} rtpengine [rtpengine.c:1834]: build_rtpp_socks(): same rtpengines list version: 1 (1618738091) 11(31837) DEBUG: {1 34815260 INVITE 6aac81b6-a028-11eb-8bf8-870daa274dfe} rtpengine [rtpengine.c:3266]: select_rtpp_node_old(): rtpengine hash table lookup find node=udp6:rtp-us-east-1a-7.nga911.com:2223 for calllen=36 callid=6aac81b6-a028-11eb-8bf8-870daa274dfe viabranch= 11(31837) ERROR: {1 34815260 INVITE 6aac81b6-a028-11eb-8bf8-870daa274dfe} rtpengine [rtpengine.c:3027]: send_rtpp_command(): can't send command "offer" to RTPEngine udp6:rtp-us-east-1a-7.nga911.com:2223 11(31837) DEBUG: {1 34815260 INVITE 6aac81b6-a028-11eb-8bf8-870daa274dfe} rtpengine [rtpengine.c:1834]: build_rtpp_socks(): same rtpengines list version: 1 (1618738091) 11(31837) DEBUG: {1 34815260 INVITE 6aac81b6-a028-11eb-8bf8-870daa274dfe} rtpengine [rtpengine.c:3266]: select_rtpp_node_old(): rtpengine hash table lookup find node=udp6:rtp-us-east-1a-7.nga911.com:2223 for calllen=36 callid=6aac81b6-a028-11eb-8bf8-870daa274dfe viabranch= 11(31837) ERROR: {1 34815260 INVITE 6aac81b6-a028-11eb-8bf8-870daa274dfe} rtpengine [rtpengine.c:2664]: rtpp_function_call(): no available proxies ``` At this moment one other RTPengine node is available, but rtpengine Kamailio module does not try to reach this node.
#### SIP Traffic
[no-rtpengine-swithover.pcap.gz](https://github.com/kamailio/kamailio/files/6330925/no-rtpengine-swithover.pc...)
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
``` [centos@sbc-a2 ~]$ kamailio -v version: kamailio 5.5.0-pre0 (x86_64/linux) 9413fc 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: 9413fc compiled on 04:03:33 Apr 3 2021 with gcc 8.3.1 ```
* **Operating System**: ``` [centos@sbc-a2 ~]$ cat /etc/os-release NAME="CentOS Linux" VERSION="8" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="8" PLATFORM_ID="platform:el8" PRETTY_NAME="CentOS Linux 8" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:8" HOME_URL="https://centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-8" CENTOS_MANTISBT_PROJECT_VERSION="8" ```