Stun Server Configuration for webrtc

1,585 views
Skip to first unread message

Sadia Javed

unread,
Jul 4, 2018, 7:27:53 AM7/4/18
to discuss-webrtc
Hi All

I have configured STUN server for webrtc application but it is not working fine. I am not able to get peer video when peer is in other network. Following is the logs of webrtc-internal from calling party, it is getting icecandidate but than it failed:

TimeEvent
7/4/2018, 2:47:44 PMaddStream
7/4/2018, 2:47:44 PMcreateOffer
7/4/2018, 2:47:44 PMnegotiationneeded
7/4/2018, 2:47:44 PMnegotiationneeded
7/4/2018, 2:47:44 PMcreateOfferOnSuccess
7/4/2018, 2:47:44 PMsetLocalDescription
7/4/2018, 2:47:44 PMsignalingstatechange
7/4/2018, 2:47:44 PMsetLocalDescriptionOnSuccess
7/4/2018, 2:47:44 PMicegatheringstatechange
7/4/2018, 2:47:44 PMicecandidate (host)
7/4/2018, 2:47:44 PMicecandidate (host)
7/4/2018, 2:47:44 PMicecandidate (relay)
7/4/2018, 2:47:44 PMicecandidate (relay)
7/4/2018, 2:47:44 PMicecandidate (host)
7/4/2018, 2:47:44 PMicecandidate (host)
7/4/2018, 2:47:44 PMsetRemoteDescription
7/4/2018, 2:47:44 PMsignalingstatechange
7/4/2018, 2:47:44 PMiceconnectionstatechange
7/4/2018, 2:47:44 PMonAddStream
7/4/2018, 2:47:44 PMsetRemoteDescriptionOnSuccess
7/4/2018, 2:47:44 PMaddIceCandidate (host)
7/4/2018, 2:47:44 PMaddIceCandidate (host)
7/4/2018, 2:47:59 PMiceconnectionstatechange
failed
 I tested stun server configuration on trickle ice, I am not getting srflx components. I am only getting host components. Let me know if anyone faced this issue and how to fix it?

Thanks

Philipp Hancke

unread,
Jul 4, 2018, 10:29:31 AM7/4/18
to WebRTC-discuss
you are getting relay candidates for one side but not the other. That means either the other side is either not configured correctly or (which is surprisingly common) on a network which doesn't allow UDP. Have you tried configuring TURN/TCP? If you have access to both devices, comparing to another service such as appear.in might be the quickest way to get results.

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/19cbd44e-a770-47d3-a580-2e1fd7cde2c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sadia Javed

unread,
Jul 5, 2018, 3:47:51 AM7/5/18
to discuss...@googlegroups.com
Thanks Philipp

You were right, it is the network which is blocking UDP (and TCP also) communication. when i am testing both parties on different public networks, STUN is working fine. One more question if you can help me how to test TURN for relay. i know it is used when communication between p2p fails, can it be done forcefully?

Sadia Javed

unread,
Jul 5, 2018, 3:51:16 AM7/5/18
to discuss...@googlegroups.com
My internal network is behind NAT or might have some other rules which were hindering the communication.

On Thu, Jul 5, 2018 at 11:47 AM, Sadia Javed <sadia...@expertflow.com> wrote:
Thanks Philipp

You were right, it is the network which is blocking UDP (and TCP also) communication. when i am testing both parties on different public networks, STUN is working fine. One more question if you can help me how to test TURN for relay. i know it is used when communication between p2p fails, can it be done forcefully?

Philipp Hancke

unread,
Jul 5, 2018, 9:48:03 AM7/5/18
to WebRTC-discuss
passing iceTransportPolicy: "relay" to the peerconnection constructor like this:
var pc = new RTCPeerConnection({iceServers: ..., iceTransportPolicy: 'relay'})
will force TURN.

2018-07-05 0:47 GMT-07:00 Sadia Javed <sadia...@expertflow.com>:
Thanks Philipp

You were right, it is the network which is blocking UDP (and TCP also) communication. when i am testing both parties on different public networks, STUN is working fine. One more question if you can help me how to test TURN for relay. i know it is used when communication between p2p fails, can it be done forcefully?

Sadia Javed

unread,
Jul 10, 2018, 6:22:20 AM7/10/18
to discuss-webrtc
I changed the configuration to forced 'relay'. Video/audio is not being relayed. I am getting a relay component on trickle ice test page though, when i give turn server uri. I am attaching the turn server logs and chrome logs for video call. 

Does any one knows why i am not getting peer video. i have gone through many google posts but could not find any solution yet.

My turn server configurations seems to be fine and server logs are :

0: log file opened: /var/log/turn_5915_2018-07-10.log
0:
RFC 3489/5389/5766/5780/6062/6156 STUN/TURN Server
Version Coturn-4.5.0.6 'dan Eider'
0:
Max number of open files/sockets allowed for this process: 1048576
0:
Due to the open files/sockets limitation,
max supported number of TURN Sessions possible is: 524000 (approximately)
0:

==== Show him the instruments, Practical Frost: ====

0: TLS is not supported
0: DTLS supported
0: DTLS 1.2 supported
0: TURN/STUN ALPN supported
0: Third-party authorization (oAuth) supported
0: GCM (AEAD) supported
0: OpenSSL compile-time version: OpenSSL 1.1.0g  2 Nov 2017 (0x1010007f)
0:
0: SQLite is not supported
0: Redis is not supported
0: PostgreSQL is not supported
0: MySQL is not supported
0: MongoDB is not supported
0:
0: Default Net Engine version: 3 (UDP thread per CPU core)

=====================================================

0: Config file found: /root/../etc/turnserver.conf
0: Listener address to use: 192.168.1.34
0: Relay address to use: 192.168.1.34
ERROR: Cannot open log file for writing: /var/log/turnserver/turn_2018-07-10.log
0: log file opened: /var/log/turn_5915_2018-07-10.log
0: Config file found: /root/../etc/turnserver.conf
0: Domain name:
0: Default realm: 1.2.3.4
0: DTLS1.2: Certificate file found: /etc/ssl/certificate.pem
0: DTLS1.2: Private key file found: /etc/ssl/privatekey.pem
0: DTLS: Certificate file found: /etc/ssl/certificate.pem
0: DTLS: Private key file found: /etc/ssl/privatekey.pem
0: DTLS cipher suite: DEFAULT
0: pid file created: /var/run/turnserver.pid
0: IO method (main listener thread): epoll (with changelist)
0: WARNING: I cannot support STUN CHANGE_REQUEST functionality because only one                                                                                         IP address is provided
0: Wait for relay ports initialization...
0:   relay 192.168.1.34 initialization...
0:   relay 192.168.1.34 initialization done
0: Relay ports initialization done
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=0 created
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=1 created
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=2 created
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=3 created
0: Total General servers: 4
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (admin thread): epoll (with changelist)


Chrome logs from PeerA for the video call are:

https://192.168.1.78:5555/index.html?id=68014, { iceServers: [stun:1.2.3.4:4455?transport=udp, turn:1.2.3.4:3478?transport=udp, turn:1.2.3.4:3478?transport=tcp], iceTransportPolicy: relay, bundlePolicy: balanced, rtcpMuxPolicy: require, iceCandidatePoolSize: 0 },

TimeEvent
7/10/2018, 2:07:04 PMaddStream
7/10/2018, 2:07:04 PMsetRemoteDescription
7/10/2018, 2:07:04 PMcreateAnswer
7/10/2018, 2:07:04 PMnegotiationneeded
7/10/2018, 2:07:04 PMnegotiationneeded
7/10/2018, 2:07:04 PMsignalingstatechange
7/10/2018, 2:07:04 PMonAddStream
7/10/2018, 2:07:04 PMsetRemoteDescriptionOnSuccess
7/10/2018, 2:07:04 PMcreateAnswerOnSuccess
7/10/2018, 2:07:04 PMsetLocalDescription
7/10/2018, 2:07:04 PMsignalingstatechange
7/10/2018, 2:07:04 PMsetLocalDescriptionOnSuccess
7/10/2018, 2:07:04 PMicegatheringstatechange
7/10/2018, 2:07:05 PMaddIceCandidate (relay)
7/10/2018, 2:07:05 PMiceconnectionstatechange
7/10/2018, 2:07:05 PMaddIceCandidate (relay)
7/10/2018, 2:07:05 PMaddIceCandidate (relay)
7/10/2018, 2:07:44 PMicegatheringstatechange
complete


shakeeb nazmus

unread,
Jul 11, 2018, 12:30:45 AM7/11/18
to discuss-webrtc
Are you running your TURN server behind NAT ?

Sadia Javed

unread,
Jul 11, 2018, 1:37:10 AM7/11/18
to discuss...@googlegroups.com
No it is not. i even tired it giving live IP but did not got any success yet.

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages