Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config to tell JVBs to use SCTP datachannels for relay-to-relay bridge channels. #1051

Merged
merged 2 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions jicofo-common/src/main/kotlin/org/jitsi/jicofo/OctoConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class OctoConfig {
"jicofo.octo.allow-mixed-versions".from(newConfig)
}

val sctpChannels: Boolean by config {
"jicofo.octo.sctp-channels".from(newConfig)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't match reference.conf (it uses "sctp-datachannels")

}

companion object {
@JvmField
val config = OctoConfig()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.jitsi.jicofo.bridge.colibri

import org.jitsi.jicofo.OctoConfig
import org.jitsi.jicofo.bridge.Bridge
import org.jitsi.jicofo.bridge.CascadeLink
import org.jitsi.jicofo.bridge.CascadeNode
Expand Down Expand Up @@ -326,7 +327,8 @@ class Colibri2Session(
private val useUniquePort = initiator
private val iceControlling = initiator
private val dtlsSetup = if (initiator) "active" else "passive"
private val websocketActive = initiator
private val bridgeChannelActive = initiator
private val sctpBridgeChannel = OctoConfig.config.sctpChannels

private val logger = createChildLogger(this@Colibri2Session.logger).apply { addContext("relay", relayId) }

Expand Down Expand Up @@ -382,10 +384,11 @@ class Colibri2Session(
logger.info("Setting setup=$dtlsSetup for $relayId")
it.setup = dtlsSetup
}
// We always expect the bridge to advertise a websocket, but we want only one side to act as a client.
// The bridge always advertises a websocket if we're not using SCTP, but we want only one side to act as a
// client.
// The bridge will always act as a client if the signaled transport includes a websocket, so here we make
// sure it is only included to one of the sides.
if (!websocketActive) {
if (sctpBridgeChannel || !bridgeChannelActive) {
transport.getChildExtensionsOfType(WebSocketPacketExtension::class.java).forEach {
transport.removeChildExtension(it)
}
Expand All @@ -407,7 +410,8 @@ class Colibri2Session(
put("use_unique_port", useUniquePort)
put("ice_controlling", iceControlling)
put("dtls_setup", dtlsSetup)
put("websocket_active", websocketActive)
put("bridge_channel_active", bridgeChannelActive)
put("sctp_bridge_channel", sctpBridgeChannel)
meshId?.let { put("mesh_id", it) }
}

Expand Down Expand Up @@ -484,6 +488,11 @@ class Colibri2Session(
Transport.getBuilder().apply {
setUseUniquePort(useUniquePort)
setIceControlling(iceControlling)
if (sctpBridgeChannel) {
val sctp = Sctp.Builder()
sctp.setRole(if (bridgeChannelActive) Sctp.Role.CLIENT else Sctp.Role.SERVER)
setSctp(sctp.build())
}
}.build()
)

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 @@ -320,6 +320,9 @@ jicofo {

// Whether to allow bridges with different versions to be used in the same conference. Intended only for testing.
allow-mixed-versions = false

// Whether bridge-to-bridge communication should use SCTP datachannels (as opposed to websockets)
sctp-datachannels = false
}

rest {
Expand Down