WebRTCPeer ICE connection problem of "kurento-rtsp2webrtc" demo on AWS EC2

902 views
Skip to first unread message

stanl...@aeonmatrix.com

unread,
Aug 6, 2015, 12:54:36 AM8/6/15
to kurento
Hi Kurento Support Team,

I follow the instruction of kurento-rtsp2webrtc to pracitce the demo.

I can run this demo on local network environment successfully.

And I try to run this demo on AWS EC2, unfortunately it returns "oniceconnectionstatechange -> failed" on a browser console log.

It means that "webRtcPeer.peerConnection.iceConnectionState" is false at line 75 in index.js of the demo.

My EC2 setting is:
Instant Type: t2.micro
Public IP: 54.69.171.72
          Firewall: all connection open

KMS versions:
Version: 6.0.0
Found modules:
        Module: 'core' version '6.0.0'
        Module: 'elements' version '6.0.0'
        Module: 'filters' version '6.0.0'

And the browser console log is:
constraints: {"mandatory":{"OfferToReceiveAudio":true,"OfferToReceiveVideo":true},"optional":[{"DtlsSrtpKeyAgreement":true}]}
Created SDP offer
Local description set
Local icecandidate {"candidate":"candidate:2999745851 1 udp 2122260223 192.168.56.1 62171 typ host generation 0","sdpMid":"audio","sdpMLineIndex":0}
Local icecandidate {"candidate":"candidate:1221703924 1 udp 2122194687 192.168.0.105 62172 typ host generation 0","sdpMid":"audio","sdpMLineIndex":0}
Local icecandidate {"candidate":"candidate:2999745851 2 udp 2122260222 192.168.56.1 62173 typ host generation 0","sdpMid":"audio","sdpMLineIndex":0}
Local icecandidate {"candidate":"candidate:1221703924 2 udp 2122194686 192.168.0.105 62174 typ host generation 0","sdpMid":"audio","sdpMLineIndex":0}
Local icecandidate {"candidate":"candidate:2999745851 1 udp 2122260223 192.168.56.1 62175 typ host generation 0","sdpMid":"video","sdpMLineIndex":1}
Local icecandidate {"candidate":"candidate:1221703924 1 udp 2122194687 192.168.0.105 62176 typ host generation 0","sdpMid":"video","sdpMLineIndex":1}
Local icecandidate {"candidate":"candidate:2999745851 2 udp 2122260222 192.168.56.1 62177 typ host generation 0","sdpMid":"video","sdpMLineIndex":1}
Local icecandidate {"candidate":"candidate:1221703924 2 udp 2122194686 192.168.0.105 62178 typ host generation 0","sdpMid":"video","sdpMLineIndex":1}
Local icecandidate {"candidate":"candidate:4233069003 1 tcp 1518280447 192.168.56.1 0 typ host tcptype active generation 0","sdpMid":"audio","sdpMLineIndex":0}
Local icecandidate {"candidate":"candidate:106054660 1 tcp 1518214911 192.168.0.105 0 typ host tcptype active generation 0","sdpMid":"audio","sdpMLineIndex":0}
Local icecandidate {"candidate":"candidate:4233069003 2 tcp 1518280446 192.168.56.1 0 typ host tcptype active generation 0","sdpMid":"audio","sdpMLineIndex":0}
Local icecandidate {"candidate":"candidate:106054660 2 tcp 1518214910 192.168.0.105 0 typ host tcptype active generation 0","sdpMid":"audio","sdpMLineIndex":0}
Local icecandidate {"candidate":"candidate:4233069003 1 tcp 1518280447 192.168.56.1 0 typ host tcptype active generation 0","sdpMid":"video","sdpMLineIndex":1}
Local icecandidate {"candidate":"candidate:106054660 1 tcp 1518214911 192.168.0.105 0 typ host tcptype active generation 0","sdpMid":"video","sdpMLineIndex":1}
Local icecandidate {"candidate":"candidate:4233069003 2 tcp 1518280446 192.168.56.1 0 typ host tcptype active generation 0","sdpMid":"video","sdpMLineIndex":1}
Local icecandidate {"candidate":"candidate:106054660 2 tcp 1518214910 192.168.0.105 0 typ host tcptype active generation 0","sdpMid":"video","sdpMLineIndex":1}
Local icecandidate {"candidate":"candidate:3382296128 1 udp 1685987071 36.226.135.180 62172 typ srflx raddr 192.168.0.105 rport 62172 generation 0","sdpMid":"audio","sdpMLineIndex":0}
Local icecandidate {"candidate":"candidate:3382296128 1 udp 1685987071 36.226.135.180 62176 typ srflx raddr 192.168.0.105 rport 62176 generation 0","sdpMid":"video","sdpMLineIndex":1}
Local icecandidate {"candidate":"candidate:3382296128 2 udp 1685987070 36.226.135.180 62178 typ srflx raddr 192.168.0.105 rport 62178 generation 0","sdpMid":"video","sdpMLineIndex":1}
Local icecandidate {"candidate":"candidate:3382296128 2 udp 1685987070 36.226.135.180 62174 typ srflx raddr 192.168.0.105 rport 62174 generation 0","sdpMid":"audio","sdpMLineIndex":0}
SDP answer received, setting remote description
Remote URL:
oniceconnectionstatechange -> checking
icegatheringstate -> gathering
PlayerEndpoint-->WebRtcEndpoint connection established
Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:1 1 UDP 2013266431 172.31.18.85 36473 typ host","sdpMLineIndex":0,"sdpMid":"audio"}
ICE candidate received
Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:1 1 UDP 2013266431 172.31.18.85 36473 typ host","sdpMLineIndex":1,"sdpMid":"video"}
ICE candidate received
Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:1 2 UDP 2013266430 172.31.18.85 35475 typ host","sdpMLineIndex":0,"sdpMid":"audio"}
ICE candidate received
Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:1 2 UDP 2013266430 172.31.18.85 35475 typ host","sdpMLineIndex":1,"sdpMid":"video"}
ICE candidate received
Player playing ...
oniceconnectionstatechange -> failed
icegatheringstate -> complete

 I also set a stun server information (stun.l.google.com:19302) in kurento.conf.json, but the issue still there.

Thanks.

Regards,
Stanley Lee
 
 

Message has been deleted
Message has been deleted

Ivan Gracia

unread,
Aug 6, 2015, 5:15:17 AM8/6/15
to Kurento Public, stanl...@aeonmatrix.com
Check with a different STUN, though that one should be working. Where are you setting that STUN configuration?

Ivan Gracia



On Thu, Aug 6, 2015 at 7:02 AM, <stanl...@aeonmatrix.com> wrote:
May the IP 172.31.18.85 in remote ice candidate is a key point in these issue?

Because my EC2 instant public IP is 54.69.171.72.

And you can try it http://54.69.171.72:8080/

--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

stanl...@aeonmatrix.com

unread,
Aug 6, 2015, 7:06:15 AM8/6/15
to kurento, stanl...@aeonmatrix.com
Hi Ivan,

My example of "kurento.conf.json" is like:
{
  "mediaServer" : {
    "resources": {
        "garbageCollectorPeriod": 240
    },
    "net" : {
      "websocket": {
        "port": 8888,
        "path": "kurento",
        "threads": 10
      }
    }
  },
  "modules": {
    "WebRtcEndpoint" : {
      "stunServerAddress" : "stun.l.google.com",
      "stunServerPort" : 19302
    }
  }
}

And "kurento.conf.json" is located at /etc/kurento/

Thanks!

Ivan Gracia

unread,
Aug 6, 2015, 7:11:15 AM8/6/15
to Kurento Public, stanl...@aeonmatrix.com
The best way to know what config is being loaded by the KMS is in the server logs, at the beginning. When in doubt about what's being loaded, have a look there. In any case, there are two things to consider here
  • Host names are not supported in config files, so you'll need to put an IP there
  • It looks like you are migrating from KMS5, as you are setting the configuration in the wrong file. Please have a look at the migration guide, as the configuration files have moved a bit. Now, each module has its own config file, and they overwrite whatever is written in kurento.conf.json


Ivan Gracia


stanl...@aeonmatrix.com

unread,
Aug 6, 2015, 7:53:13 AM8/6/15
to kurento, stanl...@aeonmatrix.com
Hi Ivan,

Thanks to your tips. Now I modify the configure file "/etc/kurento/modules/kurento/WebRtcEndpoint.conf.ini"
stunServerAddress=77.72.169.155:3478
stunServerPort=3478

And I test some stun servers from the list.

But the remote icecandidate still sets IP to 172.31.18.85 (this IP is my EC2 instance local IP).

So is it possible the NAT EC2 uses symmetric NAT?

I think I will try to set up a TURN server later...

Thanks.

Ivan Gracia

unread,
Aug 6, 2015, 8:10:41 AM8/6/15
to Kurento Public, stanl...@aeonmatrix.com

We’ve set up quite a number of KMS instances in AWS, and only used STUN. In any case, the stunServerAddress field is wrong, as you are setting also the port.


Ivan Gracia


stanl...@aeonmatrix.com

unread,
Aug 6, 2015, 9:02:50 AM8/6/15
to kurento, stanl...@aeonmatrix.com
Hi Ivan, 

Thank to your reminder. Now it can run!!!

Thanks a lot.

stanl...@aeonmatrix.com

unread,
Aug 6, 2015, 9:07:48 AM8/6/15
to kurento, stanl...@aeonmatrix.com
And I use 173.194.71.127:19302 this stun server. It can work.

173.194.66.127:19302 and 77.72.169.155:3478 these two stun servers can not work in EC2.


It's very helpful for Kurento beginner.

Thanks for your help.

sandeep kumar

unread,
Apr 14, 2017, 9:48:27 PM4/14/17
to kurento, stanl...@aeonmatrix.com
Hi Stanley,

I am also using ec2 and having exact same issue. I am getting below error message:

console.js:77 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:5 2 TCP 1019216382 172.31.17.119 9 typ host tcptype active","sdpMLineIndex":0,"sdpMid":"audio"}
kurento-utils.js:251 Remote ICE candidate received Object {__module__: "kurento", __type__: "IceCandidate", candidate: "candidate:5 2 TCP 1019216382 172.31.17.119 9 typ host tcptype active", sdpMLineIndex: 0, sdpMid: "audio"}
console.js:77 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:5 2 TCP 1019216382 172.31.17.119 9 typ host tcptype active","sdpMLineIndex":1,"sdpMid":"video"}
kurento-utils.js:251 Remote ICE candidate received Object {__module__: "kurento", __type__: "IceCandidate", candidate: "candidate:5 2 TCP 1019216382 172.31.17.119 9 typ host tcptype active", sdpMLineIndex: 1, sdpMid: "video"}
console.js:77 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:6 2 TCP 1015022078 172.31.17.119 39590 typ host tcptype passive","sdpMLineIndex":0,"sdpMid":"audio"}
kurento-utils.js:251 Remote ICE candidate received Object {__module__: "kurento", __type__: "IceCandidate", candidate: "candidate:6 2 TCP 1015022078 172.31.17.119 39590 typ host tcptype passive", sdpMLineIndex: 0, sdpMid: "audio"}
console.js:77 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:6 2 TCP 1015022078 172.31.17.119 39590 typ host tcptype passive","sdpMLineIndex":1,"sdpMid":"video"}
kurento-utils.js:251 Remote ICE candidate received Object {__module__: "kurento", __type__: "IceCandidate", candidate: "candidate:6 2 TCP 1015022078 172.31.17.119 39590 typ host tcptype passive", sdpMLineIndex: 1, sdpMid: "video"}
console.js:77 Player playing ...
console.js:77 oniceconnectionstatechange -> failed
console.js:77 icegatheringstate -> complete

My eth0 IP address 172.31.17.119 is being picked, instead of my public IP 52.221.210.41.  

I have updated STUN server to in WebRtcEndpoint.conf.ini to:

stunServerAddress=173.194.71.127
stunServerPort=19302

Any help will be greatly appreciated.

Micael Gallego

unread,
Apr 16, 2017, 6:17:52 AM4/16/17
to kur...@googlegroups.com, stanl...@aeonmatrix.com
Maybe you need a TURN server. There are networks in which STUN server is not enough

Best regards

Micael Gallego
Kurento / OpenVidu Project Lead

To unsubscribe from this group and stop receiving emails from it, send an email to kurento+unsubscribe@googlegroups.com.
To post to this group, send email to kur...@googlegroups.com.
Visit this group at https://groups.google.com/group/kurento.
To view this discussion on the web visit https://groups.google.com/d/msgid/kurento/97078566-edde-44bb-8169-631a821423f9%40googlegroups.com.

sandeep kumar

unread,
Apr 16, 2017, 10:10:00 AM4/16/17
to kur...@googlegroups.com, stanl...@aeonmatrix.com
Thank you michael for response,

For TURN server, I haved added 

turnURL=JZEOEt2V3Qb0y27GRntt2u2PAYA=:28224511:1379330808@turn:192.158.29.39:3478?transport=udp

in WebRtcEndpoint.conf.ini


Still I am getting same error:

console.js:77 Player playing ...
console.js:77 oniceconnectionstatechange -> failed
console.js:77 icegatheringstate -> complete


--
You received this message because you are subscribed to a topic in the Google Groups "kurento" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kurento/qkvj0tpiX5c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kurento+unsubscribe@googlegroups.com.

To post to this group, send email to kur...@googlegroups.com.
Visit this group at https://groups.google.com/group/kurento.

For more options, visit https://groups.google.com/d/optout.



--

Regards,

Sandeep Kumar

jusaf

unread,
Apr 18, 2017, 1:03:17 PM4/18/17
to kurento, stanl...@aeonmatrix.com
Hi Sandeep,

First of all your TURN syntax seems incorrect, instead of:
turnURL=JZEOEt2V3Qb0y27GRntt2u2PAYA=:28224511:1379330808@turn:192.158.29.39:3478?transport=udp

i think it should be:
turnURL=JZEOEt2V3Qb0y27GRntt2u2PAYA=:28224511:1379330808@192.158.29.39:3478?transport=udp
as you can see i've removed the protocol.

And second of all, that TURN server doesn't seem to work, you can use this tool to test STUN/TURN servers: https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/
Personally i use the TURN from Twilio but its not free so if you need a free TURN you could try to run your own using Coturn.

Good luck
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
To post to this group, send email to kur...@googlegroups.com.
Visit this group at https://groups.google.com/group/kurento.
To view this discussion on the web visit https://groups.google.com/d/msgid/kurento/97078566-edde-44bb-8169-631a821423f9%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "kurento" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kurento/qkvj0tpiX5c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kurento+u...@googlegroups.com.

To post to this group, send email to kur...@googlegroups.com.
Visit this group at https://groups.google.com/group/kurento.

sandeep kumar

unread,
Apr 20, 2017, 9:13:52 PM4/20/17
to kur...@googlegroups.com, Stanley Lee
Thank you Stanley, community, it's playing now.

Actually, I didn't even had to specify a TURN URL, I specified the STUN URL as:

stunServerAddress=74.125.200.127
stunServerPort=19302

To unsubscribe from this group and all its topics, send an email to kurento+unsubscribe@googlegroups.com.

To post to this group, send email to kur...@googlegroups.com.
Visit this group at https://groups.google.com/group/kurento.

For more options, visit https://groups.google.com/d/optout.

sandeep kumar

unread,
Apr 20, 2017, 11:28:05 PM4/20/17
to kur...@googlegroups.com, Stanley Lee
Next this WebRTC stream which is coming to browser needs to be broadcasted. I want to do the broadcast from KMS, so that multiple clients can connect to the same webRTC stream and watch matches. How can I head in that direction, or there is already any tutorial for that, guide me.


But here the source is WebRTC from browser. I want the source to be WebRTC from server.

Originally, I followed https://github.com/lulop-k/kurento-rtsp2webrtc and got working ts stream to browser by your support




Himanshu Srivastava

unread,
Aug 4, 2020, 6:18:59 AM8/4/20
to kurento
Hi Team,

I installed the Kurento server and its working well on the localhost browser. But when I tried on different servers of the same network using the IP address its starts showing following error:- 

oniceconnectionstatechange -> disconnected
avss-client-sdk.js:42 icegatheringstate -> gathering


Sharing logs for your references
Local icecandidate {"candidate":"candidate:430735571 1 udp 2113937151 2a763b9b-5896-4765-949e-2a8a4692a929.local 45146 typ host generation 0 ufrag 6GyF network-cost 999","sdpMid":"0","sdpMLineIndex":0}
avss-client-sdk.js:98 Local icecandidate {"candidate":"candidate:4101234529 1 udp 2113939711 44afa69f-4b2d-4644-9c5b-6576097c51b4.local 53717 typ host generation 0 ufrag 6GyF network-cost 999","sdpMid":"0","sdpMLineIndex":0}
avss-client-sdk.js:98 Local icecandidate {"candidate":"candidate:430735571 1 udp 2113937151 2a763b9b-5896-4765-949e-2a8a4692a929.local 55710 typ host generation 0 ufrag 6GyF network-cost 999","sdpMid":"1","sdpMLineIndex":1}
avss-client-sdk.js:98 Local icecandidate {"candidate":"candidate:4101234529 1 udp 2113939711 44afa69f-4b2d-4644-9c5b-6576097c51b4.local 53184 typ host generation 0 ufrag 6GyF network-cost 999","sdpMid":"1","sdpMLineIndex":1}
avss-client-sdk.js:80 PlayerEndpoint-->WebRtcEndpoint connection established
avss-client-sdk.js:108 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:1 1 UDP 2013266431 172.17.0.2 22302 typ host","sdpMLineIndex":0,"sdpMid":"0"}
avss-client-sdk.js:108 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:1 1 UDP 2013266431 172.17.0.2 22302 typ host","sdpMLineIndex":1,"sdpMid":"1"}
avss-client-sdk.js:41 oniceconnectionstatechange -> checking
avss-client-sdk.js:42 icegatheringstate -> gathering
avss-client-sdk.js:108 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:2 1 TCP 1015021823 172.17.0.2 9 typ host tcptype active","sdpMLineIndex":0,"sdpMid":"0"}
avss-client-sdk.js:108 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:2 1 TCP 1015021823 172.17.0.2 9 typ host tcptype active","sdpMLineIndex":1,"sdpMid":"1"}
avss-client-sdk.js:108 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:3 1 TCP 1010827519 172.17.0.2 36689 typ host tcptype passive","sdpMLineIndex":0,"sdpMid":"0"}
avss-client-sdk.js:108 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:3 1 TCP 1010827519 172.17.0.2 36689 typ host tcptype passive","sdpMLineIndex":1,"sdpMid":"1"}
avss-client-sdk.js:108 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:1 2 UDP 2013266430 172.17.0.2 49461 typ host","sdpMLineIndex":0,"sdpMid":"0"}
avss-client-sdk.js:108 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:1 2 UDP 2013266430 172.17.0.2 49461 typ host","sdpMLineIndex":1,"sdpMid":"1"}
avss-client-sdk.js:108 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:2 2 TCP 1015021822 172.17.0.2 9 typ host tcptype active","sdpMLineIndex":0,"sdpMid":"0"}
avss-client-sdk.js:108 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:2 2 TCP 1015021822 172.17.0.2 9 typ host tcptype active","sdpMLineIndex":1,"sdpMid":"1"}
avss-client-sdk.js:108 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:3 2 TCP 1010827518 172.17.0.2 54541 typ host tcptype passive","sdpMLineIndex":0,"sdpMid":"0"}
avss-client-sdk.js:108 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:3 2 TCP 1010827518 172.17.0.2 54541 typ host tcptype passive","sdpMLineIndex":1,"sdpMid":"1"}
avss-client-sdk.js:85 Player playing ...
avss-client-sdk.js:108 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:6 1 UDP 335544831 136.233.45.153 58549 typ relay raddr 172.17.0.2 rport 9","sdpMLineIndex":0,"sdpMid":"0"}
avss-client-sdk.js:108 Remote icecandidate {"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:6 1 UDP 335544831 136.233.45.153 58549 typ relay raddr 172.17.0.2 rport 9","sdpMLineIndex":1,"sdpMid":"1"}
oniceconnectionstatechange -> disconnected
avss-client-sdk.js:42 icegatheringstate -> gathering
Reply all
Reply to author
Forward
0 new messages