Server side component for monitoring WebRTC stack
Table of Contents:
Qucik Start
Install it from npm package repository.
npm i @observertc/observer-js
Use it in your server side NodeJS app.
import { createObserver, ClientSample } from "@observertc/observer-js";
const observer = createObserver({
});
const clientSource = observer.createClientSource({
roomId: 'roomId',
callId: 'room-session-id',
clientId: 'reporting-client-id',
});
const clientSample: ClientSample;
clientSource.accept(clientSample);
observer.addEvaluator(async context => {
const { endedCalls } = context;
for (const endedCall of endedCalls) {
const elapsedTimeInMins = (endedCall.ended - Number(endedCall.started)) / (60 * 1000);
console.log(`Call ${endedCall.callId} duration was ${elapsedTimeInMins} minutes`);
}
});
The above example do as follows:
- create an observer to evaluate samples from clients and sfus
- create a client source object to accept client samples
- add an evaluator process to evaluate ended calls
API documentation
https://observertc.org/docs/api/observer-js
NPM package
https://www.npmjs.com/package/@observertc/observer-js
Schemas
https://github.com/observertc/schemas
Getting Involved
The repository is open for contributions.
License
Apache-2.0