Coder Social home page Coder Social logo

dialog's Introduction

dialog

Mediasoup based WebRTC SFU for Hubs.

Development

  1. Clone repo

  2. In root project folder, npm ci (this may take a while).

  3. Create a folder in the root project folder called certs if needed (see steps 4 & 5).

  4. Add the ssl cert and key to the certs folder as fullchain.pem and privkey.pem, or set the path to these in your shell via HTTPS_CERT_FULLCHAIN and HTTPS_CERT_PRIVKEY respectively. You can provide these certs yourself or use the ones available in https://github.com/mozilla/reticulum/tree/master/priv (dev-ssl.cert and dev-ssl.key).

  5. Add the reticulum permissions public key to the certs folder as perms.pub.pem, or set the path to the file in your shell via AUTH_KEY.

  1. Start dialog with MEDIASOUP_LISTEN_IP=XXX.XXX.XXX.XXX MEDIASOUP_ANNOUNCED_IP=XXX.XXX.XXX.XXX npm start where XXX.XXX.XXX.XXX is the local IP address of the machine running the server. (In the case of a VM, this should be the internal IP address of the VM).
  • If you choose to set the paths for HTTPS_CERT_FULLCHAIN, HTTPS_CERT_PRIVKEY and/or AUTH_KEY you may also define them inline here as well. e.g.
HTTPS_CERT_FULLCHAIN=/path/to/cert.file HTTPS_CERT_PRIVKEY=/path/to/key.file AUTH_KEY=/path/to/auth.key MEDIASOUP_LISTEN_IP=XXX.XXX.XXX.XXX MEDIASOUP_ANNOUNCED_IP=XXX.XXX.XXX.XXX npm start
  1. Navigate to https://localhost:4443/ in your browser, and accept the self-signed cert.

  2. You may now point Hubs/Reticulum to use localhost:4443 as the WebRTC host/port.`

See config.js for all available configuration options.

dialog's People

Contributors

brianpeiris avatar bryanenders avatar gfodor avatar infinitelee avatar jacob-ervin avatar keianhzo avatar tanfarming avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dialog's Issues

using this with an NAF project?

The readme is a bit sparse. Was planning to use hubs-based Janus-NAF setup with our project, but am considering giving this a try instead.

We are using easyrtc adapter and NAF right now. I'm trying to roadmap a transition to a mediasoup SFU swap in instead.

(1) I don't see any 'adapter' for NAF; do we just use the Janus adapter? Is this designed to be a drop-in replacement for the api it was using?
(2) Does one need to use the hubs-fork of NAF (also, where is that?)
(3) If one gets this repo up and running, this is the mediasoup server, right? It's not 100% clear what this repo is; the janus plugin repo was just a plugin you build and add to an existing running janus server, but I don't know how the plugin system works for mediasoup, and I'm thinking this repo probably is the whole SFU server...? Is that right?
(4) What changes in the readme if I'm running this for me? I assume, for example, that I can't use your SSL certs? Do I need to generate my own? Info about that? Etc.

Thanks!

npm ci failed on Windows 11/Python 3.11.0

Edition: Windows 11 Home Single Language
Version: 21H2
OS Build: 22000.1098
Python Version: 3.11.0

2073 timing build:run:postinstall:node_modules/clang-tools-prebuilt Completed in 346ms
2074 timing reify:rollback:createSparse Completed in 2989ms
2075 timing reify:rollback:retireShallow Completed in 0ms
2076 timing command:ci Completed in 41249ms
2077 verbose stack Error: command failed
2077 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:63:27)
2077 verbose stack     at ChildProcess.emit (node:events:513:28)
2077 verbose stack     at maybeClose (node:internal/child_process:1093:16)
2077 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
2078 verbose pkgid [email protected]
2079 verbose cwd \hub-cloud\dialog
2080 verbose Windows_NT 10.0.22000
2081 verbose node v16.17.0
2082 verbose npm  v8.15.0
2083 error code 1
2084 error path \hub-cloud\dialog\node_modules\mediasoup
2085 error command failed
2086 error command C:\WINDOWS\system32\cmd.exe /d /s /c \AppData\Local\Temp\postinstall-c956e47d.cmd
2087 error npm-scripts.js [INFO] running task "postinstall"
2087 error npm-scripts.js [INFO] executing command: python ./worker/scripts/configure.py --format=msvs -R mediasoup-worker
2088 error \hub-cloud\dialog\node_modules\mediasoup\worker\deps\gyp\pylib\gyp\input.py:1186: SyntaxWarning: "is" with a literal. Did you mean "=="?
2088 error   if the_dict_key is 'variables' and variable_name in the_dict:
2088 error Traceback (most recent call last):
2088 error   File "\hub-cloud\dialog\node_modules\mediasoup\worker\scripts\configure.py", line 20, in <module>
2088 error     import gyp
2088 error   File "\hub-cloud\dialog\node_modules\mediasoup\worker\deps\gyp\pylib\gyp\__init__.py", line 10, in <module>
2088 error     import gyp.input
2088 error   File "\hub-cloud\dialog\node_modules\mediasoup\worker\deps\gyp\pylib\gyp\input.py", line 8, in <module>
2088 error     import gyp.common
2088 error   File "\hub-cloud\dialog\node_modules\mediasoup\worker\deps\gyp\pylib\gyp\common.py", line 497, in <module>
2088 error     class OrderedSet(collections.MutableSet):
2088 error                      ^^^^^^^^^^^^^^^^^^^^^^
2088 error AttributeError: module 'collections' has no attribute 'MutableSet'
2089 verbose exit 1
2090 timing npm Completed in 41431ms
2091 verbose unfinished npm timer reify 1667289496139
2092 verbose unfinished npm timer reify:build 1667289522710
2093 verbose unfinished npm timer build 1667289522711
2094 verbose unfinished npm timer build:deps 1667289522711
2095 verbose unfinished npm timer build:run:postinstall 1667289529300
2096 verbose unfinished npm timer build:run:postinstall:node_modules/mediasoup 1667289529319
2097 verbose code 1

Issues with _pid and router._producers causing worker idling and errors

Description:
I have encountered a couple of issues in the current codebase that are impacting the proper functioning of the application. I am planning to create a Pull Request to address these concerns, and I wanted to document them here for better visibility and discussion.

  1. The _pids of workers are currently undefined, preventing the proper distribution of routers across different workers. As a result, all workers except one are idled. This is a critical issue as it significantly impacts the efficiency of the system.

  2. After adding _pids to workers, when piping producers to routers, the expression router._producers.has(producerId) is throwing errors. This error disrupts the expected flow of data distribution and must be addressed to ensure the smooth operation of the application.

Expected Behavior:

  1. Workers should have valid _pids to enable proper distribution of routers.
  2. Piping producers to routers should not result in errors related to router._producers.has(producerId).

I will be working on creating a Pull Request to fix these issues.

Note to Reviewers:
I am in the process of creating a Pull Request to address these issues. Your insights and guidance during the review process will be invaluable.

Thank you!

docker build fails by npm ci

When trying to build this docker container, the build process throws an error during the installation (build) of this Dockerfile.

Environment:

  • Ubuntu Server 20.04 LTS
  • Docker version 26.0.2, build 3c863ff
  • All updates installed, also fresh install of the server

Reproducable:

git clone [email protected]:mozilla/dialog.git
BUILDKIT_PROGRESS=plain docker build .

The variable BUILDKIT_PROGRESS is only to track the issue and generate the following output.

Output:

...
#16 [build 7/8] RUN npm ci
#16 14.20 npm notice 
#16 14.20 npm notice New patch version of npm available! 10.5.0 -> 10.5.2
#16 14.20 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.5.2>
#16 14.20 npm notice Run `npm install -g [email protected]` to update!
#16 14.20 npm notice 
#16 14.20 npm ERR! code 1
#16 14.20 npm ERR! path /app/node_modules/mediasoup
#16 14.20 npm ERR! command failed
#16 14.20 npm ERR! command sh -c node npm-scripts.js postinstall
#16 14.20 npm ERR! npm-scripts.js [INFO] running task "postinstall"
#16 14.20 npm ERR! npm-scripts.js [INFO] buildWorker()
#16 14.20 npm ERR! npm-scripts.js [INFO] executeCmd(): make -C worker
#16 14.20 npm ERR! make: Entering directory '/app/node_modules/mediasoup/worker'
#16 14.20 npm ERR! # Updated pip and setuptools are needed for meson.
#16 14.20 npm ERR! # `--system` is not present everywhere and is only needed as workaround for
#16 14.20 npm ERR! # Debian-specific issue (copied from https://github.com/gluster/gstatus/pull/33),
#16 14.20 npm ERR! # fallback to command without `--system` if the first one fails.
#16 14.20 npm ERR! /usr/bin/python3 -m pip install --system --target=/app/node_modules/mediasoup/worker/out/pip pip setuptools || \
#16 14.20 npm ERR! 	/usr/bin/python3 -m pip install --target=/app/node_modules/mediasoup/worker/out/pip pip setuptools || \
#16 14.20 npm ERR! 	echo "Installation failed, likely because PIP is unavailable, if you are on Debian/Ubuntu or derivative please install the python3-pip package"
#16 14.20 npm ERR! Collecting pip
#16 14.20 npm ERR!   Downloading pip-24.0-py3-none-any.whl (2.1 MB)
#16 14.20 npm ERR!      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 19.7 MB/s eta 0:00:00
#16 14.20 npm ERR! Collecting setuptools
#16 14.20 npm ERR!   Downloading setuptools-69.5.1-py3-none-any.whl (894 kB)
#16 14.20 npm ERR!      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 894.6/894.6 kB 40.8 MB/s eta 0:00:00
#16 14.20 npm ERR! Installing collected packages: setuptools, pip
#16 14.20 npm ERR! Successfully installed pip-24.0 setuptools-69.5.1
#16 14.20 npm ERR! # Install `meson` and `ninja` using `pip` into custom location, so we don't
#16 14.20 npm ERR! # depend on system-wide installation.
#16 14.20 npm ERR! /usr/bin/python3 -m pip install --upgrade --target=/app/node_modules/mediasoup/worker/out/pip  meson==0.61.5 ninja==1.10.2.4
#16 14.20 npm ERR! Collecting meson==0.61.5
#16 14.20 npm ERR!   Downloading meson-0.61.5-py3-none-any.whl.metadata (1.6 kB)
#16 14.20 npm ERR! Collecting ninja==1.10.2.4
#16 14.20 npm ERR!   Downloading ninja-1.10.2.4-py2.py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl.metadata (5.3 kB)
#16 14.20 npm ERR! Downloading meson-0.61.5-py3-none-any.whl (862 kB)
#16 14.20 npm ERR!    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 862.5/862.5 kB 15.8 MB/s eta 0:00:00
#16 14.20 npm ERR! Downloading ninja-1.10.2.4-py2.py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl (120 kB)
#16 14.20 npm ERR!    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 120.7/120.7 kB 14.3 MB/s eta 0:00:00
#16 14.20 npm ERR! Installing collected packages: ninja, meson
#16 14.20 npm ERR! Successfully installed meson-0.61.5 ninja-1.10.2.4
#16 14.20 npm ERR! /app/node_modules/mediasoup/worker/out/pip/bin/meson setup \
#16 14.20 npm ERR! 	--prefix /app/node_modules/mediasoup/worker/out/Release \
#16 14.20 npm ERR! 	--bindir '' \
#16 14.20 npm ERR! 	--libdir '' \
#16 14.20 npm ERR! 	--buildtype release \
#16 14.20 npm ERR! 	-Db_ndebug=true \
#16 14.20 npm ERR! 	-Db_pie=true \
#16 14.20 npm ERR! 	-Db_staticpic=true \
#16 14.20 npm ERR! 	--reconfigure \
#16 14.20 npm ERR! 	"" \
#16 14.20 npm ERR! 	/app/node_modules/mediasoup/worker/out/Release/build || \
#16 14.20 npm ERR! 	/app/node_modules/mediasoup/worker/out/pip/bin/meson setup \
#16 14.20 npm ERR! 		--prefix /app/node_modules/mediasoup/worker/out/Release \
#16 14.20 npm ERR! 		--bindir '' \
#16 14.20 npm ERR! 		--libdir '' \
#16 14.20 npm ERR! 		--buildtype release \
#16 14.20 npm ERR! 		-Db_ndebug=true \
#16 14.20 npm ERR! 		-Db_pie=true \
#16 14.20 npm ERR! 		-Db_staticpic=true \
#16 14.20 npm ERR! 		"" \
#16 14.20 npm ERR! 		/app/node_modules/mediasoup/worker/out/Release/build
#16 14.20 npm ERR! The Meson build system
#16 14.20 npm ERR! Version: 0.61.5
#16 14.20 npm ERR! Source dir: /app/node_modules/mediasoup/worker
#16 14.20 npm ERR! Build dir: /app/node_modules/mediasoup/worker/out/Release/build
#16 14.20 npm ERR! Build type: native build
#16 14.20 npm ERR! Project name: mediasoup-worker
#16 14.20 npm ERR! Project version: undefined
#16 14.20 npm ERR! C compiler for the host machine: cc (gcc 12.2.0 "cc (Debian 12.2.0-14) 12.2.0")
#16 14.20 npm ERR! C linker for the host machine: cc ld.bfd 2.40
#16 14.20 npm ERR! C++ compiler for the host machine: c++ (gcc 12.2.0 "c++ (Debian 12.2.0-14) 12.2.0")
#16 14.20 npm ERR! C++ linker for the host machine: c++ ld.bfd 2.40
#16 14.20 npm ERR! Host machine cpu family: x86_64
#16 14.20 npm ERR! Host machine cpu: x86_64
#16 14.20 npm ERR! Downloading openssl source from https://www.openssl.org/source/openssl-3.0.7.tar.gz
#16 14.20 npm ERR! HTTP Error 403: Forbidden
#16 14.20 npm ERR! A fallback URL could be specified using source_fallback_url key in the wrap file
#16 14.20 npm ERR! 
#16 14.20 npm ERR! meson.build:164:0: ERROR: could not get https://www.openssl.org/source/openssl-3.0.7.tar.gz is the internet available?
#16 14.20 npm ERR! 
#16 14.20 npm ERR! A full log can be found at /app/node_modules/mediasoup/worker/out/Release/build/meson-logs/meson-log.txt
#16 14.20 npm ERR! make: Leaving directory '/app/node_modules/mediasoup/worker'
#16 14.20 npm ERR! Usage:   
#16 14.20 npm ERR!   /usr/bin/python3 -m pip install [options] <requirement specifier> [package-index-options] ...
#16 14.20 npm ERR!   /usr/bin/python3 -m pip install [options] -r <requirements file> [package-index-options] ...
#16 14.20 npm ERR!   /usr/bin/python3 -m pip install [options] [-e] <vcs project url> ...
#16 14.20 npm ERR!   /usr/bin/python3 -m pip install [options] [-e] <local project path> ...
#16 14.20 npm ERR!   /usr/bin/python3 -m pip install [options] <archive url/path> ...
#16 14.20 npm ERR! 
#16 14.20 npm ERR! no such option: --system
#16 14.20 npm ERR! WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#16 14.20 npm ERR! WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#16 14.20 npm ERR! Directory does not contain a valid build tree:
#16 14.20 npm ERR! /app/node_modules/mediasoup/worker/out/Release/build
#16 14.20 npm ERR! make: *** [Makefile:110: setup] Error 1
#16 14.20 npm ERR! npm-scripts.js [ERROR] executeCmd() failed, exiting: Error: Command failed: make -C worker
#16 14.20 
#16 14.20 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-04-23T19_57_18_083Z-debug-0.log
#16 ERROR: process "/bin/sh -c npm ci" did not complete successfully: exit code: 1
------
 > [build 7/8] RUN npm ci:
14.20 npm ERR! 
14.20 npm ERR! no such option: --system
14.20 npm ERR! WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
14.20 npm ERR! WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
14.20 npm ERR! Directory does not contain a valid build tree:
14.20 npm ERR! /app/node_modules/mediasoup/worker/out/Release/build
14.20 npm ERR! make: *** [Makefile:110: setup] Error 1
14.20 npm ERR! npm-scripts.js [ERROR] executeCmd() failed, exiting: Error: Command failed: make -C worker
14.20 
14.20 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-04-23T19_57_18_083Z-debug-0.log
------
Dockerfile:10
--------------------
   8 |     copy package.json .
   9 |     copy package-lock.json .
  10 | >>> run npm ci
  11 |     copy . .
  12 |     from node:lts-slim
--------------------
ERROR: failed to solve: process "/bin/sh -c npm ci" did not complete successfully: exit code: 1

New peer takes too long time to be notified

New peer notification on producer side takes too long after consumer is already receiving data. Is it possible to get this or another notification on producer side when the consumer receives the first data?

image
Consumer first receive data at 12:14:40
p.s.:("data sent at ..." is the content of the message received)

image
Producer receives new peer notification after almost 30 seconds

throwing MediaSoupError

When I start dialog on my server and create a room through hubs, Dialog can see mediasoup: error: Channel [PID: 398327 RTC:: portmanager:: bind() 𞓜 throwing mediasouperror: Port bind failed due to address not available. I began to think it was a firewall rule problem. UDP needed to open 40000-49999 ports. When I released these ports, the problem still existed. What's the reason?

Error: read ECONNRESET

I've followed the README instructions, and it often throw error and exit as below when logging into rooms by using Hubs and Reticulum. Anyone may help with the problem? Very appreciated...

**node:events:368
throw er; // Unhandled 'error' event
^

Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:220:20)
Emitted 'error' event on TLSSocket instance at:
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}**

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.