<p></p>
<h3>Description</h3>
<p>When used <code>rtpengine_manage</code> function then <code>RTPengine</code> node returns the correct response but in the outbound SIP message, SDP is duplicated.</p>
<h3>Troubleshooting</h3>
<h4>Reproduction</h4>
<p>Updated /etc/kamailio/kamailio.cfg like in this patch.</p>
<div class="highlight highlight-source-diff"><pre><span class="pl-c1">diff --git a/etc/kamailio.cfg b/etc/kamailio.cfg</span>
index be71dbb54a..89960b38d8 100644
<span class="pl-md">--- a/etc/kamailio.cfg</span>
<span class="pl-mi1">+++ b/etc/kamailio.cfg</span>
<span class="pl-mdr">@@ -1,4 +1,7 @@</span>
 #!KAMAILIO
<span class="pl-mi1"><span class="pl-mi1">+</span>#!define WITH_DEBUG</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>#!define WITH_NAT</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>#!define WITH_RTPENGINE</span>
 #
 # Kamailio SIP Server v5.5 - default configuration script
 #     - web: https://www.kamailio.org
<span class="pl-mdr">@@ -195,6 +198,8 @@</span> 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
<span class="pl-mi1"><span class="pl-mi1">+</span>listen=tcp:3.236.25.6:5060</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>listen=tcp:[2600:1f18:578:5700::6]:5060</span>
 
 /* life time of TCP connection when there is no traffic
  * - a bit higher than registration expires to cope with UA behind NAT */
<span class="pl-mdr">@@ -456,7 +461,7 @@</span> modparam("presence_xml", "force_active", 1)
 #!ifdef WITH_NAT
 #!ifdef WITH_RTPENGINE
 # ----- rtpengine params -----
<span class="pl-md"><span class="pl-md">-</span>modparam("rtpengine", "rtpengine_sock", "udp:127.0.0.1:2223")</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>modparam("rtpengine", "rtpengine_sock", "udp6:rtp-us-east-1a-6.nga911.com:2223 udp6:rtp-us-east-1a-7.nga911.com:2223")</span>
 #!else
 # ----- rtpproxy params -----
 modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:7722")
<span class="pl-mdr">@@ -528,6 +533,11 @@</span> request_route {
        # handle requests within SIP dialogs
        route(WITHINDLG);
 
<span class="pl-mi1"><span class="pl-mi1">+</span>       if (loose_route()) {</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>               route(NATMANAGE);</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>               record_route();</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>               route(RELAY);</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>       }</span>
        ### only initial requests (no To tag)
 
        # authentication
<span class="pl-mdr">@@ -850,10 +860,11 @@</span> route[NATMANAGE] {
        if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB))) return;
 
 #!ifdef WITH_RTPENGINE
<span class="pl-md"><span class="pl-md">-</span>       if(nat_uac_test("8")) {</span>
<span class="pl-md"><span class="pl-md">-</span>               rtpengine_manage("SIP-source-address replace-origin replace-session-connection");</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>       if($avp(rtpengine_offer) == "done") {</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>               rtpengine_manage("ICE=remove address-family=IP4 SDES=off");</span>
        } else {
<span class="pl-md"><span class="pl-md">-</span>               rtpengine_manage("replace-origin replace-session-connection");</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>               rtpengine_manage("ICE=remove address-family=IP6 SDES=off");</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>               $avp(rtpengine_offer) = "done";</span>
        }
 #!else
        if(nat_uac_test("8")) {</pre></div>
<p>Make a call via Kamailio node. In my case used a call with "Route" headers.</p>
<h4>Log Messages</h4>
<p>In Kamailio <a href="https://github.com/kamailio/kamailio/files/6331086/rtpengine_manage.log">rtpengine_manage.log</a>, you will find the correct RTPengine response, like:</p>
<pre><code>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
</code></pre>
<p>But SIP message will have duplicated SDP.</p>
<h4>SIP Traffic</h4>
<p><a href="https://github.com/kamailio/kamailio/files/6331088/rtpengine_manage.pcap.gz">rtpengine_manage.pcap.gz</a></p>
<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<pre><code>[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
</code></pre>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>
<pre><code>[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"
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2715">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZOARMFIC5MO3ERKMZLTJK3QRANCNFSM43EDELOQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZKZYSG6H2TMCYVEL7DTJK3QRA5CNFSM43EDELO2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4M2MHPSA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2715",
"url": "https://github.com/kamailio/kamailio/issues/2715",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>