diff sat/plugins/plugin_xep_0260.py @ 4044:3900626bc100

plugin XEP-0166: refactoring, and various improvments: - add models for transport and applications handlers and linked data - split models into separate file - some type hints - some documentation comments - add actions to prepare confirmation, useful to do initial parsing of all contents - application arg/kwargs and some transport data can be initialised during Jingle `initiate` call, this is notably useful when a call is made with transport data (this is the call for A/V calls where codecs and ICE candidate can be specified when starting a call) - session data can be specified during Jingle `initiate` call - new `store_in_session` argument in `_parse_elements`, which can be used to avoid race-condition when a context element (<decription> or <transport>) is being parsed for an action while an other action happens (like `transport-info`) - don't sed `sid` in `transport_elt` during a `transport-info` action anymore in `build_action`: this is specific to Jingle File Transfer and has been moved there rel 419
author Goffi <goffi@goffi.org>
date Mon, 15 May 2023 16:23:11 +0200
parents 524856bd7b19
children
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0260.py	Mon May 15 16:20:58 2023 +0200
+++ b/sat/plugins/plugin_xep_0260.py	Mon May 15 16:23:11 2023 +0200
@@ -161,9 +161,11 @@
         cf XEP-0260 ยง 2.4
         """
         # now that the proxy is activated, we have to inform other peer
+        content_data = session["contents"][content_name]
         iq_elt, transport_elt = self._j.build_action(
             client, self._j.A_TRANSPORT_INFO, session, content_name
         )
+        transport_elt["sid"] = content_data["transport_data"]["sid"]
         activated_elt = transport_elt.addElement("activated")
         activated_elt["cid"] = candidate.id
         iq_elt.send()
@@ -175,9 +177,11 @@
         """
         # TODO: fallback to IBB
         # now that the proxy is activated, we have to inform other peer
+        content_data = session["contents"][content_name]
         iq_elt, transport_elt = self._j.build_action(
             client, self._j.A_TRANSPORT_INFO, session, content_name
         )
+        transport_elt["sid"] = content_data["transport_data"]["sid"]
         transport_elt.addElement("proxy-error")
         iq_elt.send()
         log.warning(
@@ -200,6 +204,7 @@
         @param client(unicode): %(doc_client)s
         """
 
+        content_data = session["contents"][content_name]
         transport_data["best_candidate"] = candidate
         # we need to disconnect all non selected candidates before removing them
         for c in transport_data["peer_candidates"]:
@@ -210,6 +215,7 @@
         iq_elt, transport_elt = self._j.build_action(
             client, self._j.A_TRANSPORT_INFO, session, content_name
         )
+        transport_elt["sid"] = content_data["transport_data"]["sid"]
         if candidate is None:
             log.warning("Can't connect to any peer candidate")
             candidate_elt = transport_elt.addElement("candidate-error")