Code Monkey home page Code Monkey logo

janode's Introduction

About Janode

Janode is a Node.js, browser compatible, adapter for the Janus WebRTC server.

Internally uses WebSockets or Unix DGRAM Sockets to connect to Janus.

The library wraps the Janus core API, the Janus Admin API and some of the most popular plugins APIs.

The supported Janus plugins currently are:

  • EchoTest
  • AudioBridge
  • Streaming
  • VideoRoom

The library is available on npm and the source code is on github.

Example of usage

This is just a pretty simple hello world for the echotest plugin. Read the examples on the git repo to have some more details.

import Janode from 'janode';
const { Logger } = Janode;
import EchoTestPlugin from 'janode/plugins/echotest';

const connection = await Janode.connect({
  is_admin: false,
  address: {
    url: 'ws://127.0.0.1:8188/',
    apisecret: 'secret'
  }
});
const session = await connection.create();

// Attach to a plugin using the plugin descriptor
const echoHandle = await session.attach(EchoTestPlugin)

// Janode exports "EVENT" property with core events
echoHandle.on(Janode.EVENT.HANDLE_WEBRTCUP, _ => Logger.info('webrtcup event'));
echoHandle.on(Janode.EVENT.HANDLE_MEDIA, evtdata => Logger.info('media event', evtdata));
echoHandle.on(Janode.EVENT.HANDLE_SLOWLINK, evtdata => Logger.info('slowlink event', evtdata));
echoHandle.on(Janode.EVENT.HANDLE_HANGUP, evtdata => Logger.info('hangup event', evtdata));
echoHandle.on(Janode.EVENT.HANDLE_DETACHED, evtdata => Logger.info('detached event', evtdata));

// Refer to plugin documentation

// plugins export "EVENT" property with specific plugin events
echoHandle.on(EchoTestPlugin.EVENT.ECHOTEST_RESULT, evtdata => Logger.info('echotest result event', evtdata));

// Specific method exported by the plugin
// "offer" got from the client
const { jsep: answer } = await echoHandle.start({ video: true, jsep: offer });

// detach the handle
await echoHandle.detach();

Admin API example

import Janode from 'janode';

const admin = await Janode.connect({
  is_admin: true,
  address: {
    url: 'ws://127.0.0.1:7188/',
    apisecret: 'secret'
  }
});

// Get the list of active sessions
const data = await admin.listSessions();

Switching to other transports

The kind of transport used for a connection depends on the protocol/scheme defined in the url field of the configuration.

/* Use UNIX DGRAM Sockets */
const admin = await Janode.connect({
  is_admin: true,
  address: {
    url: 'file://tmp/janusapi',
    apisecret: 'secret'
  }
});
/* Use WebSockets */
const admin = await Janode.connect({
  is_admin: true,
  address: {
    url: 'ws://127.0.0.1:7188/',
    apisecret: 'secret'
  }
});

Installation

Installing the library from npm is as easy as:

npm install janode

On the other hand, in case you got the code from git you must build the library through:

npm run build

Running examples (only available from the git repo)

Examples are only available in the code fetched from git repo and are not published on npm.

cd examples/echotest
npm run build
npm run build-config
node src/echotest.js --janode-log=info

To change the configuration edit config.js under src.

Usage in browsers

Janode should work in browsers. You need to create a bundle with the core library and the needed plugins using a tool that can:

  • shim native node modules (e.g. EventEmitter)
  • import commonjs modules (some dependencies could still use that format)
  • parse the browser field in the package.json

If you get the code from the repo, you can find a rollup bundling sample in the bundle.sh script under examples/browser/. The output will be a bundle.js script that defines an App global object with the members Janode and EchoTestPlugin.

janode's People

Contributors

atoppi avatar augustblack avatar dota-coach avatar golgetahir avatar guilherme-marcello avatar kylefoley avatar oversamu 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  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

janode's Issues

Support for SIP plugin

I am building an application using Janode and would like SIP integration support for dial in

Migrating to Typescript

Any plan or interest in migrating the codebase to Typescript? I think it would be more manageable in the long run compared to managing separate d.ts files.

unix_dgram doesn't seem to be optional

I might be doing something wrong, but on a very basic install on linux, npm install will work, but then I get a runtime error:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'unix-dgram' imported from node_modules/janode/src/transport-unix.js

I'm only using the websocket connection.

Cannot run browser sample due to unix-dgram dependency

Hello,

The browser sample cannot successfully run because the unix-dgram package is imported by transport-unix.js. Uncaught ReferenceError: __filename is not defined is printed to the browser console due to unix-dgram's use of __filename.

As a workaround I can comment out the import UnixTransport from './transport-unix.js'; reference in connection.js and successfully run the sample since it does not use unix sockets. Is it possible to run Janode in the browser without modifying its code? This appears to be related: #16 (comment).

Thanks!

trickle event from janus to client not handled.

janus may generate trickle events to advertise new candidates (especially when full trickle is enabled), but they are not handled by janode, so they cannot be forwarded to the clients (browsers).

Note: AFAIK, they are not documented anywhere, but you can see they exist here

audiobridge feed/id on join is weird

This is a two-part issue report.

First, the naming of 'id' to 'feed' on audiobridge join is a bit weird. Since it doesn't match the janus backend name of 'id', any error reports for it will be misleading.

Second, if you have your audiobridge set with string_ids = "true"; and you don't pass in the 'feed' var on join, you will get an error.

Potential fix might be to simply allow 'feed' on join to be number|string and then NOT set a default value of feed =. 0

Ideally, I think "feed" should be "id" to match the janus backend (but, I imagine there was a reason to rename it)

ICE failed for component 1 in stream 1 when trying to run janode examples.

I am trying to run janode as a node based client to publish webrtc media, Running janus-gateway javascript examples seems to work however janode examples fail to establish a proper ICE connection

Steps to reproduce

Trying to run this on an ubuntu 20.04

  • Clone the git repo
  • cd janode/examples/videoroom
  • Build the files and then change the config to match our janus server instance
  • Run the code using node src/index.js
  • Open the website at the specified port number

The error generated is as follows

2023-03-16T12:25:15.152Z - INFO : [index.js] initializing socketio front end...
2023-03-16T12:25:15.156Z - INFO : [index.js] scheduled connection in 1 seconds
2023-03-16T12:25:15.160Z - INFO : [index.js] server listening on http://localhost:5500/janode
2023-03-16T12:25:16.160Z - INFO : [index.js] connecting Janode...
2023-03-16T12:25:16.160Z - INFO : [janode.js] creating new connection
2023-03-16T12:25:16.162Z - INFO : [tmanager.js] [5715543464780219] creating new transaction manager (debug=false)
2023-03-16T12:25:16.165Z - INFO : [transport-ws.js] [5715543464780220] trying connection with ws://xx.x.xxx.x:8188/
2023-03-16T12:25:16.262Z - INFO : [transport-ws.js] [5715543464780220] websocket connected
2023-03-16T12:25:16.262Z - INFO : [transport-ws.js] [5715543464780220] websocket ping task scheduled every 10 seconds
2023-03-16T12:25:16.262Z - INFO : [index.js] connection with Janus created
2023-03-16T12:25:16.263Z - INFO : [connection.js] [5715543464780220] creating new session
2023-03-16T12:25:16.308Z - INFO : [session.js] [7116161089407713] session keep-alive task scheduled every 30000 milliseconds
2023-03-16T12:25:16.308Z - INFO : [connection.js] [5715543464780220] session created (id=7116161089407713)
2023-03-16T12:25:16.308Z - INFO : [index.js] session 7116161089407713 with Janus created
2023-03-16T12:25:16.308Z - INFO : [session.js] [7116161089407713] attaching new handle
2023-03-16T12:25:16.348Z - INFO : [session.js] [7116161089407713] handle attached (id=5714050137594313)
2023-03-16T12:25:16.349Z - INFO : [index.js] manager handle 5714050137594313 attached
2023-03-16T12:25:47.309Z - INFO : [index.js] [127.0.0.1:43326] connection with client established
2023-03-16T12:25:47.438Z - INFO : [index.js] [127.0.0.1:43326] join received
2023-03-16T12:25:47.439Z - INFO : [session.js] [7116161089407713] attaching new handle
2023-03-16T12:25:47.491Z - INFO : [session.js] [7116161089407713] handle attached (id=3417598316525048)
2023-03-16T12:25:47.492Z - INFO : [index.js] [127.0.0.1:43326] videoroom publisher handle 3417598316525048 attached
2023-03-16T12:25:47.550Z - INFO : [index.js] [127.0.0.1:43326] joined sent
2023-03-16T12:25:51.731Z - INFO : [index.js] [127.0.0.1:43326] configure received
2023-03-16T12:25:51.734Z - INFO : [index.js] [127.0.0.1:43326] trickle received
2023-03-16T12:25:51.736Z - INFO : [index.js] [127.0.0.1:43326] trickle received
2023-03-16T12:25:51.737Z - INFO : [index.js] [127.0.0.1:43326] trickle received
2023-03-16T12:25:51.738Z - INFO : [index.js] [127.0.0.1:43326] trickle received
2023-03-16T12:25:51.752Z - INFO : [index.js] [127.0.0.1:43326] trickle received
2023-03-16T12:25:51.753Z - INFO : [index.js] [127.0.0.1:43326] trickle received
2023-03-16T12:25:51.773Z - INFO : [index.js] [3417598316525048] trickle event {"sdpMid":"0","sdpMLineIndex":0,"candidate":"candidate:1 1 udp 2015363327 xx.x.xxx.x 32728 typ host"}
2023-03-16T12:25:51.773Z - INFO : [index.js] [3417598316525048] trickle event {"sdpMid":"0","sdpMLineIndex":0,"candidate":"candidate:2 1 tcp 1015021823 xx.x.xxx.x 0 typ host tcptype active"}
2023-03-16T12:25:51.773Z - INFO : [index.js] [3417598316525048] trickle event {"sdpMid":"0","sdpMLineIndex":0,"candidate":"candidate:3 1 tcp 1010827519 xx.x.xxx.x 22470 typ host tcptype passive"}
2023-03-16T12:25:51.774Z - INFO : [index.js] [3417598316525048] trickle event {"sdpMid":"0","sdpMLineIndex":0,"candidate":"candidate:4 1 udp 2015363583 fe80::8cf:e2ff:fed8:db94 29491 typ host"}
2023-03-16T12:25:51.774Z - INFO : [index.js] [3417598316525048] trickle event {"sdpMid":"0","sdpMLineIndex":0,"candidate":"candidate:5 1 tcp 1015022079 fe80::8cf:e2ff:fed8:db94 0 typ host tcptype active"}
2023-03-16T12:25:51.774Z - INFO : [index.js] [3417598316525048] trickle event {"sdpMid":"0","sdpMLineIndex":0,"candidate":"candidate:6 1 tcp 1010827775 fe80::8cf:e2ff:fed8:db94 36984 typ host tcptype passive"}
2023-03-16T12:25:51.778Z - INFO : [index.js] [127.0.0.1:43326] configured sent
2023-03-16T12:25:51.813Z - INFO : [index.js] [3417598316525048] trickle event {"sdpMid":"0","sdpMLineIndex":0,"candidate":"candidate:7 1 udp 1679819007 xx.x.xxx.x 32728 typ srflx raddr 172.31.9.6 rport 32728"}
2023-03-16T12:25:51.814Z - INFO : [index.js] [3417598316525048] trickle event {"sdpMid":"0","sdpMLineIndex":0,"candidate":"candidate:8 1 tcp 847249663 xx.x.xxx.x 0 typ srflx raddr 172.31.9.6 rport 0 tcptype active"}
2023-03-16T12:25:51.814Z - INFO : [index.js] [3417598316525048] trickle event {"sdpMid":"0","sdpMLineIndex":0,"candidate":"candidate:9 1 tcp 843055359 xx.x.xxx.x 22470 typ srflx raddr 172.31.9.6 rport 22470 tcptype passive"}
2023-03-16T12:25:51.814Z - INFO : [index.js] [3417598316525048] trickle event {"completed":true}
2023-03-16T12:25:51.850Z - INFO : [index.js] [127.0.0.1:43326] trickle received
2023-03-16T12:25:51.853Z - INFO : [index.js] [127.0.0.1:43326] trickle-complete received
2023-03-16T12:26:03.930Z - INFO : [index.js] [3417598316525048] hangup event {"reason":"ICE failed"}
2023-03-16T12:30:08.849Z - INFO : [index.js] [127.0.0.1:43326] disconnected socket
2023-03-16T12:30:08.894Z - INFO : [handle.js] [3417598316525048] detaching handle
2023-03-16T12:30:08.935Z - INFO : [index.js] [3417598316525048] detached event

So i have been working with Janus media server for a while now so there a couple of things that i have verifed such as,

  • Nat 1-1 mapping because of ec2 instance
  • When i run the videoroom example from janus-gateway repository there are no problems, ice connection gets established successfully. The problem only comes when trying it with janode.

I am not very clear on the direction to even start investigating this issue, any help or advice regarding this issue on getting janode to work with videoroom will be very helpful.

Thanks
Akhilesh B Kalnoor

Unable to access data channels when using Janode with Janus.js client (VideoRoom Plugin)

Hey all,
I have a publisher that is using Janus.js as a client for publishing data in a videoroom. Using janode I can setup the peer connection, access the mediastream track , etc . However I am not able to access anything related to the data coming from the publisher.
I looked through janode examples and found nothing on data channels.
It ll be really great help if someone can point me in the right direction for going about this.

P.S I have already tried to listen to data channel events shown below like

peerConnection.ondatachannel = (event) => {
  const dataChannel = event.channel;

  dataChannel.onopen = () => {
    console.log('Data channel opened');
  };

  dataChannel.onmessage = (event) => {
    console.log('Received message:', event.data);
  };

  dataChannel.onclose = () => {
    console.log('Data channel closed');
  };
};

But this doesn't seem to work.
I can confirm that data is being sent from the publisher based on console and media server logs.

Question: why does `Janode setup error` force the websocket connection to be closed?

Hi. I was developing an app with Janode and by mistake I tried to connect to a nonexistent room. However I didn't expect the error to make the websocket close itself without reconnecting. I'm using this connection for all of my sessions and this just closes them all basically. May I know the reason for that and how can I stop it to close?

�[36mbackend_1   |�[0m 2022-03-07T13:03:19.911Z - INFO : [transport-ws.js] [8999818924408386] closing websocket
�[36mbackend_1   |�[0m error while joining a tour:  Error: 426 No such room (5332351842943423)
�[36mbackend_1   |�[0m     at VideoRoomHandle.handleMessage (file:///usr/src/server/node_modules/janode/src/plugins/videoroom-plugin.js:304:33)
�[36mbackend_1   |�[0m     at VideoRoomHandle._handleMessage (file:///usr/src/server/node_modules/janode/src/handle.js:246:19)
�[36mbackend_1   |�[0m     at Session._handleMessage (file:///usr/src/server/node_modules/janode/src/session.js:264:14)
�[36mbackend_1   |�[0m     at Connection._handleMessage (file:///usr/src/server/node_modules/janode/src/connection.js:200:17)
�[36mbackend_1   |�[0m     at WebSocket.<anonymous> (file:///usr/src/server/node_modules/janode/src/transport-ws.js:166:26)
�[36mbackend_1   |�[0m     at WebSocket.onMessage (/usr/src/server/node_modules/ws/lib/event-target.js:199:18)
�[36mbackend_1   |�[0m     at WebSocket.emit (node:events:520:28)
�[36mbackend_1   |�[0m     at Receiver.receiverOnMessage (/usr/src/server/node_modules/ws/lib/websocket.js:1137:20)
�[36mbackend_1   |�[0m     at Receiver.emit (node:events:520:28)
�[36mbackend_1   |�[0m     at Receiver.dataMessage (/usr/src/server/node_modules/ws/lib/receiver.js:528:14) {
�[36mbackend_1   |�[0m   _code: 426
�[36mbackend_1   |�[0m }
�[36mbackend_1   |�[0m 2022-03-07T13:03:19.931Z - INFO : [janus.js] [172.20.0.8:58336] disconnected socket
�[36mbackend_1   |�[0m 2022-03-07T13:03:19.933Z - ERROR: [transport-ws.js] [8999818924408386] websocket send error (WebSocket is not open: readyState 2 (CLOSING))
�[36mbackend_1   |�[0m 2022-03-07T13:03:19.940Z - INFO : [transport-ws.js] [8999818924408386] websocket closed code=1005 reason= clean=true
�[36mbackend_1   |�[0m 2022-03-07T13:03:19.940Z - INFO : [transport-ws.js] [8999818924408386] websocket ping task disabled
�[36mbackend_1   |�[0m 2022-03-07T13:03:19.941Z - INFO : [tmanager.js] [8999818924408385] clearing transaction manager
�[36mbackend_1   |�[0m 2022-03-07T13:03:19.941Z - INFO : Connection with Janus closed

`unix-dgram` optionality problem using specific Node.js Docker image

When using Janode in Docker containers I've faced the same problem as in issue #10:

node:internal/errors:477
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'unix-dgram' imported from /app/node_modules/janode/src/transport-unix.js
    at new NodeError (node:internal/errors:387:5)
    at packageResolve (node:internal/modules/esm/resolve:951:9)
    at moduleResolve (node:internal/modules/esm/resolve:1000:20)
    at defaultResolve (node:internal/modules/esm/resolve:1214:11)
    at nextResolve (node:internal/modules/esm/loader:165:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:844:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:431:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
    at link (node:internal/modules/esm/module_job:75:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

The issue occurs when the Docker image is built from the base image node:16-slim. Meanwhile it works well and as expected when using the node:16 image.

Steps to reproduce

  1. npm init with default values
  2. npm insall janode
  3. add the "type": "module" line to the package.json

The package.json file should look like this:

{
  "name": "janode-issue",
  "version": "1.0.0",
  "description": "",
  "type": "module", // added line
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "janode": "^1.6.4"
  }
}
  1. Create the main.js file with the following content:
import Janode from 'janode'
  1. Create the Dockerfile file with the following content:
FROM node:16-slim
WORKDIR /app/
COPY main.js ./
COPY package*.json ./
RUN npm install
CMD ["node", "main.js"]
  1. Build the Docker image:
docker build --tag xyz .
  1. Run the built Docker image:
docker run --rm xyz
  1. Error should be occured.

Appendix

The zip with all the mentioned files (plus package-lock.json file): janode-issue.zip

Connect fails while running th demo code in repo

Hey I am new to the community. I clone the repository do the instructions as defined but connection fails every time whether http or https.


PS CXXX\> npm run start

> start
> node src/index.js

2022-09-16T14:09:37.571Z - INFO : [index.js] scheduled connection in 1 seconds
2022-09-16T14:09:37.578Z - INFO : [index.js] server listening on https://0.0.0.0:4443/janode
2022-09-16T14:09:38.583Z - INFO : [index.js] connecting Janode...
2022-09-16T14:09:38.588Z - INFO : [janode.js] creating new connection
2022-09-16T14:09:38.594Z - INFO : [tmanager.js] [4970643651838865] creating new transaction manager (debug=false)
2022-09-16T14:09:38.607Z - INFO : [transport-ws.js] [4970643651838866] trying connection with ws://127.0.0.1:8118/
2022-09-16T14:09:38.652Z - ERROR: [transport-ws.js] [4970643651838866] websocket error (connect ECONNREFUSED 127.0.0.1:8118)
2022-09-16T14:09:38.654Z - INFO : [transport-ws.js] [4970643651838866] websocket closed code=1006 reason= clean=false
2022-09-16T14:09:38.657Z - INFO : [tmanager.js] [4970643651838865] clearing transaction manager
2022-09-16T14:09:38.660Z - ERROR: [transport-ws.js] [4970643651838866] connection failed, will try again in 10 seconds...

As this person is able to run the code fine.Here he runs without error

https://youtu.be/CeZzIedQA6s?t=893

Support for TextRoom plugin

I am building a Janus based meeting application and would love support for the TextRoom plugin so I can have text chat as well as media.

audiobridge join does not seem to return AUDIOBRIDGE_EVENT_JOINED

when I do audioHandle.join(...)

I get Promise<{ feed, room, participants }> in return.

This matches janus except that it seems to return without the 'display' field.

However, the docs seem to indicate it should return Promise<AUDIOBRIDGE_EVENT_JOINED>

Maybe just a documentation error?

support of recordplay plugin.

Hi,
Can we know if janode will ever support the recordplay plugin? If there is already a solution can you point me in the right direction?

Speakerphone can not be selected on iOS

Hello 👋
While attending the IETF meeting over the past few days, I have been using the mobile client via Safari on iOS 17.1.1 quite a bit. However, I noticed that the audio is not coming through the speakerphone (not sure if that is the right term, but I just mean the speaker that plays music etc.). Instead, the audio comes through the earpiece (the one we used for phone calls when AirPods didn't exist), which is much louder.

I am not entirely sure if this is exactly the case because I also feel like there is sound coming from both speakers, but in general the volume is about 50% lower than any other audio I can play on my iOS device.

How to demo plugin livestreaming

I cannot specify the input for livestreaming (like screen sharing, camera input); it is not the same as echotest.
I want to create client for user (js web or client in mobile) and server is janode connect with my server nodejs. But i can't find doc.
Please help me 😥. Thank you very much.

Provide NPM package

As this is the standard JS interface library for janus (is it? it seems so from meetecho/janus-gateway#2960 but it does not support everything, see #19) I don't understand why it is not on npm? Isn't one of the major applications of janus to use it in a web environment/browser? So how should one use this library in a project - copy the source code or use git-submodules? both seems no good choices if there exists an package manager for node which solves these problems.

wss test

https://teleden.com:8081 is ok via wss://teleden.com via nginx

here i get
[ERR_MODULE_NOT_FOUND]: Cannot find package 'isomorphic-ws' imported from /home/spowage/janode/src/transport-ws.js
with

export default {
janode: {
address: [{
url: 'wss://teleden.com/',
apisecret: 'secret'
}],
// seconds between retries after a connection setup error
retry_time_secs: 10
},
web: {
port: 4443,
bind: '0.0.0.0',
key: '/etc/letsencrypt/live/teleden.com/cert.pem',
cert: '/etc/letsencrypt/live/teleden.com/privkey.pem'
}
};
spowage@teleden:~/janode/examples/videoroom/src$

Does it works with multistream janus version?

Hi guys!

I'm trying to use janode with audiobridge plugin and I've got some issue
My join detail are:

    let details = {
        room: 1234,
        display: "SIP User",
        rtp: {
            ip: "127.0.0.1",
            port: 10018,
            payload_type: 111,
        }
    };

and what is happening:

  • I don't see any joined response on such event
  • if I'll change rtp to be rtp_participant than I see joined response, but localhost changed to device public ip and port changed to some random port
  • in the end I can't hear any audio coming from that plain rtp patricipant

any advice would be appreciated!

listHandles only works on a session you created

I'm building a tool to interrogate our Janus servers and build a graph of who is connected to whom.
Part of this process is to list all sessions then list their handles.

I can do this with direct http calls, but I cannot do it with janode. If I try to list handles for a session I did not create, Connection._handleMessage complains that: "session xxxxxxxxxxxx not found for incoming message success".
Here: https://github.com/meetecho/janode/blob/master/src/connection.js#L194

It seems that Connection keeps a cache of sessions so the right session can handle responses. But this is an admin function that takes a session parameter, and does not require one to establish a session first.

Here is some code to demonstrate the issue:

import Janode from 'janode';

const connection = await Janode.connect({
  is_admin: true,
  address: {
    url: "ws://127.0.0.1:7188/janus",
    apisecret: "janusoverlord"
  }
});

const r1 = await connection.listSessions();
console.log("Got sessions response", r1.sessions)
const r2 = await connection.listHandles(r1.sessions[0]);
console.log("Got handles response", handles);

connection.close();

I'm using a Janus with admin enabled on the websocket, and a videoroom call underway.

Here is the output:

2022-11-05T03:58:42.018Z - INFO : [janode.js] creating new connection
2022-11-05T03:58:42.021Z - INFO : [tmanager.js] [3340554914002515] creating new transaction manager (debug=false)
2022-11-05T03:58:42.021Z - INFO : [transport-ws.js] [3340554914002516] trying connection with ws://127.0.0.1:7188/janus
2022-11-05T03:58:42.032Z - INFO : [transport-ws.js] [3340554914002516] websocket connected
2022-11-05T03:58:42.032Z - INFO : [transport-ws.js] [3340554914002516] websocket ping task scheduled every 10 seconds
Got sessions response [ 5013312951136826, 353991153114233 ]
2022-11-05T03:58:42.035Z - INFO : [connection.js] [3340554914002516] requesting handle list
2022-11-05T03:58:42.036Z - WARN : [connection.js] [3340554914002516] session 5013312951136826 not found for incoming message success

I'm using janode version 1.6.4

date channel

I currently use Janus as a webrtc server and I have a video feed and a metadata feed associated with the video feed. using this new approach how would it work? I will receive everything via WS or would it have to be a different port. or is it not supported? thanks

audiobridge startForward missing arguments?

Hi,

I'm having trouble getting janode to start forwards. Using

Using the Janus api, I can properly start a forward with:

{
        "request" : "rtp_forward",
        "room" : <room name>,
        "codec" : "opus",
        "ptype" : 111,
        "host" : "localhost",
        "port" : <free port num>,
        "always_on" : true
}

and then be able to read the RTP stream with ffmpeg

However, with Janode, it seems ptype and codec are missing. I call:

janodeManagerHandle.startForward({
        "room" : <room name>,
        "host" : "localhost",
        "audio_port" : <free port num>,
        "secret": <..>,
        "always" : true
})

But, cannot read it with ffmpeg

Are the codec and ptype needed?

Joining audiobridge is locked to opus codec only

Have come across a problem where joining as a plain rtp with a codec other that opus is impossible. Being irrelevant whether a participant is plain rtp or not, it seems join() is missing the 'codec' param. In my case, I was trying to join as a plain rtp participant with pcmu or pcma.

The fix is trivial, just adding the codec param to the join method (and documentation) does the trick. Something like that:

async join({ room, ..., generate_offer, codec }) {
  const body = {
      request: REQUEST_JOIN,
      room,
    };
...
...
    if (typeof codec === 'string') body.codec = codec;
    if (typeof muted === 'boolean') body.muted = muted;
...
}

I hope I am not missing anything.

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.