Skip to content

Commit e66c44d

Browse files
committed
Introduce bbb_config_webrtc_sfu_* and use it to configure livekit dialin.
Dial-in does not actually work, this is just for preparation once it is ready to use upstream.
1 parent c3e58f0 commit e66c44d

File tree

7 files changed

+96
-47
lines changed

7 files changed

+96
-47
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,9 @@ This role generates configuration with sensible defaults out of the box and cove
425425
* **`bbb_config_presentation`** (default: `{}`)\
426426
Custom overrides for `/etc/bigbluebutton/recording/presentation.yml`. This will be deep-merged into the role-managed configuration. List values will not be merged, but replaced.
427427

428+
* **`bbb_config_webrtc_sfu`** (default: `{}`)\
429+
Custom overrides for `/etc/bigbluebutton/bbb-webrtc-sfu/production.yml`. This will be deep-merged into the role-managed configuration. List values will not be merged, but replaced.
430+
428431

429432
### Other stuff not full migrated to BBB 3.0 yet.
430433

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ bbb_config_web: {} # bbb-web.properties
9191
bbb_config_html5: {} # bbb-html5.yml
9292
bbb_config_etherpad: {} # etherpad.json
9393
bbb_config_presentation: {} # recording/presentation.yml
94+
bbb_config_webrtc_sfu: {} # bbb-webrtc-sfu/production.yml
9495

9596
### STUN/TURN Servers
9697

tasks/configure-freeswitch.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
owner: freeswitch
9393
group: daemon
9494
mode: "0600"
95-
with_items:
95+
loop:
9696
- /opt/freeswitch/etc/freeswitch/vars.xml
9797
- /opt/freeswitch/etc/freeswitch/autoload_configs/event_socket.conf.xml
9898

@@ -168,7 +168,7 @@
168168

169169
- name: Deploy dial-in config files
170170
become: true
171-
when: bbb_dialin_enable
171+
when: bbb_dialin_enable and not bbb_livekit_enable
172172
ansible.builtin.template:
173173
src: "dial-in/{{ item.src }}.j2"
174174
dest: "/opt/freeswitch/conf/{{ item.dest }}"
@@ -184,7 +184,7 @@
184184

185185
- name: Remove unused dial-in config files
186186
become: true
187-
when: not bbb_dialin_enable
187+
when: not bbb_dialin_enable or bbb_livekit_enable
188188
ansible.builtin.file:
189189
path: "/opt/freeswitch/conf/{{ item.dest }}"
190190
state: absent

tasks/configure-livekit.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
---
2+
# https://github.com/bigbluebutton/bigbluebutton/issues/23247
23
- name: Ensure livekit-sip service state
34
when: bbb_livekit_enable
45
become: true
56
ansible.builtin.service:
67
name: livekit-sip
78
enabled: "{{ bbb_dialin_enable }}"
89
state: "{{ bbb_dialin_enable | ternary('started', 'stopped') }}"
10+
11+
- name: Stop freeswitch if livekit is used
12+
become: true
13+
ansible.builtin.service:
14+
name: "{{ item }}"
15+
enabled: "{{ not bbb_livekit_enable }}"
16+
state: "{{ bbb_livekit_enable | ternary('stopped', 'started') }}"
17+
loop:
18+
- freeswitch
19+

tasks/mixin-livekit.yml

Lines changed: 60 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,63 @@
11
---
2-
- when: bbb_livekit_enable
3-
block:
4-
- name: Update bbb-web for livekit
5-
ansible.builtin.set_fact:
6-
bbb_config_web_base: |
7-
{{bbb_config_web_base | combine({
8-
"audioBridge": "livekit",
9-
"cameraBridge": "livekit",
10-
"screenShareBridge": "livekit"
11-
})}}
2+
- name: Update base configuration for livekit
3+
when: bbb_livekit_enable
4+
ansible.builtin.set_fact:
5+
bbb_config_web_base: |
6+
{{bbb_config_web_base | combine({
7+
"audioBridge": "livekit",
8+
"cameraBridge": "livekit",
9+
"screenShareBridge": "livekit"
10+
})}}
11+
bbb_config_webrtc_sfu_base: |
12+
{{bbb_config_webrtc_sfu_base | combine({
13+
"livekit": {
14+
"enabled": True,
15+
"key": bbb_livekit_api_key,
16+
"secret": bbb_livekit_api_secret,
17+
}
18+
})}}
1219
13-
- name: Update html5 for livekit
14-
when: bbb_cluster_proxy is defined
15-
ansible.builtin.set_fact:
16-
bbb_config_html5_base: |
17-
{{bbb_config_html5_base | combine({
18-
'public': {
19-
'media': {
20-
'livekit': {
21-
'url': 'wss://'+bbb_hostname+'/livekit'
22-
}
23-
}
20+
- name: Update html5 config for livekit with proxy mode
21+
when: bbb_livekit_enable and bbb_cluster_proxy is defined
22+
ansible.builtin.set_fact:
23+
bbb_config_html5_base: |
24+
{{bbb_config_html5_base | combine({
25+
'public': {
26+
'media': {
27+
'livekit': {
28+
'url': 'wss://'+bbb_hostname+'/livekit'
2429
}
25-
}, recursive=True)}}
30+
}
31+
}
32+
}, recursive=True)}}
33+
34+
# TODO: Does not work yet!
35+
- name: Update webrtc-sfu for livekit with dialin
36+
when: bbb_livekit_enable and bbb_dialin_enable
37+
ansible.builtin.set_fact:
38+
bbb_config_webrtc_sfu_base: |
39+
{{bbb_config_webrtc_sfu_base | combine(_bbb_config_webrtc_sfu_patch, recursive=True)}}
40+
vars:
41+
_bbb_config_webrtc_sfu_patch:
42+
livekit:
43+
rtcAgent:
44+
enabled: true
45+
sip:
46+
enabled: true
47+
requirePin: true
48+
trunk:
49+
# See https://docs.livekit.io/server-sdk-js/interfaces/CreateSipInboundTrunkOptions.html
50+
options:
51+
allowedAddresses:
52+
- "{{ bbb_dialin_provider }}"
53+
allowedNumbers:
54+
- "{{ bbb_dialin_provider_extension }}"
55+
authUsername: "{{ bbb_dialin_provider_username }}"
56+
authPassword: "{{ bbb_dialin_provider_password }}"
57+
dispatch:
58+
# See https://docs.livekit.io/reference/server-sdk-js/interfaces/CreateSipDispatchRuleOptions.html
59+
options:
60+
#attributes: {}
61+
hidePhoneNumber: "{{ bbb_dialin_mask_caller }}"
62+
#roomConfig: {}
63+
#roomPreset: 'default'
Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,2 @@
1-
---
2-
# {{ansible_managed}}
3-
freeswitch:
4-
ip: "{{ bbb_public_ip4 }}"
5-
sip_ip: "127.0.0.1"
6-
esl_ip: "127.0.0.1"
7-
esl_password: "{{ bbb_freeswitch_socket_password }}"
8-
mediasoup:
9-
webrtc:
10-
listenIps:
11-
- ip: "{{ bbb_bind_ip4 }}"
12-
announcedIp: "{{ bbb_public_ip4 }}"
13-
plainRtp:
14-
listenIp:
15-
ip: "{{ bbb_bind_ip4 }}"
16-
announcedIp: "{{ bbb_public_ip4 }}"
17-
{% if bbb_livekit_enable %}
18-
livekit:
19-
key: {{ bbb_livekit_api_key }}
20-
secret: {{ bbb_livekit_api_secret }}
21-
enabled: true
22-
{% endif %}
1+
# {{ansible_managed}}
2+
{{ {} | combine(bbb_config_webrtc_sfu_base, bbb_config_webrtc_sfu, recursive=True) | to_nice_yaml}}

vars/main.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,22 @@ bbb_config_html5_base:
172172
pads:
173173
url: "https://{{ bbb_hostname }}/pad"
174174

175+
bbb_config_webrtc_sfu_base:
176+
freeswitch:
177+
ip: "{{ bbb_public_ip4 }}"
178+
sip_ip: "127.0.0.1"
179+
esl_ip: "127.0.0.1"
180+
esl_password: "{{ bbb_freeswitch_socket_password }}"
181+
mediasoup:
182+
webrtc:
183+
listenIps:
184+
- ip: "{{ bbb_bind_ip4 }}"
185+
announcedIp: "{{ bbb_public_ip4 }}"
186+
plainRtp:
187+
listenIp:
188+
ip: "{{ bbb_bind_ip4 }}"
189+
announcedIp: "{{ bbb_public_ip4 }}"
190+
175191
bbb_config_etherpad_base: {}
176192
bbb_nginx_root: /var/www/bigbluebutton-default/assets
177193
bbb_host_seed: "{{ (bbb_hostname + bbb_secret_seed) | hash('sha256') }}"

0 commit comments

Comments
 (0)