0

I have set up a jitsi server from packages and now I'm trying to log some connection stats to a database. For example, PUT some little blobs of data about significant bitrate changes.

I feel familiar with JavaScript and somewhat familiar with WebRTC, but I don't understand the jitsi codebase that well. And it seems that the quick installation only gave me the minimized JavaScript files.

Where could I get the WebRTC stats of a jitsi call and where am I supposed to hook up my logging calls? What files and how should I edit?

For future readers: I have described how I accomplished this on the jitsi forums: https://community.jitsi.org/t/how-to-add-a-listener-for-conference-joined/42241/2

Džuris
  • 2,115
  • 3
  • 27
  • 55

1 Answers1

2

I'm not sure if you're talking about client-side stats or server-side stats, but we have some support for collecting both.

On the client side, we have some logic for gathering stats but it's for an integration with a service called Callstats.io. You could look at this file and the code which uses it to see if you could adapt something to your use case.

On the bridge we also gather a bunch of stats. It's available via REST, at serverIp:8080/colibri/debug (though the 8080 is configurable). You could poke around that a bit by looking at this file.

bbaldino
  • 394
  • 3
  • 15
  • I am looking for a client side solution. Yeah, I saw callstats and that's very similar to what I would like to do. It also seemed that the things I would need are already exposed via [this API](https://github.com/jitsi/lib-jitsi-meet/blob/master/doc/API.md). Most of my confusion is that I don't understand if I can somehow add a script to the client and retrieve the connection object? Likely no, I should probably add it in the app JS bundle, but it's compiled on my install. So is it something like clone all of the [repo](https://github.com/jitsi/jitsi-meet), add code, build, move the bundle.js? – Džuris Apr 17 '20 at 00:21
  • 1
    If you're looking to gather stats without changing any of the code, I'm not sure what hooks exist, but I think you can get access to the app/lib (look at the `APP` variable. The peer connection(s), for example, are at `APP.conference._room.p2pJingleSession.peerconnection` for p2p and `APP.conference._room.jvbJingleSession.peerconnection` for bridge connections). If you're writing your own, most webrtc stat libs just latch onto the peer connection and pull all the stats from there (like what's in webrtc-internals). – bbaldino Apr 18 '20 at 21:45
  • Thanks for the directions! It didn't all click instantly for me but after some digging through the code I am gathering some events and stats. But there's one thing that I can't solve for 5 days already - `APP.conference._room` is not available at all times. Do you know if there is any event or something when it pops into existence? Or should I just `setTimeout` and retry? – Džuris Apr 28 '20 at 01:10
  • Yeah, the room is only present once things have connected. Once it's connected it should be there consistently though, I think – bbaldino Apr 29 '20 at 05:15