AlexxIT / go2rtc

Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
https://github.com/AlexxIT/Blog
MIT License
3.77k stars 307 forks source link

Need a workflow for TurnServer with WebRTC #1083

Open PRAN20 opened 2 months ago

PRAN20 commented 2 months ago

Hey Alex,

I was going through your work. Its really insane. Can you help me with setting up a turn server on aws. This is the config im using in coturn.

listening-port=3478
tls-listening-port=5349
listening-ip=<Public-IP>
external-ip=<PUBLIC-IP>/<Private-IP>
realm=localhost
min-port=49152
max-port=65535
lt-cred-mech
server-name=localhost
user=test:test123
relay-ip=<LOCAL-IP>
cli-credentials=<Credentials>

while in .yaml i have added

webrtc:
  ice_servers:
    - urls: [stun:stun.l.google.com:19302]
    - urls: [turn:<Public-IP:3478]
      username: test:test123
      credential: <Credentials>

on websites like 'https://icetest.info/' it works fine. but i dont get any message. and if its working what changes are needed in frotend to stream it. This is the coturn log

sudo coturn /etc/turnserver.conf

0: : Bad configuration format: no-rfc5780
0: : log file opened: /var/log/turn_10379_2024-05-03.log
0: : Bad configuration format: no-stun-backward-compatibility
0: : Bad configuration format: response-origin-only-with-rfc5780
0: : Config file found: /etc/turnserver.conf
0: : Bad configuration format: no-rfc5780
0: : Bad configuration format: no-stun-backward-compatibility
0: : Bad configuration format: response-origin-only-with-rfc5780
0: : Config file found: /etc/turnserver.conf
0: : Bad configuration format: no-rfc5780
0: : Bad configuration format: no-stun-backward-compatibility
0: : Bad configuration format: response-origin-only-with-rfc5780
0: : 
RFC 3489/5389/5766/5780/6062/6156 STUN/TURN Server
Version Coturn-4.5.2 'dan Eider'
0: : 
Max number of open files/sockets allowed for this process: 1048576
0: : 
Due to the open files/sockets limitation,
max supported number of TURN Sessions possible is: 524000 (approximately)
0: : 

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

0: : TLS supported
0: : DTLS supported
0: : DTLS 1.2 supported
0: : TURN/STUN ALPN supported
0: : Third-party authorization (oAuth) supported
0: : GCM (AEAD) supported
0: : OpenSSL compile-time version: OpenSSL 3.0.2 15 Mar 2022 (0x30000020)
0: : 
0: : SQLite supported, default database location is /var/lib/turn/turndb
0: : Redis supported
0: : PostgreSQL supported
0: : MySQL supported
0: : MongoDB is not supported
0: : 
0: : Default Net Engine version: 3 (UDP thread per CPU core)

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

0: : Domain name: 
0: : Default realm: 
0: : ERROR: 
CONFIGURATION ALERT: Unknown argument: /etc/turnserver.conf
0: : ERROR: 
CONFIG ERROR: Empty cli-password, and so telnet cli interface is disabled! Please set a non empty cli-password!
0: : Config file found: /home/ubuntu/turn_server_cert.pem
0: : Config file found: /home/ubuntu/turn_server_pkey.pem
0: : ERROR: SSL23: ERROR: no certificate found
0: : SSL23: Private key file found: /home/ubuntu/turn_server_pkey.pem
0: : ERROR: SSL23: ERROR: invalid private key
0: : ERROR: TLS1.0: ERROR: no certificate found
0: : TLS1.0: Private key file found: /home/ubuntu/turn_server_pkey.pem
0: : ERROR: TLS1.0: ERROR: invalid private key
0: : ERROR: TLS1.1: ERROR: no certificate found
0: : TLS1.1: Private key file found: /home/ubuntu/turn_server_pkey.pem
0: : ERROR: TLS1.1: ERROR: invalid private key
0: : ERROR: TLS1.2: ERROR: no certificate found
0: : TLS1.2: Private key file found: /home/ubuntu/turn_server_pkey.pem
0: : ERROR: TLS1.2: ERROR: invalid private key
0: : TLS cipher suite: DEFAULT
0: : ERROR: DTLS: ERROR: no certificate found
0: : DTLS: Private key file found: /home/ubuntu/turn_server_pkey.pem
0: : ERROR: DTLS: ERROR: invalid private key
0: : ERROR: DTLS1.2: ERROR: no certificate found
0: : DTLS1.2: Private key file found: /home/ubuntu/turn_server_pkey.pem
0: : ERROR: DTLS1.2: ERROR: invalid private key
0: : DTLS cipher suite: DEFAULT
0: : NO EXPLICIT LISTENER ADDRESS(ES) ARE CONFIGURED
0: : ===========Discovering listener addresses: =========
0: : Listener address to use: 127.0.0.1
0: : Listener address to use: 172.31.83.200
0: : Listener address to use: 172.17.0.1
0: : Listener address to use: ::1
0: : =====================================================
0: : Total: 2 'real' addresses discovered
0: : =====================================================
0: : NO EXPLICIT RELAY ADDRESS(ES) ARE CONFIGURED
0: : ===========Discovering relay addresses: =============
0: : Relay address to use: 172.31.83.200
0: : Relay address to use: 172.17.0.1
0: : Relay address to use: ::1
0: : =====================================================
0: : Total: 3 relay addresses discovered
0: : =====================================================
0: : pid file created: /var/run/turnserver.pid
0: : IO method (main listener thread): epoll (with changelist)
0: : Wait for relay ports initialization...
0: :   relay 172.31.83.200 initialization...
0: :   relay 172.31.83.200 initialization done
0: :   relay 172.17.0.1 initialization...
0: :   relay 172.17.0.1 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: : turn server id=1 created
0: : IO method (general relay thread): epoll (with changelist)
0: : turn server id=0 created
0: : Total General servers: 2
0: : IO method (admin thread): epoll (with changelist)
0: : IO method (auth thread): epoll (with changelist)
0: : IO method (auth thread): epoll (with changelist)
0: : SQLite DB connection success: /var/lib/turn/turndb
^C
AlexxIT commented 2 months ago

I'm not an expert in coturn. I have tried it only once for tests. I think you already have seen example docs: https://github.com/AlexxIT/WebRTC/wiki/Coturn-Example

PRAN20 commented 2 months ago

Yes Alex, have already tried it. Do you think it can be a issue if im building everything locally without docker

AlexxIT commented 2 months ago

Maybe. Because docker usually have "ready to go" solutions.