comparison libervia/backend/plugins/plugin_comp_conferences/__init__.py @ 4294:a0ed5c976bf8

component conferences, plugin XEP-0167, XEP-0298: add stream user metadata: A/V conference now adds user metadata about the stream it is forwarding through XEP-0298. This is parsed and added to metadata during confirmation on client side. rel 448
author Goffi <goffi@goffi.org>
date Tue, 06 Aug 2024 23:43:11 +0200
parents 96fdf4891747
children
comparison
equal deleted inserted replaced
4293:9447796408f6 4294:a0ed5c976bf8
234 """Called when a new SFP offer has been received""" 234 """Called when a new SFP offer has been received"""
235 defer.ensureDeferred(self.a_on_offer(data)) 235 defer.ensureDeferred(self.a_on_offer(data))
236 236
237 async def a_on_offer(self, data: dict) -> None: 237 async def a_on_offer(self, data: dict) -> None:
238 client: SatXMPPEntity = self.client.get_virtual_client(self.session["local_jid"]) 238 client: SatXMPPEntity = self.client.get_virtual_client(self.session["local_jid"])
239 call_data = {"sdp": data["sdp"]}
240 try:
241 # FIXME: This assume that all username are coming from XMPP, "source" should
242 # be used instead to be sure to match XMPP users, and other ones should use
243 # a non "xmpp:" URL scheme.
244 user_jid = jid.JID(data["username"])
245 if not user_jid.user:
246 raise ValueError("Missing user part.")
247 except Exception as e:
248 log.warning("Username is not a JID: {data['username']=}, {e}")
249 else:
250 call_data["metadata"] = {"user": user_jid}
239 sid = await self._rtp.call_start( 251 sid = await self._rtp.call_start(
240 client, 252 client,
241 self.session["peer_jid"], 253 self.session["peer_jid"],
242 {"sdp": data["sdp"]}, 254 call_data,
243 session_id=f"{self.client_id}-{data['id']}", 255 session_id=f"{self.client_id}-{data['id']}",
244 ) 256 )
245 session = self._j.get_session(client, sid) 257 session = self._j.get_session(client, sid)
246 session["call_setup_cb"] = self.on_call_setup 258 session["call_setup_cb"] = self.on_call_setup
247 259
545 557
546 def _galene_process_errback(self, failure_: Failure) -> None: 558 def _galene_process_errback(self, failure_: Failure) -> None:
547 log.error(f"Can't run Galene process: {failure_.value}") 559 log.error(f"Can't run Galene process: {failure_.value}")
548 560
549 561
550
551 @implementer(iwokkel.IDisco) 562 @implementer(iwokkel.IDisco)
552 class ConferencesHandler(XMPPHandler): 563 class ConferencesHandler(XMPPHandler):
553 564
554 def getDiscoInfo(self, requestor, target, nodeIdentifier=""): 565 def getDiscoInfo(self, requestor, target, nodeIdentifier=""):
555 return [disco.DiscoFeature(NS_AV_CONFERENCES)] 566 return [disco.DiscoFeature(NS_AV_CONFERENCES)]