mardi 21 juin 2016

peerjs/coturn: iceConnectionState is disconnected (when used over the internet)

This question has been asked before, but I have not found an answer yet. I'm basically having the same problem as described here and here.

I'm trying to set up a webRTC connection using PeerJS. It works flawlessly in LAN but I can't get it to work over the internet. I'm using coturn as TURN server, but so far this has not solved the problem.The Chromium console prints out the following:

PeerJS:  Added ICE candidate for: client1
peer.js:1476 PeerJS:  Set remoteDescription: ANSWER for: client1
peer.js:1476 PeerJS:  Set remoteDescription: OFFER for: client1
peer.js:1476 PeerJS:  Set remoteDescription: ANSWER for: client1
peer.js:1476 PeerJS:  Received remote stream
peer.js:1476 PeerJS:  Receiving stream MediaStream
peer.js:1476 PeerJS:  Created answer.
peer.js:1476 PeerJS:  Set localDescription: answer for: client1
3peer.js:1476 PeerJS:  Received ICE candidates for: client1
3peer.js:1476 PeerJS:  Added ICE candidate for: client1
peer.js:1476 PeerJS:  iceConnectionState is disconnected, closing connections to client1
peer.js:1476 PeerJS:  Cleaning up PeerConnection to client1
2peer.js:1476 PeerJS:  iceConnectionState is disconnected, closing connections to client1

The peer object I'm using looks like that:

var peer = new Peer(
    GetURLParameter('id'),
    { key: peerKey, debug: peerDebug},
    {config:
        { 'iceServers': [
            { url: 'stun:[server ip here]:3478'},
            { url: 'turn:[server ip here]:3478'}
        ]}
    }
);

coturn, upon starting the turnserver with turnserver -L [server ip], prints out the following:

0: Relay address to use: [server ip here]
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 [server ip here] initialization...
0:   relay [server ip here] initialization done
0: Relay ports initialization done
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=0 created
0: IPv4. UDP listener opened on: [server ip here]:3478
0: IPv4. TCP listener opened on : [server ip here]:3478
0: Total UDP servers: 1
0: Total General servers: 1
0: IO method (cli thread): epoll (with changelist)
0: IPv4. CLI listener opened on : 127.0.0.1:5766
0: IO method (auth thread): epoll (with changelist)

And finally since I guess this could be a security issue, my iptables configuration currently looks like that:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:3478
ACCEPT     udp  --  anywhere             anywhere             udp dpt:3478

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:3478
ACCEPT     udp  --  anywhere             anywhere             udp dpt:3478

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:3478
ACCEPT     udp  --  anywhere             anywhere             udp dpt:3478

Anyone got an idea how to get this thing working? Any help would be greatly appreciated!

Aucun commentaire:

Enregistrer un commentaire