bbb-conf --set-port-range writes port values as YAML strings, so mediasoup ignores the configured range
Title
bbb-conf --set-port-range writes port values as YAML strings, so mediasoup ignores the configured range
Describe the bug
On BBB 3.0, bbb-conf --set-port-range MIN-MAX writes the mediasoup port range to
/etc/bigbluebutton/bbb-webrtc-sfu/production.yml as quoted strings:
mediasoup:
worker:
rtcMinPort: "50000"
rtcMaxPort: "58999"With string values, the mediasoup workers are spawned without --rtcMinPort / --rtcMaxPort,
and mediasoup falls back to its internal default range. ICE candidates are then announced on ports
outside the configured range (e.g. 33394, 38744, 49980), which breaks media on servers behind a
firewall/NAT that only forwards the configured range.
bbb-conf --check still reports the configured range, which makes this hard to spot.
Root cause
In bigbluebutton-config/bin/bbb-conf (main), the --set-port-range block uses escaped quotes
with yq v4, which forces the string type:
yq e -i ".mediasoup.worker.rtcMinPort = \"$START_PORT\"" $WEBRTC_SFU_ETC_CONFIG
yq e -i ".mediasoup.worker.rtcMaxPort = \"$END_PORT\"" $WEBRTC_SFU_ETC_CONFIGThe same pattern is used for bbb-webrtc-recorder (.webrtc.rtcMinPort/rtcMaxPort) and
LiveKit (.rtc.port_range_start/port_range_end). I have only verified the mediasoup case,
but those services likely expect integers as well.
The older yq v3 version of this code (yq w -i ... mediasoup.worker.rtcMinPort $START_PORT)
wrote integers and did not have this problem.
To reproduce
sudo bbb-conf --set-port-range 50000-58999sudo bbb-conf --restartgrep -nE 'rtcMinPort|rtcMaxPort' /etc/bigbluebutton/bbb-webrtc-sfu/production.yml→ values are quoted.ps -ef | grep mediasoup-worker→ no--rtcMinPort/--rtcMaxPortarguments.sudo ss -ulpn | grep mediasoup→ sockets bound outside 50000–58999.
Expected behavior
Port values are written as integers and mediasoup workers start with
--rtcMinPort=50000 --rtcMaxPort=58999.
Workaround
Remove the quotes and restart the SFU:
sudo sed -i -E 's/(rtc(Min|Max)Port: )"([0-9]+)"/\1\3/' /etc/bigbluebutton/bbb-webrtc-sfu/production.yml
sudo systemctl restart bbb-webrtc-sfuAfter this, the workers start with the correct flags and ICE candidates use the configured range.
Suggested fix
Drop the escaped quotes so yq v4 writes integers:
- yq e -i ".mediasoup.worker.rtcMinPort = \"$START_PORT\"" $WEBRTC_SFU_ETC_CONFIG
- yq e -i ".mediasoup.worker.rtcMaxPort = \"$END_PORT\"" $WEBRTC_SFU_ETC_CONFIG
+ yq e -i ".mediasoup.worker.rtcMinPort = $START_PORT" $WEBRTC_SFU_ETC_CONFIG
+ yq e -i ".mediasoup.worker.rtcMaxPort = $END_PORT" $WEBRTC_SFU_ETC_CONFIG
- yq e -i ".webrtc.rtcMinPort = \"$START_PORT\"" $WEBRTC_RECORDER_DEFAULT_CONFIG
- yq e -i ".webrtc.rtcMaxPort = \"$END_PORT\"" $WEBRTC_RECORDER_DEFAULT_CONFIG
+ yq e -i ".webrtc.rtcMinPort = $START_PORT" $WEBRTC_RECORDER_DEFAULT_CONFIG
+ yq e -i ".webrtc.rtcMaxPort = $END_PORT" $WEBRTC_RECORDER_DEFAULT_CONFIG
- yq e -i ".rtc.port_range_start = \"$START_PORT\"" $LIVEKIT_SERVER_ETC_CONFIG
- yq e -i ".rtc.port_range_end = \"$END_PORT\"" $LIVEKIT_SERVER_ETC_CONFIG
+ yq e -i ".rtc.port_range_start = $START_PORT" $LIVEKIT_SERVER_ETC_CONFIG
+ yq e -i ".rtc.port_range_end = $END_PORT" $LIVEKIT_SERVER_ETC_CONFIGSide note: the recorder range is written to the package default file
(/etc/bbb-webrtc-recorder/bbb-webrtc-recorder.yml) instead of the override
(/etc/bigbluebutton/bbb-webrtc-recorder.yml), so a package upgrade may revert it.
Environment
- BigBlueButton 3.0.26
- Ubuntu 22.04.5 LTS
- Server behind NAT (private IP + public IP on
lo), only a custom UDP range forwarded
Source: bigbluebutton/bigbluebutton