I try to build a simple video chat between two peers. This is the structure :
- Web server : Apache. it's in a LAN. The pc (windows 7) has public ip.
- Signal server: In a VM (VirtualBox Centos 6) on the same pc.
- Client A : Laptop, Vista. I use a Samsung mobile and usb tethering to get (external) internet.
- Client B :Laptop, windows 10. I use a Samsung tablet and usb tethering to get (external) internet.
I use Mozilla "45.0.1" and Chrome "49.0.2623.112 m"
I use the code from https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Signaling_and_video_calling for signal server and clients with some changes
- When i use two Firefox clients (https/wss, self-signed certificate) everything is ok.
- When I use one Chrome client in the LAN (localhost or local ip, https/wss) and another Chrome client (https/wss) with "external" internet (usb tethering) everything is ok.
- When I use two Chrome clients withe "external" internet I don't have ICE connection. These are the messages I get in the console
- [1:58:58 PM] Call recipient has accepted our call
- webrtc.js:36 [1:58:58 PM] *** WebRTC signaling state changed to: stable
- webrtc.js:36 [1:58:58 PM] *** ICE connection state changed to checking
- webrtc.js:36 [1:58:58 PM] *** Stream added
- webrtc.js:36 [1:58:58 PM] *******************
- webrtc.js:36 [1:58:58 PM] Message received:
- webrtc.js:91 Object
- webrtc.js:36 [1:58:58 PM] Adding received ICE candidate: {"candidate":"candidate:0 1 UDP 2122187007 ---.---.--.--- 63215 typ host","sdpMid":"audio","sdpMLineIndex":0}
- webrtc.js:36 [1:58:58 PM] Message received:
- webrtc.js:91 Object
- webrtc.js:36 [1:58:58 PM] Adding received ICE candidate: {"candidate":"candidate:4 1 UDP 2122252543 ----:-:----:----:---:----:----:---- 63216 typ host","sdpMid":"audio","sdpMLineIndex":0}
- webrtc.js:36 [1:58:58 PM] Message received:
- webrtc.js:91 Object
- webrtc.js:36 [1:58:58 PM] Adding received ICE candidate: {"candidate":"candidate:1 1 UDP 1685987327 --.--.--.--- 53499 typ srflx raddr -----.---.--.--- rport 63215","sdpMid":"audio","sdpMLineIndex":0} 3webrtc.js:484
- ******* the candidate is successfully passed to the ICE agent
- webrtc.js:36 [1:59:14 PM] *** ICE connection state changed to failed
- webrtc.js:36 [1:59:14 PM] Closing the call
- webrtc.js:36 [1:59:14 PM] --> Closing the peer connection
I use public STUN/TURN server :
var STUN = {
urls: 'stun:stun.l.google.com:19302',
};
var TURN = {
urls: 'turn:64.233.184.127:19305',
credential: ***
username: ***
};
I don't think it's a problem with the code (client or signal server) since it works with Firefox to Firefox and "local Chrome" to "external" Chrome.
EDIT :
Today, I used the code I found from easyRTC.
- Client : ...demos/demo_audio_video_simple.html
- Server : ...server_example/server.js
I had the same results :
- Firefox-Firefox -->OK,
- local Chrome - external Chrome -->OK
- external Chrome - external Chrome --> Failed
I made some small changes to the server for https and port(6503): (note : I've created a port forward 6502->6503)
// Load required modules
var http = require("https"); // http server core module
var express = require("express"); // web framework external module
var io = require("socket.io"); // web socket external module
var easyrtc = require("../"); // EasyRTC external module
var fs = require('fs')
// Setup and configure Express http server. Expect a subfolder called "static" to be the web root.
var httpApp = express();
httpApp.use(express.static(__dirname + "/static/"));
// Start Express http server on port 6503
//var webServer = http.createServer(httpApp).listen(6503);
var options = {
key: fs.readFileSync('key.key'),
cert: fs.readFileSync('cert.crt')
};
// Our HTTP server does nothing but service WebSocket
// connections, so every request just returns 404. Real Web
// requests are handled by the main server on the box. If you
// want to, you can return real HTML here and serve Web content.
var webServer = http.createServer(options, httpApp).listen(6503);
The messages of the server :
debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Room [default] Running func 'connectionRoomObj.emitRoomDataDelta' debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Room [default] Running func 'connectionRoomObj.generateRoomDataDelta' debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] Running func 'onEmitEasyrtcCmd' with msgType [roomData] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [offer] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [offer] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] EasyRTC message received of type [easyrtc_streamReceived] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] Running func 'onEmitEasyrtcMsg' with msgType [easyrtc_streamReceived] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] EasyRTC command received with msgType [answer] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] Running func 'onEmitEasyrtcCmd' with msgType [answer] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] EasyRTC command received with msgType [setUserCfg] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] WebRTC setUserCfg command received. This feature is not yet complete. debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcCmd' with msgType [candidate] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC message received of type [easyrtc_streamReceived] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC command received with msgType [setUserCfg] debug - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] WebRTC setUserCfg command received. This feature is not yet complete. debug - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] Running func 'onEmitEasyrtcMsg' with msgType [easyrtc_streamReceived]
So, I proved that the code is not the problem. Does anyone have any idea?