The problem is in a WebRTC scenario. Where a client is using a VPN, and STUN Server returns 2 ice candidates, one (the most priority one) with its real IP, and the other one with VPN exposed IP.
What happens is: >= 13.5, RTPEngine chooses the wrong candidate (VPN one).
So, RTPEngine sends audio to VPN IP, and relays to the other peer (no audio).
This is really strange because the audio always reach RTPEngine via the real IP (2.x).
Some interesting points i have observed:
- This not happens always, happens testing with Google STUN Server, if i test with a self-hosted Coturn, does not happen anymore.
- This problem happens if STUN bind response (map-addr) from VPN IP (104.x) resolves before the DTLS handshake completes. If does not complete before DTLS handshake, the problem does not happen. This is the behavior i saw switching between Google STUN Server and Coturn;
Based on this, seems to be a timing/delay thing. But, in 13.4 this never happens, so any logic in code starts triggering this after 13.5 (happens, for 13.5, 14.1 and 26.0).
Same RTPEngine conf and Kamailio flags are used in both scenarios, the only change is from RTPEngine version.
The only important point in the rtpengine conf is endpoint-learning=heuristic.
The flags from kamailio:
", "ICE": "remove", "label": "offer", "direction": [ "pub", "priv" ], "flags": [ "trust-address", "strict-source" ], "replace": [ "origin" ], "transport-protocol": "RTP/AVP", "rtcp-mux": [ "demux" ], "call-id": "n95t64bgod09hts8oa22", "received-from": [ "IP4", "104.28.181.215" ], "from-tag": "b77uo32mea", "command": "offer" }
", "ICE": "force", "label": "answer", "direction": [ "priv", "pub" ], "flags": [ "trust-address", "strict-source" ], "replace": [ "origin" ], "transport-protocol": "UDP/TLS/RTP/SAVPF", "rtcp-mux": [ "offer" ], "SDES": [ "off" ], "call-id": "n95t64bgod09hts8oa22", "received-from": [ "IP4", "10.34.70.118" ], "from-tag": "b77uo32mea", "to-tag": "rKc6XcDB4XH4c", "command": "answer" }
INVITE SDP -->
v=0
o=- 3025983496308153705 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0
a=extmap-allow-mixed
a=msid-semantic: WMS 7bc57e45-4954-495c-960f-ca2e4ea7bd5d
m=audio 49180 UDP/TLS/RTP/SAVPF 111 63 9 0 8 13 110 126
c=IN IP4 2.83.67.147
a=rtcp:9 IN IP4 0.0.0.0
a=candidate:120520624 1 udp 1685987071 2.83.67.147 49180 typ srflx raddr 192.168.1.81 rport 49180 generation 0 network-id 1 network-cost 10
a=candidate:1819658633 1 udp 1685855999 104.28.181.215 28117 typ srflx raddr 172.16.0.2 rport 53863 generation 0 network-id 3 network-cost 50
a=ice-ufrag:LrjH
a=ice-pwd:5EziLE9744AcDR42YX1zV4Xs
a=ice-options:trickle
a=fingerprint:sha-256 D8:48:87:A5:F2:A7:B2:4C:28:F5:3D:49:0C:A1:AC:9F:0F:1A:B6:1E:84:AA:1F:8E:2A:3D:3C:08:12:F4:89:E5
a=setup:actpass
a=mid:0
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2
http://www.webrtc.org/experiments/rtp-hdrext/abs-send-timea=extmap:3
http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=sendrecv
a=msid:7bc57e45-4954-495c-960f-ca2e4ea7bd5d 026487d4-c6b2-471f-b1f3-4e77810dbb79
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:63 red/48000/2
a=fmtp:63 111/111
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:126 telephone-event/8000
a=ssrc:1382527953 cname:NlxN7bgjqFQ3Yclh
a=ssrc:1382527953 msid:7bc57e45-4954-495c-960f-ca2e4ea7bd5d 026487d4-c6b2-471f-b1f3-4e77810dbb79
Thank you