sipsorcery-org / sipsorcery

A WebRTC, SIP and VoIP library for C# and .NET. Designed for real-time communications apps.
https://sipsorcery-org.github.io/sipsorcery
Other
1.42k stars 431 forks source link

C# WPF "VOIP" app using WebRTC - Net Framework app #1062

Open skullboypl opened 7 months ago

skullboypl commented 7 months ago

My logs below. If somebody from your team can help me with that i will pay.

Received: Text Received: {"type":"ICE_CANDIDATE","candidate":{"IceServer":null,"candidate":"1345532226 1 udp 2113937663 192.168.100.89 58940 typ host generation 0","sdpMid":null,"sdpMLineIndex":0,"foundation":"1345532226","component":1,"priority":2113937663,"address":"192.168.100.89","protocol":0,"port":58940,"type":0,"tcpType":0,"relatedAddress":null,"relatedPort":0,"usernameFragment":"DGQV","DestinationEndPoint":null},"targetId":"46","fromId":"47"} Received ICE candidate: { "IceServer": null, "candidate": "1345532226 1 udp 2113937663 192.168.100.89 58940 typ host generation 0", "sdpMid": null, "sdpMLineIndex": 0, "foundation": "1345532226", "component": 1, "priority": 2113937663, "address": "192.168.100.89", "protocol": 0, "port": 58940, "type": 0, "tcpType": 0, "relatedAddress": null, "relatedPort": 0, "usernameFragment": "DGQV", "DestinationEndPoint": null } Adding ICE candidate. 47 Received: Text Received: {"type":"ICE_CANDIDATE","candidate":{"IceServer":{"TurnTimeToExpiry":"0001-01-01T00:00:00","Protocol":17},"candidate":"2980029153 1 udp 1677730047 MYIPADRESS 58940 typ srflx raddr 0.0.0.0 rport 0 generation 0","sdpMid":"0","sdpMLineIndex":0,"foundation":"2980029153","component":1,"priority":1677730047,"address":"MYIPADRESS","protocol":0,"port":58940,"type":2,"tcpType":0,"relatedAddress":null,"relatedPort":0,"usernameFragment":"DGQV","DestinationEndPoint":null},"targetId":"46","fromId":"47"} Received ICE candidate: { "IceServer": { "TurnTimeToExpiry": "0001-01-01T00:00:00", "Protocol": 17 }, "candidate": "2980029153 1 udp 1677730047 MYIPADRESS 58940 typ srflx raddr 0.0.0.0 rport 0 generation 0", "sdpMid": "0", "sdpMLineIndex": 0, "foundation": "2980029153", "component": 1, "priority": 1677730047, "address": "MYIPADRESS ", "protocol": 0, "port": 58940, "type": 2, "tcpType": 0, "relatedAddress": null, "relatedPort": 0, "usernameFragment": "DGQV", "DestinationEndPoint": null } Adding ICE candidate. 47 STUN BindingRequest sent to 108.177.14.127:19302. STUN BindingSuccessResponse received from 108.177.14.127:19302. Received: Text Received: {"type":"ICE_CANDIDATE","candidate":{"IceServer":{"TurnTimeToExpiry":"0001-01-01T00:00:00","Protocol":17},"candidate":"2980029153 1 udp 1677730047 MYIPADRESS 58940 typ srflx raddr 0.0.0.0 rport 0 generation 0","sdpMid":"0","sdpMLineIndex":0,"foundation":"2980029153","component":1,"priority":1677730047,"address":"MYIPADRESS","protocol":0,"port":58940,"type":2,"tcpType":0,"relatedAddress":null,"relatedPort":0,"usernameFragment":"DGQV","DestinationEndPoint":null},"targetId":"46","fromId":"47"} Received ICE candidate: { "IceServer": { "TurnTimeToExpiry": "0001-01-01T00:00:00", "Protocol": 17 }, "candidate": "2980029153 1 udp 1677730047 MYIPADRESS 58940 typ srflx raddr 0.0.0.0 rport 0 generation 0", "sdpMid": "0", "sdpMLineIndex": 0, "foundation": "2980029153", "component": 1, "priority": 1677730047, "address": "MYIPADRESS", "protocol": 0, "port": 58940, "type": 2, "tcpType": 0, "relatedAddress": null, "relatedPort": 0, "usernameFragment": "DGQV", "DestinationEndPoint": null } Adding ICE candidate. 47 STUN BindingRequest received from 192.168.100.89:58940. STUN BindingSuccessResponse sent to 192.168.100.89:58940. STUN BindingRequest received from 192.168.100.89:58940. ICE connection state changed to connected. ICE connection state changed to connected. Current ice connection status: connected Peer connection state changed to connecting. Current connection status: connecting STUN BindingSuccessResponse sent to 192.168.100.89:58940. STUN BindingRequest sent to 192.168.100.89:58940. STUN BindingErrorResponse received from 192.168.100.89:58940. STUN BindingRequest received from 192.168.100.89:58940. STUN BindingSuccessResponse sent to 192.168.100.89:58940. STUN BindingRequest received from 192.168.100.89:58940. STUN BindingSuccessResponse sent to 192.168.100.89:58940. STUN BindingRequest sent to 192.168.100.89:58940. STUN BindingErrorResponse received from 192.168.100.89:58940. STUN BindingRequest received from 192.168.100.89:58940. STUN BindingSuccessResponse sent to 192.168.100.89:58940. STUN BindingRequest sent to 192.168.100.89:58940. STUN BindingErrorResponse received from 192.168.100.89:58940. STUN BindingRequest received from 192.168.100.89:58940. STUN BindingSuccessResponse sent to 192.168.100.89:58940. STUN BindingRequest sent to 192.168.100.89:58940. STUN BindingErrorResponse received from 192.168.100.89:58940. Wątek 0x24b0 zakończył działanie z kodem 0 (0x0). STUN BindingRequest received from 192.168.100.89:58940. STUN BindingSuccessResponse sent to 192.168.100.89:58940. STUN BindingRequest sent to 192.168.100.89:58940. STUN BindingErrorResponse received from 192.168.100.89:58940. STUN BindingRequest received from 192.168.100.89:58940. STUN BindingSuccessResponse sent to 192.168.100.89:58940. STUN BindingRequest sent to 192.168.100.89:58940. STUN BindingErrorResponse received from 192.168.100.89:58940. Zgłoszony wyjątek: „System.TimeoutException” w SIPSorcery.dll Zgłoszony wyjątek: „Org.BouncyCastle.Crypto.Tls.TlsFatalAlert” w BouncyCastle.Crypto.dll Peer connection state changed to closed. Current connection status: closed Peer connection state changed to failed. Current connection status: failed"

sipsorcery commented 7 months ago

There is no "team" or anyone to pay. This library is an open source project without any support options other than what interested volunteers contribute.

Your logs are showing that STUN messages are able to get through to the remote peer, and the ICE connection is established. The DTLS connection attempt then timesout. It can be very tricky to track down these types of issues unless there is some telltale log message, which in this case there does not appear to be. The next best option is to use WireShark on the remote peer to determine what's going on with the DTLS connection attempt.

skullboypl commented 7 months ago

Did you ever try to make "VOIP" using C# WPF (.NET or .NET Framework) on WebRTC? And have time to help? i will check that WireShark but i never use it

sipsorcery commented 7 months ago

Did you ever try to make "VOIP" using C# WPF (.NET or .NET Framework) on WebRTC?

No. The softphone app is WPF but it's SIP rather than WebRTC,

skullboypl commented 7 months ago

1

Here is ss of filtred by ip of my friend that i try to connect to.

Any possibity to make a meet and you will help me with config for my project?

skullboypl commented 7 months ago

i even change project to .NET 8 and still same

sipsorcery commented 7 months ago

Looks like a NAT issue. The remote connection is not getting any of your connection's STUN responses which suggests they are being blocked.

You could try a TURN server if you can find a public one or are able to run your own on a public IP address. Coturn is one I have installed in the past.

skullboypl commented 7 months ago

How I can connect TRUN in SIPSorcery?

skullboypl commented 7 months ago

i have my own Coturn on dedicated server

sipsorcery commented 7 months ago

When creating the RTCPeerConnection you can specify TURN servers. Search the code for RTCIceServer:

 var iceServers = new List<RTCIceServer> {
 new RTCIceServer
     {
         urls = $"turn:{mockTurnServer.ListeningEndPoint}",
     }
 };
skullboypl commented 7 months ago

i have tested this like that" private const string STUN_URL = "stun:stun.sipsorcery.com"; private const string TURN_URL = "turn:m.vxh.pl:3478";

and then RTCConfiguration config = new RTCConfiguration { iceServers = new List<RTCIceServer> { new RTCIceServer { urls = STUN_URL }, new RTCIceServer // TURN server { urls = TURN_URL, // Adres serwera TURN credential = "MYPASSWORDHERE", // Hasło/sekret dla serwera TURN } } };

and still same problem

sipsorcery commented 7 months ago

Unusual for your TURN server not to have a username. Either way you should be getting a response from it even if it's unauthorised.

Can you post the logs with the TURN server attempt?

skullboypl commented 7 months ago

i create an user now and set iceServers = new List<RTCIceServer> { new RTCIceServer { urls = STUN_URL }, new RTCIceServer // TURN server { urls = TURN_URL, // Adres serwera TURN username = TURN_USERNAME, // Nazwa użytkownika credential = TURN_PASSWORD // Hasło } }

i will check it now

skullboypl commented 7 months ago

Still same issue: Zgłoszony wyjątek: „System.TimeoutException” w SIPSorcery.dll Zgłoszony wyjątek: „Org.BouncyCastle.Crypto.Tls.TlsFatalAlert” w BouncyCastle.Crypto.dll Peer connection state changed to closed. Zgłoszony wyjątek: „System.Net.Sockets.SocketException” w System.Net.Sockets.dll Current connection status: closed Peer connection state changed to failed. Current connection status: failed Connection failed. failed

skullboypl commented 7 months ago

in coturn status: " Feb 08 23:08:58 m turnserver[3883098]: 422: : session 003000000000000008: realm <m.vxh.pl> user <>: incoming packet BINDING processed, success "

skullboypl commented 7 months ago

I tested TURN server here: "https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/" and works fine

skullboypl commented 7 months ago

I will leave turn server with: private const string TURN_URL = "turn:m.vxh.pl:3478"; private const string TURN_USERNAME = "skullboypl"; private const string TURN_PASSWORD = "asvdasvw12431v51";

so you can help me. Later i will change data

GeorgeS2019 commented 5 months ago

@sipsorcery

Do we have integration tests that help us to understand what are needed to tests to get a working VOIP basic app based on WebRTC?