Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtpengine_manage: send SDP two times #2715

Closed
sergey-safarov opened this issue Apr 18, 2021 · 1 comment
Closed

rtpengine_manage: send SDP two times #2715

sergey-safarov opened this issue Apr 18, 2021 · 1 comment

Comments

@sergey-safarov
Copy link
Member

Description

When used rtpengine_manage function then RTPengine node returns the correct response but in the outbound SIP message, SDP is duplicated.

Troubleshooting

Reproduction

Updated /etc/kamailio/kamailio.cfg like in this patch.

diff --git a/etc/kamailio.cfg b/etc/kamailio.cfg
index be71dbb54a..89960b38d8 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_manage("ICE=remove address-family=IP4 SDES=off");
        } else {
-               rtpengine_manage("replace-origin replace-session-connection");
+               rtpengine_manage("ICE=remove address-family=IP6 SDES=off");
+               $avp(rtpengine_offer) = "done";
        }
 #!else
        if(nat_uac_test("8")) {

Make a call via Kamailio node. In my case used a call with "Route" headers.

Log Messages

In Kamailio rtpengine_manage.log, you will find the correct RTPengine response, like:

9(32302) DEBUG: {1 34817407 INVITE 6b2a7c4c-a032-11eb-8c29-870daa274dfe} rtpengine [rtpengine.c:2677]: rtpp_function_call(): proxy reply: d3:sdp599:v=0^M
o=2600hz 1618708279 1618708280 IN IP4 192.168.2.10^M
s=2600hz^M
c=IN IP6 2600:1f18:578:5700::1:e^M
t=0 0^M
m=audio 16476 RTP/AVP 0 8 102 9 3 103 101 13 104 105^M
a=rtpmap:0 PCMU/8000^M
a=rtpmap:8 PCMA/8000^M
a=rtpmap:102 opus/48000/2^M
a=fmtp:102 useinbandfec=1; maxaveragebitrate=30000; maxplaybackrate=48000; ptime=20; minptime=10; maxptime=40^M
a=rtpmap:9 G722/8000^M
a=rtpmap:3 GSM/8000^M
a=rtpmap:103 SPEEX/8000^M
a=rtpmap:101 telephone-event/8000^M
a=fmtp:101 0-16^M
a=rtpmap:13 CN/8000^M
a=rtpmap:104 telephone-event/48000^M
a=fmtp:104 0-16^M
a=rtpmap:105 CN/48000^M
a=sendrecv^M
a=rtcp:16477^M
a=ptime:20^M

But SIP message will have duplicated SDP.

SIP Traffic

rtpengine_manage.pcap.gz

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"
@miconda
Copy link
Member

miconda commented Apr 20, 2021

This is a mistake in configuration file, a value is appended twice if the function is used twice. See FAQ in wiki for details of similar cases. Use sr-users mailing list to discuss the changes you did in kamailio.cfg and figure out where is the error.

@miconda miconda closed this as completed Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants