Skip to content

Commit

Permalink
Add a colibri flag to use private addresses for ICE for jigasi/jibri. (
Browse files Browse the repository at this point in the history
…#1112)

* Add a colibri flag to use private addresses for ICE for jigasi/jibri.

* Make private addresses for jigasi/jibri configurable.
  • Loading branch information
bgrozev authored Sep 13, 2023
1 parent 42dd079 commit 4aceabd
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,6 @@ data class ParticipantAllocationParameters(
val forceMuteVideo: Boolean,
val useSctp: Boolean,
val visitor: Boolean,
val supportsPrivateAddresses: Boolean,
val medias: Set<Media>
)
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ internal fun ParticipantInfo.toEndpoint(
if (supportsSourceNames) {
addCapability(Capability.CAP_SOURCE_NAME_SUPPORT)
}
if (supportsPrivateAddresses) {
addCapability(Capability.CAP_PRIVATE_ADDRESS_CONNECTIVITY)
}
if (useSsrcRewriting) {
addCapability(Capability.CAP_SSRC_REWRITING_SUPPORT)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class ParticipantInfo(
val useSctp = parameters.useSctp
val medias = parameters.medias
val supportsSourceNames = parameters.supportsSourceNames
val supportsPrivateAddresses = parameters.supportsPrivateAddresses
val useSsrcRewriting = parameters.useSsrcRewriting
val visitor = parameters.visitor

Expand All @@ -46,6 +47,7 @@ class ParticipantInfo(
put("audio_muted", audioMuted)
put("video_muted", videoMuted)
put("source_names", supportsSourceNames)
put("private_addresses", supportsPrivateAddresses)
put("ssrc_rewriting", useSsrcRewriting)
put("visitor", visitor)
}
Expand Down
6 changes: 6 additions & 0 deletions jicofo-selector/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ jicofo {
// Note that if no separate Service connection has been configured, all services will automatically use the
// Client connection.
xmpp-connection-name = Client

// Enable use of private addresses for ICE for jibri
use-private-address-connectivity = true
}

jibri-sip {
Expand All @@ -306,6 +309,9 @@ jicofo {
// Note that if no separate Service connection has been configured, all services will automatically use the
// Client connection.
xmpp-connection-name = Client

// Enable use of private addresses for ICE for jigasi
use-private-address-connectivity = true
}

// The region in which the machine is running.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.jitsi.jicofo.bridge.colibri.*;
import org.jitsi.jicofo.codec.*;
import org.jitsi.jicofo.conference.source.*;
import org.jitsi.jicofo.jibri.*;
import org.jitsi.jicofo.jigasi.*;
import org.jitsi.jicofo.util.*;
import org.jitsi.jicofo.xmpp.jingle.*;
import org.jitsi.jicofo.xmpp.muc.*;
Expand Down Expand Up @@ -188,6 +190,12 @@ private void doRun()
logger.warn("Failed to convert ContentPacketExtension to Media: " + content.toXML());
}
});
// This makes the bridge signal its private host candidates. We enable them for backend components, because
// they may be in the same network as the bridge, and disable them for endpoints to avoid checking
// unnecessary pairs (unless the endpoints explicitly signal the feature).
boolean privateAddresses =
(participant.getChatMember().isJigasi() && JigasiConfig.config.getPrivateAddressConnectivity()) ||
(participant.getChatMember().isJibri() && JibriConfig.config.getPrivateAddressConnectivity());
ParticipantAllocationParameters participantOptions = new ParticipantAllocationParameters(
participant.getEndpointId(),
participant.getStatId(),
Expand All @@ -199,6 +207,7 @@ private void doRun()
forceMuteVideo,
offer.getContents().stream().anyMatch(c -> c.getName() == "data"),
(participant.getChatMember().getRole() == MemberRole.VISITOR),
privateAddresses,
medias);
colibriAllocation = colibriSessionManager.allocate(participantOptions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ open class Participant @JvmOverloads constructor(
private val jingleIqRequestHandler: JingleIqRequestHandler,
parentLogger: Logger? = null,
/** The list of XMPP features supported by this participant. */
private val supportedFeatures: Set<Features> = Features.defaultFeatures,
val supportedFeatures: Set<Features> = Features.defaultFeatures,
/** The [Clock] used by this participant. */
clock: Clock = Clock.systemUTC()
) {
Expand Down
4 changes: 4 additions & 0 deletions jicofo/src/main/kotlin/org/jitsi/jicofo/jibri/JibriConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class JibriConfig private constructor() {
"jicofo.jibri.xmpp-connection-name".from(newConfig)
}

val privateAddressConnectivity: Boolean by config {
"jicofo.jibri.use-private-address-connectivity".from(newConfig)
}

companion object {
@JvmField
val config = JibriConfig()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ class JigasiConfig private constructor() {
"jicofo.jigasi.xmpp-connection-name".from(newConfig)
}

val privateAddressConnectivity: Boolean by config {
"jicofo.jigasi.use-private-address-connectivity".from(newConfig)
}

fun xmppConnectionName() = xmppConnectionName

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class ParticipantInviteRunnableTest : ShouldSpec({
every { statsId } returns "statsId"
every { region } returns "region"
every { isJibri } returns false
every { isJigasi } returns false
every { isTranscriber } returns false
},
conference,
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jitsi-xmpp-extensions</artifactId>
<version>1.0-72-gc9dde6c</version>
<version>1.0-74-gc88e006</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down

0 comments on commit 4aceabd

Please sign in to comment.