@@ -89,31 +89,51 @@ For operating and deploying Element Call on your own server, refer to the
8989[ ** Self-Hosting Guide** ] ( ./docs/self-hosting.md ) .
9090
9191
92-
93- Element Call requires a Livekit SFU alongside a [ Livekit JWT
94- service] ( https://github.com/element-hq/lk-jwt-service ) to work. The url to the
95- Livekit JWT service can either be configured in the config of Element Call
96- (fallback/legacy configuration) or be configured by your homeserver via the
97- ` .well-known/matrix/client ` . This is the recommended method.
98-
99- The configuration is a list of Foci configs:
100-
101- ``` json
102- "org.matrix.msc4143.rtc_foci" : [
103- {
104- "type" : " livekit" ,
105- "livekit_service_url" : " https://someurl.com"
106- },
107- {
108- "type" : " livekit" ,
109- "livekit_service_url" : " https://livekit2.com"
110- },
111- {
112- "type" : " another_foci" ,
113- "props_for_another_foci" : " val"
114- },
115- ]
116- ```
92+ ## 🧭 MatrixRTC Backend Discovery and Selection
93+
94+ For proper Element Call operation each site deployment needs a MatrixRTC backend
95+ setup as outlined in the [ Self-Hosting] ( #self-hosting ) . A typical federated site
96+ deployment for three different sites A, B and C is depicted below.
97+
98+ ![ Element Call federated setup] ( ./docs/Federated_Setup.drawio.png )
99+
100+ ### Backend Discovery
101+
102+ MatrixRTC backend (according to
103+ [ MSC4143] ( https://github.com/matrix-org/matrix-spec-proposals/pull/4143 ) )
104+ is announced by the homeserver's ` .well-known/matrix/client ` file and discovered
105+ via the ` org.matrix.msc4143.rtc_foci ` key, e.g.:
106+ ``` json
107+ "org.matrix.msc4143.rtc_foci" : [
108+ {
109+ "type" : " livekit" ,
110+ "livekit_service_url" : " https://someurl.com"
111+ },
112+ ]
113+ ```
114+ where the format for MatrixRTC using LiveKit backend is defined in
115+ [ MSC4195] ( https://github.com/hughns/matrix-spec-proposals/blob/hughns/matrixrtc-livekit/proposals/4195-matrixrtc-livekit.md ) .
116+ In the example above Matrix clients do discover a focus of type ` livekit ` which
117+ points them to a Matrix LiveKit JWT Auth Service via ` livekit_service_url ` .
118+
119+ ### Backend Selection
120+
121+ - Each call participant proposes their discovered MatrixRTC backend from
122+ ` org.matrix.msc4143.rtc_foci ` in their ` org.matrix.msc3401.call.member ` state event.
123+ - For ** LiveKit** MatrixRTC backend
124+ ([ MSC4195] ( https://github.com/hughns/matrix-spec-proposals/blob/hughns/matrixrtc-livekit/proposals/4195-matrixrtc-livekit.md ) ),
125+ the ** first participant who joined the call** defines via the ` foci_preferred `
126+ key in their ` org.matrix.msc3401.call.member ` which actual MatrixRTC backend
127+ will be used for this call.
128+ - During the actual call join flow, the ** LiveKit JWT Auth Service** provides
129+ the client with the ** LiveKit SFU WebSocket URL** and an ** access JWT token**
130+ in order to exchange media via WebRTC.
131+
132+ The example below illustrates how backend selection works across ** Matrix
133+ federation** , using the setup from sites A, B, and C. It demonstrates backend
134+ selection for ** Matrix rooms 123 and 456** , which include users from different
135+ homeservers.
136+ ![ Element Call SFU selection over Matrix federation] ( ./docs/SFU_selection.drawio.png )
117137
118138## Translation
119139
0 commit comments