sipsorcery
sipsorcery copied to clipboard
localDescription not updated after ICE gathering
First, thanks for creating this software. I have encountered a problem with ICE candidates.
Usual flow: Create RTCPeerConnection with ICE servers (STUN/TURN) Create a DataChannel dc using createDataChannel() offer = RTCPeerConnection.createOffer(null) RTCPeerConnection.setLocalDescription(offer)
The logs indicate that the candidates were gathered.
[04:10:07 DBG] Sending TURN allocate request to ICE server turn:in.test.vz.al with address 103.97.203.7[4/1899]
[04:10:07 DBG] Sending TURN allocate request to ICE server turn:in.test.vz.al with address 103.97.203.7:3478.
[04:10:07 DBG] Sending TURN allocate request to ICE server turn:in.test.vz.al with address 103.97.203.7:3478.
[04:10:07 DBG] TURN allocate success response received for ICE server check to turn:in.test.vz.al.
[04:10:07 DBG] Adding server reflex ICE candidate for ICE server turn:in.test.vz.al and 103.97.203.7:53978.
2621592793 1 udp 1677730047 103.97.203.7 53978 typ srflx raddr 0.0.0.0 rport 0 generation 0
[04:10:07 DBG] Adding relay ICE candidate for ICE server turn:in.test.vz.al and 103.97.203.7:58258.
1805272306 1 udp 8447 103.97.203.7 58258 typ relay raddr 0.0.0.0 rport 0 generation 0
[04:10:07 DBG] ICE connection state change to complete, v=0
o=- 34324 0 IN IP4 127.0.0.1
s=sipsorcery
t=0 0
a=group:BUNDLE 0
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 0.0.0.0
a=ice-ufrag:LESV
a=ice-pwd:NVBCZTGHIAHZGYYJEHDGZFHA
a=fingerprint:sha-256 70:C4:18:A2:98:A5:A6:B9:60:A2:E8:A8:36:B9:20:AA:DF:F3:88:16:74:86:47:D1:73:9E:D3:49:FC:EC
:13:45
a=setup:actpass
a=candidate:1869570118 1 udp 2113937663 103.97.203.7 53978 typ host generation 0
a=candidate:1869570118 1 udp 2113937663 103.97.203.7 53978 typ host generation 0
a=mid:0
a=ice-options:ice2,trickle
a=sctp-port:5000
a=max-message-size:262144
.
However, the last part is the pc.localDescription. The candidates do not appear here. So maybe I had to manually add them:
pc.onicecandidate += (c) => { pc.addLocalIceCandidate(c); Console.WriteLine(c); };
No luck, still pc.localDescription is the same as if there are no candidates except host (new candidates were not added). Is there anything I am missing? Are things working as intended? For JS (Firefox/Chrome), wrtc and WebRTC-rs, I did not have to do anything special to have this working. Is there any other way to get the up-to-date localDescription
?
Thank you for your time.
Workaround:
pc.onicecandidate += (c) =>
{
pc.addLocalIceCandidate(c);
Console.WriteLine(c);
if (pc.localDescription != null)
{
if (pc.localDescription.sdp.IceCandidates == null)
pc.localDescription.sdp.IceCandidates = new List<String>();
if (c != null)
pc.localDescription.sdp.IceCandidates.Add(c.ToString());
}
};