Skip to content

Commit

Permalink
feat(WIP): Add an option to export media to a pre-configured WS url.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrozev committed Sep 22, 2024
1 parent 52ba365 commit 36cea4f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import org.jitsi.xmpp.extensions.colibri2.Colibri2Relay
import org.jitsi.xmpp.extensions.colibri2.ConferenceModifiedIQ
import org.jitsi.xmpp.extensions.colibri2.ConferenceModifyIQ
import org.jitsi.xmpp.extensions.colibri2.Endpoints
import org.jitsi.xmpp.extensions.colibri2.Export
import org.jitsi.xmpp.extensions.colibri2.InitialLastN
import org.jitsi.xmpp.extensions.colibri2.Media
import org.jitsi.xmpp.extensions.colibri2.Sctp
Expand All @@ -48,6 +49,7 @@ import org.jivesoftware.smack.StanzaCollector
import org.jivesoftware.smack.packet.ErrorIQ
import org.jivesoftware.smack.packet.IQ
import org.jivesoftware.smackx.muc.MUCRole
import java.net.URI
import java.util.Collections.singletonList
import java.util.UUID

Expand All @@ -57,6 +59,7 @@ class Colibri2Session(
val bridge: Bridge,
// Whether the session was constructed for the purpose of visitor nodes
val visitor: Boolean,
val audioExportUrl: URI?,
parentLogger: Logger
) : CascadeNode<Colibri2Session, Colibri2Session.Relay> {
private val logger = createChildLogger(parentLogger).apply {
Expand Down Expand Up @@ -196,6 +199,10 @@ class Colibri2Session(
setCreate(true)
setConferenceName(colibriSessionManager.conferenceName)
setRtcstatsEnabled(colibriSessionManager.rtcStatsEnabled)
audioExportUrl?.let {
logger.warn("XXX adding export to colibri iq url=$it")
addExport(Export(it, audio = true))
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import org.jivesoftware.smack.packet.StanzaError.Condition.conflict
import org.jivesoftware.smack.packet.StanzaError.Condition.item_not_found
import org.jivesoftware.smack.packet.StanzaError.Condition.service_unavailable
import org.json.simple.JSONArray
import java.net.URI
import java.util.Collections.singletonList

/**
Expand All @@ -68,6 +69,7 @@ class ColibriV2SessionManager(
*/
internal val meetingId: String,
internal val rtcStatsEnabled: Boolean,
private val audioExportUrl: URI?,
private val bridgeVersion: String?,
parentLogger: Logger
) : ColibriSessionManager, Cascade<Colibri2Session, Colibri2Session.Relay> {
Expand All @@ -81,6 +83,8 @@ class ColibriV2SessionManager(
logger.info("Using ${it.javaClass.name}")
}

private var sessionForAudioRecording: Colibri2Session? = null

/**
* The colibri2 sessions that are currently active, mapped by the relayId of the [Bridge] that they use.
*/
Expand Down Expand Up @@ -241,7 +245,16 @@ class ColibriV2SessionManager(
return Pair(session, false)
}

session = Colibri2Session(this, bridge, visitor, logger)
session = Colibri2Session(
this,
bridge,
visitor,
if (audioExportUrl != null && sessionForAudioRecording == null) audioExportUrl else null,
logger
)
if (audioExportUrl != null && sessionForAudioRecording == null) {
sessionForAudioRecording = session
}
return Pair(session, true)
}

Expand Down
3 changes: 3 additions & 0 deletions jicofo-selector/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,9 @@ jicofo {
# via the room-metadata service
enable-live-room = false
}
recording {
multi-track-recorder-url-template = "wss://example.com/recorder/MEETING_ID"
}

xmpp {
// Whether to use JitsiXmppStringprep to validate JIDs. If set to false uses the default validation in Smack.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.jivesoftware.smackx.caps.packet.*;
import org.jxmpp.jid.*;

import java.net.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
Expand Down Expand Up @@ -328,12 +329,15 @@ private ColibriSessionManager getColibriSessionManager()
{
// We initialize colibriSessionManager only after having joined the room, so meetingId must be set.
String meetingId = Objects.requireNonNull(this.meetingId);
URI multiTrackRecorderUrl = RecordingConfig.config.multiTrackRecorderUrl(meetingId);
// TODO update presence to reflect
colibriSessionManager = new ColibriV2SessionManager(
jicofoServices.getXmppServices().getServiceConnection().getXmppConnection(),
jicofoServices.getBridgeSelector(),
getRoomName().toString(),
meetingId,
config.getRtcStatsEnabled(),
multiTrackRecorderUrl,
jvbVersion,
logger);
colibriSessionManager.addListener(colibriSessionManagerListener);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jitsi-xmpp-extensions</artifactId>
<version>1.0-80-g0ce9883</version>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down

0 comments on commit 36cea4f

Please sign in to comment.