I'm learning WebRTC. As in tutorial I wrote a code:
var pc = new RTCPeerConnection({'iceServers': [{ 'url': 'stun:stun.l.google.com:19302'}]});
pc.onicecandidate = function (evnt) {
console.log('GOT ICE CANDIDATE');
socket.emit('msg', { by: currentId, to: id, ice: evnt.candidate, type: 'ice' });
iceCandidate = evnt.candidate;
};
pc.onaddstream = function (evnt) {
console.log('Received new stream');
remoteStream = evnt.stream;
};
And onicecandidate fires 21 times. So socket sends message 21 times. I'm confused is it OK that I have 21 iceCandidates and that socket sends message 21 times at this moment? Thank You
Here is log of candidates
GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 0, sdpMid: "audio", candidate: "candidate:3612426851 1 udp 2122260223 10.5.123.27 51569 typ host generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 0, sdpMid: "audio", candidate: "candidate:3612426851 2 udp 2122260223 10.5.123.27 51569 typ host generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 0, sdpMid: "audio", candidate: "candidate:2541423865 1 udp 2122129151 169.254.22.161 51570 typ host generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 0, sdpMid: "audio", candidate: "candidate:2541423865 2 udp 2122129151 169.254.22.161 51570 typ host generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 1, sdpMid: "video", candidate: "candidate:3612426851 1 udp 2122260223 10.5.123.27 51569 typ host generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 1, sdpMid: "video", candidate: "candidate:3612426851 2 udp 2122260223 10.5.123.27 51569 typ host generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 1, sdpMid: "video", candidate: "candidate:2541423865 1 udp 2122129151 169.254.22.161 51570 typ host generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 1, sdpMid: "video", candidate: "candidate:2541423865 2 udp 2122129151 169.254.22.161 51570 typ host generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 0, sdpMid: "audio", candidate: "candidate:2580725395 1 tcp 1518280447 10.5.123.27 0 typ host tcptype active generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 0, sdpMid: "audio", candidate: "candidate:2580725395 2 tcp 1518280447 10.5.123.27 0 typ host tcptype active generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 0, sdpMid: "audio", candidate: "candidate:3656970249 1 tcp 1518149375 169.254.22.161 0 typ host tcptype active generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 0, sdpMid: "audio", candidate: "candidate:3656970249 2 tcp 1518149375 169.254.22.161 0 typ host tcptype active generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 1, sdpMid: "video", candidate: "candidate:2580725395 1 tcp 1518280447 10.5.123.27 0 typ host tcptype active generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 1, sdpMid: "video", candidate: "candidate:2580725395 2 tcp 1518280447 10.5.123.27 0 typ host tcptype active generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 1, sdpMid: "video", candidate: "candidate:3656970249 1 tcp 1518149375 169.254.22.161 0 typ host tcptype active generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 1, sdpMid: "video", candidate: "candidate:3656970249 2 tcp 1518149375 169.254.22.161 0 typ host tcptype active generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 0, sdpMid: "audio", candidate: "candidate:2114899382 1 udp 1686052607 213.230.83.5… srflx raddr 10.5.123.27 rport 51569 generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 0, sdpMid: "audio", candidate: "candidate:2114899382 2 udp 1686052607 213.230.83.5… srflx raddr 10.5.123.27 rport 51569 generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 1, sdpMid: "video", candidate: "candidate:2114899382 1 udp 1686052607 213.230.83.5… srflx raddr 10.5.123.27 rport 51569 generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: RTCIceCandidate {sdpMLineIndex: 1, sdpMid: "video", candidate: "candidate:2114899382 2 udp 1686052607 213.230.83.5… srflx raddr 10.5.123.27 rport 51569 generation 0"}
conversation.client.controller.js:14 GOT ICE CANDIDATE: null
Related
My coturn server always fails on turn. I've tried much variants of config, but nothing works(
Server is not NATted, and have only public IP.
Using next config:
domain=sip.domain.ru
realm=sip.domain.ru
server-name=sip.domain.ru
#listening-ip=0.0.0.0
#external-ip=0.0.0.0
external-ip=213.232.207.000
external-ip=sip.domain.ru
listening-port=3478
min-port=10000
max-port=20000
fingerprint
log-file=/var/log/coturn/turnserver.log
verbose
user=DavidMaze:Password
lt-cred-mech
#allow-loopback-peers
web-admin
web-admin-ip=213.232.207.000
web-admin-port=8090
cert=/usr/share/coturn/server.crt
pkey=/usr/share/coturn/server.key
cipher-list="ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384"
While calling, there is waiting for 60s, then in logs:
0: log file opened: /var/log/coturn/turnserver_2023-01-13.log
0: pid file created: /run/turnserver/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 213.232.207.000 initialization...
0: relay 213.232.207.000 initialization done
0: relay ::1 initialization...
0: relay ::1 initialization done
0: Relay ports initialization done
0: IO method (general relay thread): epoll (with changelist)
0: IO method (general relay thread): epoll (with changelist)
0: IO method (general relay thread): epoll (with changelist)
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: IO method (general relay thread): epoll (with changelist)
0: turn server id=1 created
0: turn server id=3 created
0: turn server id=2 created
0: IPv4. TLS/SCTP listener opened on : 127.0.0.1:3478
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:3478
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:3478
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:3478
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:3478
0: IO method (general relay thread): epoll (with changelist)
0: IPv4. TLS/SCTP listener opened on : 127.0.0.1:5349
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:5349
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:5349
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:5349
0: turn server id=5 created
0: turn server id=4 created
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:5349
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:3478
0: IPv4. TLS/SCTP listener opened on : 213.232.207.000:3478
0: IO method (general relay thread): epoll (with changelist)
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:3478
0: IPv4. TLS/SCTP listener opened on : 213.232.207.000:5349
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:3478
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:5349
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:3478
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:5349
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:3478
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:5349
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:3478
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:5349
0: IPv6. TLS/TCP listener opened on : ::1:3478
0: IPv6. TLS/SCTP listener opened on : ::1:3478
0: turn server id=6 created
0: turn server id=7 created
0: IPv6. TLS/TCP listener opened on : ::1:3478
0: IO method (general relay thread): epoll (with changelist)
0: IPv6. TLS/SCTP listener opened on : ::1:5349
0: IO method (general relay thread): epoll (with changelist)
0: IPv6. TLS/TCP listener opened on : ::1:3478
0: IO method (general relay thread): epoll (with changelist)
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:3478
0: IPv6. TLS/TCP listener opened on : ::1:5349
0: IO method (general relay thread): epoll (with changelist)
0: IO method (general relay thread): epoll (with changelist)
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:5349
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:3478
0: IO method (general relay thread): epoll (with changelist)
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:3478
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:5349
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:5349
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:5349
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:5349
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:3478
0: turn server id=9 created
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:5349
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:3478
0: turn server id=11 created
0: IO method (general relay thread): epoll (with changelist)
0: IPv6. TLS/TCP listener opened on : ::1:5349
0: turn server id=14 created
0: IPv6. TLS/TCP listener opened on : ::1:5349
0: IPv6. TLS/TCP listener opened on : ::1:3478
0: turn server id=13 created
0: IPv6. TLS/TCP listener opened on : ::1:3478
0: IO method (general relay thread): epoll (with changelist)
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:3478
0: turn server id=10 created
0: turn server id=15 created
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:5349
0: IPv6. TLS/TCP listener opened on : ::1:3478
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:3478
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:3478
0: IPv6. TLS/TCP listener opened on : ::1:3478
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:3478
0: turn server id=8 created
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:3478
0: IPv6. TLS/TCP listener opened on : ::1:5349
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:5349
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:3478
0: IPv6. TLS/TCP listener opened on : ::1:5349
0: turn server id=12 created
0: IPv6. TLS/TCP listener opened on : ::1:5349
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:3478
0: IPv4. DTLS/UDP listener opened on: 127.0.0.1:3478
0: IPv6. TLS/TCP listener opened on : ::1:3478
0: IPv6. TLS/TCP listener opened on : ::1:5349
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:5349
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:5349
0: IPv6. TLS/TCP listener opened on : ::1:5349
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:3478
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:5349
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:3478
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:5349
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:5349
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:5349
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:3478
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:3478
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:5349
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:5349
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:5349
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:3478
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:3478
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:3478
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:5349
0: IPv4. TLS/TCP listener opened on : 127.0.0.1:5349
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:3478
0: IPv6. TLS/TCP listener opened on : ::1:3478
0: IPv4. DTLS/UDP listener opened on: 127.0.0.1:5349
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:5349
0: IPv6. TLS/TCP listener opened on : ::1:3478
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:3478
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:5349
0: IPv6. TLS/TCP listener opened on : ::1:3478
0: IPv6. TLS/TCP listener opened on : ::1:5349
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:5349
0: IPv6. TLS/TCP listener opened on : ::1:5349
0: IPv6. TLS/TCP listener opened on : ::1:3478
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:5349
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:3478
0: IPv6. TLS/TCP listener opened on : ::1:3478
0: IPv6. TLS/TCP listener opened on : ::1:3478
0: IPv6. TLS/TCP listener opened on : ::1:5349
0: IPv6. TLS/TCP listener opened on : ::1:5349
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:5349
0: IPv6. TLS/TCP listener opened on : ::1:3478
0: IPv6. TLS/TCP listener opened on : ::1:5349
0: IPv6. TLS/TCP listener opened on : ::1:5349
0: IPv6. TLS/TCP listener opened on : ::1:3478
0: IPv4. DTLS/UDP listener opened on: 213.232.207.000:3478
0: IPv6. TLS/TCP listener opened on : ::1:5349
0: IPv6. TLS/TCP listener opened on : ::1:5349
0: IPv4. DTLS/UDP listener opened on: 213.232.207.000:5349
0: IPv6. DTLS/UDP listener opened on: ::1:3478
0: IPv6. DTLS/UDP listener opened on: ::1:5349
0: Total General servers: 16
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (admin thread): epoll (with changelist)
0: IPv4. TLS/SCTP listener opened on : 213.232.207.000:8090
0: IPv4. TLS/TCP listener opened on : 213.232.207.000:8090
0: IPv4. web-admin listener opened on : 213.232.207.000:8090
0: SQLite DB connection success: /var/lib/turn/turndb
5: handle_udp_packet: New UDP endpoint: local addr 213.232.207.000:3478, remote addr 188.162.5.118:34297
5: session 010000000000000001: realm <sip.domain.ru> user <>: incoming packet BINDING processed, success
5: session 010000000000000001: realm <sip.domain.ru> user <>: incoming packet message processed, error 401: Unauthorized
5: IPv4. Local relay addr: 213.232.207.000:11050
5: session 010000000000000001: new, realm=<sip.domain.ru>, username=<DavidMaze>, lifetime=600
5: session 010000000000000001: realm <sip.domain.ru> user <DavidMaze>: incoming packet ALLOCATE processed, success
6: session 010000000000000001: peer 213.232.207.000 lifetime updated: 300
6: session 010000000000000001: realm <sip.domain.ru> user <DavidMaze>: incoming packet CREATE_PERMISSION processed, success
7: handle_udp_packet: New UDP endpoint: local addr 213.232.207.000:3478, remote addr 87.103.193.000:56186
7: session 006000000000000001: realm <sip.domain.ru> user <>: incoming packet BINDING processed, success
7: session 006000000000000001: realm <sip.domain.ru> user <>: incoming packet message processed, error 401: Unauthorized
7: IPv4. Local relay addr: 213.232.207.000:16236
7: session 006000000000000001: new, realm=<sip.domain.ru>, username=<DavidMaze>, lifetime=600
7: session 006000000000000001: realm <sip.domain.ru> user <DavidMaze>: incoming packet ALLOCATE processed, success
7: session 006000000000000001: peer 213.232.207.000 lifetime updated: 300
7: session 006000000000000001: realm <sip.domain.ru> user <DavidMaze>: incoming packet CREATE_PERMISSION processed, success
15: session 010000000000000001: realm <sip.domain.ru> user <DavidMaze>: incoming packet BINDING processed, success
17: session 006000000000000001: realm <sip.domain.ru> user <DavidMaze>: incoming packet BINDING processed, success
26: session 010000000000000001: realm <sip.domain.ru> user <DavidMaze>: incoming packet BINDING processed, success
27: session 006000000000000001: realm <sip.domain.ru> user <DavidMaze>: incoming packet BINDING processed, success
36: session 010000000000000001: realm <sip.domain.ru> user <DavidMaze>: incoming packet BINDING processed, success
38: session 006000000000000001: realm <sip.domain.ru> user <DavidMaze>: incoming packet BINDING processed, success
46: session 010000000000000001: realm <sip.domain.ru> user <DavidMaze>: incoming packet BINDING processed, success
47: handle_udp_packet: New UDP endpoint: local addr 213.232.207.000:3478, remote addr 188.162.5.118:23038
47: session 008000000000000001: realm <sip.domain.ru> user <>: incoming packet BINDING processed, success
48: session 008000000000000001: realm <sip.domain.ru> user <>: incoming packet message processed, error 401: Unauthorized
48: IPv4. Local relay addr: 213.232.207.000:16208
48: session 008000000000000001: new, realm=<sip.domain.ru>, username=<DavidMaze>, lifetime=600
48: session 008000000000000001: realm <sip.domain.ru> user <DavidMaze>: incoming packet ALLOCATE processed, success
48: session 006000000000000001: realm <sip.domain.ru> user <DavidMaze>: incoming packet BINDING processed, success
48: session 008000000000000001: peer 213.232.207.000 lifetime updated: 300
48: session 008000000000000001: realm <sip.domain.ru> user <DavidMaze>: incoming packet CREATE_PERMISSION processed, success
50: session 010000000000000001: refreshed, realm=<sip.domain.ru>, username=<DavidMaze>, lifetime=0
50: session 010000000000000001: realm <sip.domain.ru> user <DavidMaze>: incoming packet REFRESH processed, success
50: session 008000000000000001: refreshed, realm=<sip.domain.ru>, username=<DavidMaze>, lifetime=0
50: session 008000000000000001: realm <sip.domain.ru> user <DavidMaze>: incoming packet REFRESH processed, success
50: session 006000000000000001: refreshed, realm=<sip.domain.ru>, username=<DavidMaze>, lifetime=0
50: session 006000000000000001: realm <sip.domain.ru> user <DavidMaze>: incoming packet REFRESH processed, success
51: session 008000000000000001: usage: realm=<sip.domain.ru>, username=<DavidMaze>, rp=5, rb=364, sp=5, sb=508
51: session 008000000000000001: closed (2nd stage), user <DavidMaze> realm <sip.domain.ru> origin <>, local 213.232.207.000:3478, remote 188.162.5.118:23038, reason: allocation timeout
51: session 008000000000000001: delete: realm=<sip.domain.ru>, username=<DavidMaze>
51: session 008000000000000001: peer 213.232.207.000 deleted
51: session 010000000000000001: usage: realm=<sip.domain.ru>, username=<DavidMaze>, rp=10, rb=592, sp=10, sb=1032
51: session 010000000000000001: closed (2nd stage), user <DavidMaze> realm <sip.domain.ru> origin <>, local 213.232.207.000:3478, remote 188.162.5.118:34297, reason: allocation timeout
51: session 010000000000000001: delete: realm=<sip.domain.ru>, username=<DavidMaze>
51: session 010000000000000001: peer 213.232.207.000 deleted
51: session 006000000000000001: usage: realm=<sip.domain.ru>, username=<DavidMaze>, rp=58, rb=7500, sp=9, sb=892
51: session 006000000000000001: closed (2nd stage), user <DavidMaze> realm <sip.domain.ru> origin <>, local 213.232.207.000:3478, remote 87.103.193.000:56186, reason: allocation timeout
51: session 006000000000000001: delete: realm=<sip.domain.ru>, username=<DavidMaze>
51: session 006000000000000001: peer 213.232.207.000 deleted
Also, 2 days ago i was having 403: forbidden IP. But it was fixed by commenting listening-ip
Fixed issue. For others:
At first, check issue on different browsers. I've detected, that call works on Mozilla Firefox, while don't work on Chromium-based browsers;
You can enable extra-verbose mode by -V flag (uppercase) or --Verbose. This can help, but logs are very annoying and no need to see them in 95% times;
While testing TURN-server via very popular tool WebRTC sample - Trickle ICE, you can see authentication failed? with relay in next line. This might not be problem, check this with other working TURN-server (example)
Check client's firewall for blocking ports of STUN/TURN servers, for port ranges of TURN. That was my case, client's firewall was blocking 24000-64000 ports.
We setup CoTurn on a cloud VM. Then we test it with our WebRTC demo website. We find that it can't relay streams, which means the two sides of the WebRTC demo can't connect to each other when they are in different subnet.
The following things has been done according to the investigation:
We are using CoTurn 4.5.1.1 on Ubuntu 20.04. CoTurn is installed by apt-get.
The realm is set in turnserver.conf and the account which created by turnadmin is bound with the realm.
Inbound UDP ports 1 ~ 65535 are opened in cloud VM. We use netcat to listen to udp:50000 in the VM and send some data on the PC at home, the data can be received.
The WebRTC demo website works when both of the sides reside in the same subnet.
This is the turnserver.conf:
listening-device=eth0
listening-port=3478
tls-listening-port=5349
listening-ip=172.16.9.209
relay-ip=172.16.9.209
external-ip=8.136.83.163
server-name=turn.locationbackbone.top
realm=turn.locationbackbone.top
log-file=/var/log/turn.log
cert=/etc/turn_server_cert.pem
pkey=/etc/turn_server_pkey.pem
fingerprint
lt-cred-mech
user=Jim:Jim
verbose
This is the setup of the WebRTC demo:
const peerConnection = new RTCPeerConnection({
iceServers: [{
urls: 'turn:turn.locationbackbone.top:3478',
username: 'Jim',
credential: 'Jim'
}]
});
This is the log from CoTurn:
18: handle_udp_packet: New UDP endpoint: local addr 172.16.9.209:3478, remote addr 58.39.2.24:22246
18: session 000000000000000001: realm <turn.locationbackbone.top> user <>: incoming packet BINDING processed, success
18: session 000000000000000001: realm <turn.locationbackbone.top> user <>: incoming packet message processed, error 401: Unauthorized
18: handle_udp_packet: New UDP endpoint: local addr 172.16.9.209:3478, remote addr 58.39.2.24:22247
18: session 000000000000000002: realm <turn.locationbackbone.top> user <>: incoming packet BINDING processed, success
18: session 000000000000000002: realm <turn.locationbackbone.top> user <>: incoming packet message processed, error 401: Unauthorized
18: IPv4. Local relay addr: 172.16.9.209:58189
18: session 000000000000000002: new, realm=<turn.locationbackbone.top>, username=<Jim>, lifetime=600
18: session 000000000000000002: realm <turn.locationbackbone.top> user <Jim>: incoming packet ALLOCATE processed, success
18: IPv4. Local relay addr: 172.16.9.209:53152
18: session 000000000000000001: new, realm=<turn.locationbackbone.top>, username=<Jim>, lifetime=600
18: session 000000000000000001: realm <turn.locationbackbone.top> user <Jim>: incoming packet ALLOCATE processed, success
19: session 000000000000000001: refreshed, realm=<turn.locationbackbone.top>, username=<Jim>, lifetime=0
19: session 000000000000000001: realm <turn.locationbackbone.top> user <Jim>: incoming packet REFRESH processed, success
19: handle_udp_packet: New UDP endpoint: local addr 172.16.9.209:3478, remote addr 182.139.173.74:49318
19: session 000000000000000003: realm <turn.locationbackbone.top> user <>: incoming packet BINDING processed, success
19: session 000000000000000003: realm <turn.locationbackbone.top> user <>: incoming packet message processed, error 401: Unauthorized
19: IPv4. Local relay addr: 172.16.9.209:64834
19: session 000000000000000003: new, realm=<turn.locationbackbone.top>, username=<Jim>, lifetime=600
19: session 000000000000000003: realm <turn.locationbackbone.top> user <Jim>: incoming packet ALLOCATE processed, success
19: session 000000000000000002: peer 182.139.173.74 lifetime updated: 300
19: session 000000000000000002: realm <turn.locationbackbone.top> user <Jim>: incoming packet CREATE_PERMISSION processed, success
19: session 000000000000000002: peer 172.16.9.209 lifetime updated: 300
19: session 000000000000000002: realm <turn.locationbackbone.top> user <Jim>: incoming packet CREATE_PERMISSION processed, success
20: session 000000000000000001: usage: realm=<turn.locationbackbone.top>, username=<Jim>, rp=4, rb=272, sp=4, sb=436
20: session 000000000000000001: closed (2nd stage), user <Jim> realm <turn.locationbackbone.top> origin <>, local 172.16.9.209:3478, remote 58.39.2.24:22246, reason: allocation timeout
20: session 000000000000000001: delete: realm=<turn.locationbackbone.top>, username=<Jim>
This is the 'ICE candidate grid' from chrome://webrtc-internals:
RTCIceCandidatePair_pNDACBB9_Rh5SDnOq in-progress wifi udp 0x27c1eff04fe3e00 0 / 0 31 / 0 0 / 0 11:21:10 AM
RTCIceCandidate_pNDACBB9 local-candidate 8.136.83.163 58189 relay(udp) 0x27c1eff
RTCIceCandidate_Rh5SDnOq remote-candidate 8.136.83.163 64834 relay 0x27f1eff
We use tshark to capture the traffic of the server.
58.39.2.24 172.16.9.209 25230 3478 STUN Binding Request
58.39.2.24 172.16.9.209 25231 3478 STUN Binding Request
172.16.9.209 58.39.2.24 3478 25230 STUN Binding Success Response XOR-MAPPED-ADDRESS: 58.39.2.24:25230 MAPPED-ADDRESS: 58.39.2.24:25230 RESPONSE-ORIGIN: 8.136.83.163:3478
172.16.9.209 58.39.2.24 3478 25231 STUN Binding Success Response XOR-MAPPED-ADDRESS: 58.39.2.24:25231 MAPPED-ADDRESS: 58.39.2.24:25231 RESPONSE-ORIGIN: 8.136.83.163:3478
58.39.2.24 172.16.9.209 25231 3478 STUN Allocate Request UDP
172.16.9.209 58.39.2.24 3478 25231 STUN Allocate Error Response error-code: 401 (Unauthorized) Unauthorized with nonce realm: turn.locationbackbone.top
58.39.2.24 172.16.9.209 25230 3478 STUN Allocate Request UDP
172.16.9.209 58.39.2.24 3478 25230 STUN Allocate Error Response error-code: 401 (Unauthorized) Unauthorized with nonce realm: turn.locationbackbone.top
58.39.2.24 172.16.9.209 25231 3478 STUN Allocate Request UDP user: Jim realm: turn.locationbackbone.top with nonce
172.16.9.209 58.39.2.24 3478 25231 STUN Allocate Success Response XOR-RELAYED-ADDRESS: 8.136.83.163:63533 XOR-MAPPED-ADDRESS: 58.39.2.24:25231 lifetime: 600
58.39.2.24 172.16.9.209 25230 3478 STUN Allocate Request UDP user: Jim realm: turn.locationbackbone.top with nonce
172.16.9.209 58.39.2.24 3478 25230 STUN Allocate Success Response XOR-RELAYED-ADDRESS: 8.136.83.163:55677 XOR-MAPPED-ADDRESS: 58.39.2.24:25230 lifetime: 600
222.211.167.109 172.16.9.209 55666 3478 STUN Binding Request
172.16.9.209 222.211.167.109 3478 55666 STUN Binding Success Response XOR-MAPPED-ADDRESS: 222.211.167.109:55666 MAPPED-ADDRESS: 222.211.167.109:55666 RESPONSE-ORIGIN: 8.136.83.163:3478
58.39.2.24 172.16.9.209 25231 3478 STUN Refresh Request lifetime: 0 user: Jim realm: turn.locationbackbone.top with nonce
172.16.9.209 58.39.2.24 3478 25231 STUN Refresh Success Response lifetime: 0
58.39.2.24 172.16.9.209 25230 3478 STUN CreatePermission Request XOR-PEER-ADDRESS: 192.168.1.128:55666 user: Jim realm: turn.locationbackbone.top with nonce
172.16.9.209 58.39.2.24 3478 25230 STUN CreatePermission Success Response
222.211.167.109 172.16.9.209 55666 3478 STUN Allocate Request UDP
172.16.9.209 222.211.167.109 3478 55666 STUN Allocate Error Response error-code: 401 (Unauthorized) Unauthorized with nonce realm: turn.locationbackbone.top
58.39.2.24 172.16.9.209 25230 3478 STUN CreatePermission Request XOR-PEER-ADDRESS: 222.211.167.109:55666 user: Jim realm: turn.locationbackbone.top with nonce
172.16.9.209 58.39.2.24 3478 25230 STUN CreatePermission Success Response
222.211.167.109 172.16.9.209 55666 3478 STUN Allocate Request UDP user: Jim realm: turn.locationbackbone.top with nonce
172.16.9.209 222.211.167.109 3478 55666 STUN Allocate Success Response XOR-RELAYED-ADDRESS: 8.136.83.163:64761 XOR-MAPPED-ADDRESS: 222.211.167.109:55666 lifetime: 600
58.39.2.24 172.16.9.209 25230 3478 STUN CreatePermission Request XOR-PEER-ADDRESS: 8.136.83.163:64761 user: Jim realm: turn.locationbackbone.top with nonce
172.16.9.209 58.39.2.24 3478 25230 STUN CreatePermission Success Response
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 3478 STUN Binding Request
172.16.9.209 58.39.2.24 3478 25230 STUN Binding Success Response XOR-MAPPED-ADDRESS: 58.39.2.24:25230 MAPPED-ADDRESS: 58.39.2.24:25230 RESPONSE-ORIGIN: 8.136.83.163:3478
58.39.2.24 172.16.9.209 25230 64761 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 192.168.1.128:55666
172.16.9.209 192.168.1.128 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 222.211.167.109:55666
172.16.9.209 222.211.167.109 55677 55666 STUN Binding Request user: l3iy:poWX
58.39.2.24 172.16.9.209 25230 3478 STUN Send Indication XOR-PEER-ADDRESS: 8.136.83.163:64761
58.39.2.24 172.16.9.209 25230 3478 STUN Refresh Request lifetime: 0 user: Jim realm: turn.locationbackbone.top with nonce
172.16.9.209 58.39.2.24 3478 25230 STUN Refresh Success Response lifetime: 0
222.211.167.109 172.16.9.209 55666 3478 STUN Refresh Request lifetime: 0 user: Jim realm: turn.locationbackbone.top with nonce
172.16.9.209 222.211.167.109 3478 55666 STUN Refresh Success Response lifetime: 0
We notice that the callee can only receive the following message: coturn:3478 -> callee STUN, since port 3478 is the only port to which the callee has ever sent packets. The packets sent by the other ports of the coturn server are lost. We suspect the NAT is a type of port restricted cone or even symmetrical.
How can we enable the relay?
There are 2 clients (A from 58.39.2.24:25230 and B from 222.211.167.109:55666). Both successfully get an allocation (8.136.83.163:55677 & 8.136.83.163:64761, respectively).
Client A then creates 3 permissions, one for 192.168.1.128:55666 (private, probably unusable), one for 222.211.167.109:55666 (direct), and one for 8.136.83.163:64761 (relay)).
Then client A starts sending STUN binding requests towards the 3 targets. The ones destined to 222.211.167.109:55666 never get an answer, so it must be unreachable from coturn.
Client B should create a Permission for 8.136.83.163:55677, so that coturn will allow the STUN Binding Requests from A to be delivered, achieving a relay-to-relay connection: A <--> coturn <--> coturn <--> B.
we have ingress-nginx running for a while and about 10% of requests ending up with some SSL handshake problem.
Here is an example of a failing connection:
2019/02/14 10:15:35 [debug] 237#237: *4612 accept: **.**.**.**:40928 fd:53
2019/02/14 10:15:35 [debug] 237#237: *4612 event timer add: 53: 60000:5527050245
2019/02/14 10:15:35 [debug] 237#237: *4612 reusable connection: 1
2019/02/14 10:15:35 [debug] 237#237: *4612 epoll add event: fd:53 op:1 ev:80002001
2019/02/14 10:15:45 [debug] 237#237: *4612 http check ssl handshake
2019/02/14 10:15:45 [debug] 237#237: *4612 http recv(): 0
2019/02/14 10:15:45 [info] 237#237: *4612 client closed connection while SSL handshaking, client: **.**.**.**, server: 0.0.0.0:443
2019/02/14 10:15:45 [debug] 237#237: *4612 close http connection: 53
2019/02/14 10:15:45 [debug] 237#237: *4612 event timer del: 53: 5527050245
2019/02/14 10:15:45 [debug] 237#237: *4612 reusable connection: 0
2019/02/14 10:15:45 [debug] 237#237: *4612 free: 00007F4CC5858E00, unused: 232
10% of failures seems to be quite a lot to expect.
I really would appreciate any help in this!
I want to transfer the call from one AGI controlled context to another endpoint.
That is. I have a cisco gateway initiated call given to my asterisk configuration which handles some tree logic with AGI and eventually transfers the call to another endpoint (vbox)
cisco(62.15.164.62)->
asterisk(62.12.240.121)-> do some AGI then transfer to vbox
vbox(62.15.164.65)
The problem is when the transfer happens. Somehow the TRYING and OK SIP packets from vbox are ignored by asterisk as they are not shown in the CLI but are clearly received watching the udp tcpdump. And eventually after my asterisk re-issues the invite packets the call gets dropped as if no trying/ok was received when in fact it was sent and received at the interface level.
Asterisk version 15.5.0
pjsip.conf
[t-udp-m]
type=transport
protocol=udp
bind=62.12.240.121:5060
[gw1]
type=endpoint
transport=t-udp-m
context=civr
disallow=all
allow=ulaw,speex,gsm
aors=gw1
[gw1]
type=identify
endpoint=gw1
match=62.15.164.62
[gw1]
type=aor
max_contacts=2
remove_existing=yes
[vbox]
type=endpoint
transport=t-udp-m
context=civr
disallow=all
allow=ulaw,alaw,gsm,speex
aors=vbox
send_rpid=yes
[vbox]
type=identify
endpoint=vbox
match=62.15.164.65
[vbox]
type=aor
contact=sip:7011#62.15.164.65:5060
max_contacts=1
remove_existing=yes
extensions.conf
[civr]
exten => 7010,1,Answer()
same => n,Agi(/var/www/agi-bin/agi.php)
same => n,Hangup()
[call_center_altitude]
exten => 1,1,Dial(PJSIP/vbox)
same => n,Hangup()
tcpdump
IP 62.15.164.62.61396 > 62.12.240.121.sip: UDP, length 1159
INVITE sip:7010#62.12.240.121:5060 SIP/2.0
Via: SIP/2.0/UDP 62.15.164.62:5060;branch=z9hG4bK4CB8B17BE
From: <sip:0971110799#62.15.164.62>;tag=BD15CD5C-FC6
To: <sip:7010#62.12.240.121>
Date: Tue, 23 Oct 2018 02:00:59 GMT
Call-ID: 524DB3FB-D59E11E8-AAA1E790-46F000BF#62.15.164.62
Supported: 100rel,timer,replaces
Min-SE: 1800
Cisco-Guid: 1380744107-3583906280-2679701539-3944536960
User-Agent: Cisco-SIPGateway/IOS-12.x
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, NOTIFY, INFO, UPDATE, REGISTER
CSeq: 101 INVITE
Max-Forwards: 70
Remote-Party-ID: <sip:0971110799#62.15.164.62>;party=calling;screen=yes;privacy=off
Timestamp: 1540260059
Contact: <sip:0971110799#62.15.164.62:5060>
Call-Info: <sip:62.15.164.62:5060>;method="NOTIFY;Event=telephone-event;Duration=2000"
Expires: 180
Allow-Events: telephone-event
Content-Type: application/sdp
Content-Length: 247
v=0
o=CiscoSystemsSIP-GW-UserAgent 1066 6200 IN IP4 62.15.164.62
s=SIP Call
c=IN IP4 62.15.164.62
t=0 0
m=audio 16658 RTP/AVP 0 101
c=IN IP4 62.15.164.62
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
IP 62.12.240.121.sip > 62.15.164.62.61396: UDP, length 326
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 62.15.164.62:5060;rport=61396;received=62.15.164.62;branch=z9hG4bK4CB8B17BE
Call-ID: 524DB3FB-D59E11E8-AAA1E790-46F000BF#62.15.164.62
From: <sip:0971110799#62.15.164.62>;tag=BD15CD5C-FC6
To: <sip:7010#62.12.240.121>
CSeq: 101 INVITE
Server: Asterisk PBX 15.5.0
Content-Length: 0
IP 62.12.240.121.sip > 62.15.164.62.61396: UDP, length 818
SIP/2.0 200 OK
Via: SIP/2.0/UDP 62.15.164.62:5060;rport=61396;received=62.15.164.62;branch=z9hG4bK4CB8B17BE
Call-ID: 524DB3FB-D59E11E8-AAA1E790-46F000BF#62.15.164.62
From: <sip:0971110799#62.15.164.62>;tag=BD15CD5C-FC6
To: <sip:7010#62.12.240.121>;tag=3780211b-39df-482f-8b48-b0ca039a65b2
CSeq: 101 INVITE
Server: Asterisk PBX 15.5.0
Contact: <sip:62.12.240.121:5060>
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Content-Type: application/sdp
Content-Length: 227
v=0
o=- 1066 6202 IN IP4 62.12.240.121
s=Asterisk
c=IN IP4 62.12.240.121
t=0 0
m=audio 26188 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv
IP 62.15.164.62.61396 > 62.12.240.121.sip: UDP, length 371
ACK sip:62.12.240.121:5060 SIP/2.0
Via: SIP/2.0/UDP 62.15.164.62:5060;branch=z9hG4bK4CB8CF50
From: <sip:0971110799#62.15.164.62>;tag=BD15CD5C-FC6
To: <sip:7010#62.12.240.121>;tag=3780211b-39df-482f-8b48-b0ca039a65b2
Date: Tue, 23 Oct 2018 02:00:59 GMT
Call-ID: 524DB3FB-D59E11E8-AAA1E790-46F000BF#62.15.164.62
Max-Forwards: 70
CSeq: 101 ACK
Content-Length: 0
!!!! The problem starts here.....
IP 62.12.240.121.sip > 62.15.164.65.sip: UDP, length 1068
INVITE sip:7011#62.15.164.65:5060 SIP/2.0
Via: SIP/2.0/UDP 62.12.240.121:5060;rport;branch=z9hG4bKPj702bedc6-b346-44b2-8cc1-bbdffcb75a89
From: <sip:00008577751000971110799#62.12.240.121>;tag=b2e6cd02-127c-42ca-a51a-f98cb26329aa
To: <sip:7011#62.15.164.65>
Contact: <sip:asterisk#62.12.240.121:5060>
Call-ID: 6de2b47c-8264-452a-9656-d7d4ed6b731f
CSeq: 11604 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Remote-Party-ID: <sip:00008577751000971110799#62.12.240.121>;privacy=off;screen=no
Max-Forwards: 70
User-Agent: Asterisk PBX 15.5.0
Content-Type: application/sdp
Content-Length: 312
v=0
o=- 272899537 272899537 IN IP4 62.12.240.121
s=Asterisk
c=IN IP4 62.12.240.121
t=0 0
m=audio 21388 RTP/AVP 0 8 3 110 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:110 speex/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:60
a=sendrecv
IP 62.15.164.65.sip > 62.12.240.121.58140: UDP, length 564
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 62.12.240.121:5060;branch=z9hG4bKPj702bedc6-b346-44b2-8cc1-bbdffcb75a89;received=62.12.240.121;rport=58140
From: <sip:00008577751000971110799#62.12.240.121>;tag=b2e6cd02-127c-42ca-a51a-f98cb26329aa
To: <sip:7011#62.15.164.65>
Call-ID: 6de2b47c-8264-452a-9656-d7d4ed6b731f
CSeq: 11604 INVITE
Server: Altitude vBox
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
Contact: <sip:7011#62.15.164.65:5060>
Content-Length: 0
IP 62.15.164.65.sip > 62.12.240.121.58140: UDP, length 859
SIP/2.0 200 OK
Via: SIP/2.0/UDP 62.12.240.121:5060;branch=z9hG4bKPj702bedc6-b346-44b2-8cc1-bbdffcb75a89;received=62.12.240.121;rport=58140
From: <sip:00008577751000971110799#62.12.240.121>;tag=b2e6cd02-127c-42ca-a51a-f98cb26329aa
To: <sip:7011#62.15.164.65>;tag=as1dce0520
Call-ID: 6de2b47c-8264-452a-9656-d7d4ed6b731f
CSeq: 11604 INVITE
Server: Altitude vBox
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
Contact: <sip:7011#62.15.164.65:5060>
Content-Type: application/sdp
Content-Length: 251
v=0
o=root 140358089 140358089 IN IP4 62.15.164.65
s=Altitude vBox
c=IN IP4 62.15.164.65
t=0 0
m=audio 25364 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
!!!! As you can see, the last 2 packets were ignored by my asterisk configuration and so it re-issued the INVITE packets...
IP 62.12.240.121.sip > 62.15.164.65.sip: UDP, length 1068
INVITE sip:7011#62.15.164.65:5060 SIP/2.0
Via: SIP/2.0/UDP 62.12.240.121:5060;rport;branch=z9hG4bKPj702bedc6-b346-44b2-8cc1-bbdffcb75a89
From: <sip:00008577751000971110799#62.12.240.121>;tag=b2e6cd02-127c-42ca-a51a-f98cb26329aa
To: <sip:7011#62.15.164.65>
Contact: <sip:asterisk#62.12.240.121:5060>
Call-ID: 6de2b47c-8264-452a-9656-d7d4ed6b731f
CSeq: 11604 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Remote-Party-ID: <sip:00008577751000971110799#62.12.240.121>;privacy=off;screen=no
Max-Forwards: 70
User-Agent: Asterisk PBX 15.5.0
Content-Type: application/sdp
Content-Length: 312
v=0
o=- 272899537 272899537 IN IP4 62.12.240.121
s=Asterisk
c=IN IP4 62.12.240.121
t=0 0
m=audio 21388 RTP/AVP 0 8 3 110 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:110 speex/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:60
a=sendrecv
Which eventually led to a dropped call.
CLI Output
<--- Received SIP request (1159 bytes) from UDP:62.15.164.62:61396 --->
<INVITE data same as in tcpdump>
== Setting global variable 'SIPDOMAIN' to '62.12.240.121'
<--- Transmitting SIP response (326 bytes) to UDP:62.15.164.62:61396 --->
<TRYING data same as in tcpdump>
-- Executing [7010#civr:1] Answer("PJSIP/gw1-00000022", "") in new stack
> 0x7f707c019640 -- Strict RTP learning after remote address set to: 62.15.164.62:16658
<--- Transmitting SIP response (818 bytes) to UDP:62.15.164.62:61396 --->
<OK data same as in tcpdump>
<--- Received SIP request (371 bytes) from UDP:62.15.164.62:61396 --->
<ACK data same as in tcpdump>
> 0x7f707c019640 -- Strict RTP switching to RTP target address 62.15.164.62:16658 as source
-- Executing [7010#civr:8] AGI("PJSIP/gw1-00000022", "/var/www/agi-bin/agi.php") in new stack
-- Launched AGI Script /var/www/agi-bin/agi.php
<PJSIP/gw1-00000022>AGI Tx >> agi_request: /var/www/agi-bin/agi.php
<PJSIP/gw1-00000022>AGI Tx >> agi_channel: PJSIP/gw1-00000022
<PJSIP/gw1-00000022>AGI Tx >> agi_language: en
<PJSIP/gw1-00000022>AGI Tx >> agi_type: PJSIP
<PJSIP/gw1-00000022>AGI Tx >> agi_uniqueid: 1540257639.63
<PJSIP/gw1-00000022>AGI Tx >> agi_version: 15.5.0
<PJSIP/gw1-00000022>AGI Tx >> agi_callerid: 0971110799
<PJSIP/gw1-00000022>AGI Tx >> agi_calleridname: unknown
<PJSIP/gw1-00000022>AGI Tx >> agi_callingpres: 0
<PJSIP/gw1-00000022>AGI Tx >> agi_callingani2: 0
<PJSIP/gw1-00000022>AGI Tx >> agi_callington: 0
<PJSIP/gw1-00000022>AGI Tx >> agi_callingtns: 0
<PJSIP/gw1-00000022>AGI Tx >> agi_dnid: 7010
<PJSIP/gw1-00000022>AGI Tx >> agi_rdnis: unknown
<PJSIP/gw1-00000022>AGI Tx >> agi_context: civr
<PJSIP/gw1-00000022>AGI Tx >> agi_extension: 7010
<PJSIP/gw1-00000022>AGI Tx >> agi_priority: 8
<PJSIP/gw1-00000022>AGI Tx >> agi_enhanced: 0.0
<PJSIP/gw1-00000022>AGI Tx >> agi_accountcode:
<PJSIP/gw1-00000022>AGI Tx >> agi_threadid: 140122966906624
<PJSIP/gw1-00000022>AGI Tx >>
<PJSIP/gw1-00000022>AGI Rx << STREAM FILE /tmp/fest-yVABhE ""
-- <PJSIP/gw1-00000022> Playing '/tmp/fest-yVABhE.slin' (escape_digits=) (sample_offset 0) (language 'en')
> 0x7f707c019640 -- Strict RTP learning complete - Locking on source address 62.15.164.62:16658
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0 endpos=47554
<PJSIP/gw1-00000022>AGI Rx << STREAM FILE /tmp/fest-9pPsxq "1234"
-- <PJSIP/gw1-00000022> Playing '/tmp/fest-9pPsxq.slin' (escape_digits=1234) (sample_offset 0) (language 'en')
<PJSIP/gw1-00000022>AGI Tx >> 200 result=50 endpos=21920
<PJSIP/gw1-00000022>AGI Rx << STREAM FILE /tmp/fest-zztyOj "12"
-- <PJSIP/gw1-00000022> Playing '/tmp/fest-zztyOj.slin' (escape_digits=12) (sample_offset 0) (language 'en')
<PJSIP/gw1-00000022>AGI Tx >> 200 result=49 endpos=12320
<PJSIP/gw1-00000022>AGI Rx << STREAM FILE /tmp/fest-FyUq0g "#*0123456789"
-- <PJSIP/gw1-00000022> Playing '/tmp/fest-FyUq0g.slin' (escape_digits=#*0123456789) (sample_offset 0) (language 'en')
<PJSIP/gw1-00000022>AGI Tx >> 200 result=56 endpos=13440
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=53
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=55
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=55
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=55
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=53
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0
<PJSIP/gw1-00000022>AGI Rx << SET CONTEXT call_center_altitude
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0
<PJSIP/gw1-00000022>AGI Rx << SET CALLERID 00008577751000971110799
<PJSIP/gw1-00000022>AGI Tx >> 200 result=1
<PJSIP/gw1-00000022>AGI Rx << SET EXTENSION 1
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0
<PJSIP/gw1-00000022>AGI Rx << SET PRIORITY 1
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0
<PJSIP/gw1-00000022>AGI Rx << STREAM FILE /tmp/fest-e3ELZu ""
-- <PJSIP/gw1-00000022> Playing '/tmp/fest-e3ELZu.slin' (escape_digits=) (sample_offset 0) (language 'en')
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0 endpos=34697
-- <PJSIP/gw1-00000022>AGI Script /var/www/agi-bin/agi.php completed, returning 0
-- Executing [1#call_center_altitude:1] Dial("PJSIP/gw1-00000022", "PJSIP/vbox") in new stack
-- Called PJSIP/vbox
<--- Transmitting SIP request (1068 bytes) to UDP:62.15.164.65:5060 --->
<INVITE same as in tcpdump>
!!! TRYING and OK SIP packets does not show in the CLI as shown in the tcpdump!!!
There may be something in my asterisk vbox endpoint configuration that I am having wrong.
tcpdump command is tcpdump -nqt -s 0 -A -i eth0 port 5060 where eth0 is the asterisk not receiving the trying/ack on the CLI 62.12.240.121
My... I'll pay you if you can help me here.
I was reading wrong the tcpdump log. It shows that there is NAT going on.
IP 62.12.240.121.sip > 62.15.164.65.sip: UDP, length 1068
IP 62.15.164.65.sip > 62.12.240.121.58140: UDP, length 564
So my asterisk configuration received the SIP packet on port 58140 instead of 5060
I have camera that supports Onvif. Calling OnVif SOAP GetDeviceInformation
<s:Envelope
xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Body
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetDeviceInformation
xmlns="http://www.onvif.org/ver10/device/wsdl"/>
</s:Body>
</s:Envelope>
I get an answer when using SoapUI. I created simple WCF console app to call the same method - no answer from camera.
I checked with wireshart the messages sent:
SoapUI:
Frame 8858: 680 bytes on wire (5440 bits), 680 bytes captured (5440 bits) on interface 0
Ethernet II, Src: IntelCor_fc:da:96 (b4:b6:76:fc:da:96), Dst: Shenzhen_a4:9f:e8 (e8:ab:fa:a4:9f:e8)
Internet Protocol Version 4, Src: 10.0.0.8, Dst: 10.0.0.102
Transmission Control Protocol, Src Port: 61385, Dst Port: 888, Seq: 1, Ack: 1, Len: 626
Hypertext Transfer Protocol
POST /onvif/device_service HTTP/1.1\r\n
Accept-Encoding: gzip,deflate\r\n
Content-Type: application/soap+xml;charset=UTF-8;action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation"\r\n
Content-Length: 322\r\n
[Content length: 322]
Host: 10.0.0.102:888\r\n
Connection: Keep-Alive\r\n
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)\r\n
\r\n
[Full request URI: http://10.0.0.102:888/onvif/device_service]
[HTTP request 1/1]
[Response in frame: 8891]
File Data: 322 bytes
eXtensible Markup Language
<s:Envelope
xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Body
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetDeviceInformation
xmlns="http://www.onvif.org/ver10/device/wsdl"/>
</s:Body>
</s:Envelope>
WCF Client:
Frame 11631: 315 bytes on wire (2520 bits), 315 bytes captured (2520 bits) on interface 0
Ethernet II, Src: IntelCor_fc:da:96 (b4:b6:76:fc:da:96), Dst: Shenzhen_a4:9f:e8 (e8:ab:fa:a4:9f:e8)
Internet Protocol Version 4, Src: 10.0.0.8, Dst: 10.0.0.102
Transmission Control Protocol, Src Port: 61420, Dst Port: 888, Seq: 282, Ack: 1, Len: 261
[2 Reassembled TCP Segments (542 bytes): #11629(281), #11631(261)]
Hypertext Transfer Protocol
POST /onvif/device_service HTTP/1.1\r\n
Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation"\r\n
Host: 10.0.0.102:888\r\n
Content-Length: 261\r\n
[Content length: 261]
Expect: 100-continue\r\n
Accept-Encoding: gzip, deflate\r\n
Connection: Keep-Alive\r\n
\r\n
[Full request URI: http://10.0.0.102:888/onvif/device_service]
[HTTP request 1/1]
File Data: 261 bytes
eXtensible Markup Language
<s:Envelope
xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Body
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetDeviceInformation
xmlns="http://www.onvif.org/ver10/device/wsdl"/>
</s:Body>
</s:Envelope>
Bellow WCF code after WSDL Onvif WSDL reference was added to project:
namespace OnVifInfo
{
class Program
{
static void Main(string[] args)
{
GetDeviceInfo(new Uri("http://10.0.0.102:888/onvif/device_service"));
}
private static void GetDeviceInfo(Uri uri)
{
string address = uri.AbsoluteUri.ToString();
var messageElement = new TextMessageEncodingBindingElement()
{
MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None)
};
HttpTransportBindingElement httpBinding = new HttpTransportBindingElement()
{
AuthenticationScheme = System.Net.AuthenticationSchemes.Negotiate
};
CustomBinding binding = new CustomBinding(messageElement, httpBinding);
OnVifWebService.DeviceClient service = new OnVifWebService.DeviceClient(binding, new EndpointAddress(address));
string model;
string firmwareVersion;
string serialNumber;
string hardwareId;
var response = service.GetDeviceInformation(out model, out firmwareVersion, out serialNumber, out hardwareId);
}
}
}
Any ideas why camera is not answering to WCF client?
Why there is reassemble line:
[2 Reassembled TCP Segments (542 bytes): #11629(281), #11631(261)]
in WCF client request, but not in SoapUI call
Problem was the Expect HTML header
Expect: 100-continue\r\n
When I added this to WCF code
System.Net.ServicePoint servicePoint = System.Net.ServicePointManager.FindServicePoint(service.Endpoint.Address.Uri);
servicePoint.Expect100Continue = false;
It removed the Expect header and I got the answer from the camera.