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
This commit is contained in:
Goffi 2024-08-06 23:43:11 +02:00
commit 08e1409925

View file

@ -236,10 +236,22 @@ class Conference:
async def a_on_offer(self, data: dict) -> None:
client: SatXMPPEntity = self.client.get_virtual_client(self.session["local_jid"])
call_data = {"sdp": data["sdp"]}
try:
# FIXME: This assume that all username are coming from XMPP, "source" should
# be used instead to be sure to match XMPP users, and other ones should use
# a non "xmpp:" URL scheme.
user_jid = jid.JID(data["username"])
if not user_jid.user:
raise ValueError("Missing user part.")
except Exception as e:
log.warning("Username is not a JID: {data['username']=}, {e}")
else:
call_data["metadata"] = {"user": user_jid}
sid = await self._rtp.call_start(
client,
self.session["peer_jid"],
{"sdp": data["sdp"]},
call_data,
session_id=f"{self.client_id}-{data['id']}",
)
session = self._j.get_session(client, sid)
@ -547,7 +559,6 @@ class ConferencesComponent:
log.error(f"Can't run Galene process: {failure_.value}")
@implementer(iwokkel.IDisco)
class ConferencesHandler(XMPPHandler):