swift – iOS webRTC ICE candidates – how to enable active tcptype?


My WebRTC connection is never getting established. When generating my ICE candidates on my iPhone via the WebRTC library in Swift, I receive tcptype passive on all of them. In a JavaScript version of my code I can generate ICE candidates with tcptype active and here the connection is getting established successfully.

My ICE Candidates with tcptype passive:

a=candidate:3360112390 1 tcp 1518280447 192.168.100.232 58625 typ host tcptype passive generation 0 ufrag e9vc network-id 1 network-cost 10
a=candidate:2350357220 1 tcp 1518214911 169.254.254.183 58626 typ host tcptype passive generation 0 ufrag e9vc network-id 2 network-cost 10
a=candidate:122524574 1 tcp 1518018303 10.134.230.124 58627 typ host tcptype passive generation 0 ufrag e9vc network-id 7 network-cost 900
a=candidate:23006574 1 tcp 1518151935 2a02:3032:305:edcb:e809:26f9:efe7:4032 58628 typ host tcptype passive generation 0 ufrag e9vc network-id 8 network-cost 900
a=candidate:1316923671 1 tcp 1518086399 2a02:303e:2b17:3f50:599f:f17:bf24:5bbc 58629 typ host tcptype passive generation 0 ufrag e9vc network-id 9 network-cost 900
a=candidate:990886995 1 tcp 1517957887 fdfe:f2d:3c26::1 58630 typ host tcptype passive generation 0 ufrag e9vc network-id 10 network-cost 50
a=candidate:1461496119 1 tcp 1517889791 2a02:303e:2b17:3f50:1825:7933:ec1f:af3b 58631 typ host tcptype passive generation 0 ufrag e9vc network-id 3 network-cost 50
a=candidate:1461496119 1 tcp 1517824255 2a02:303e:2b17:3f50:1825:7933:ec1f:af3b 58632 typ host tcptype passive generation 0 ufrag e9vc network-id 4 network-cost 50
a=candidate:388287157 1 udp 1686052607 176.95.203.239 52871 typ srflx raddr 192.168.100.232 rport 52871 generation 0 ufrag e9vc network-id 1 network-cost 10
a=candidate:2217923902 1 udp 1685790463 176.0.150.230 32375 typ srflx raddr 10.134.230.124 rport 61138 generation 0 ufrag e9vc network-id 7 network-cost 900

Can I somehow set this parameter in my peer connection’s config or elsewhere?

I use a standard config so far for my peer connection:

let config = RTCConfiguration()
config.iceServers = [RTCIceServer(urlStrings: ["stun:stun.l.google.com:19302"])]
config.sdpSemantics = .unifiedPlan
         
let constraints = RTCMediaConstraints(mandatoryConstraints: nil,
                                              optionalConstraints: ["DtlsSrtpKeyAgreement":kRTCMediaConstraintsValueTrue])
        
let peerConnection = factory.peerConnection(with: config, 
     constraints: constraints, delegate: nil)

Reference to the tcptye documentation

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img