diff --git a/libervia/backend/plugins/plugin_xep_0176.py b/libervia/backend/plugins/plugin_xep_0176.py index 003c48f4..bea7b6af 100644 --- a/libervia/backend/plugins/plugin_xep_0176.py +++ b/libervia/backend/plugins/plugin_xep_0176.py @@ -95,7 +95,7 @@ class XEP_0176(BaseTransportHandler): ) ) - def build_transport(self, ice_data: dict) -> domish.Element: + def build_transport(self, ice_data: dict, add_trickle: bool = False) -> domish.Element: """Generate element from ICE data @param ice_data: a dict containing the following keys: @@ -153,6 +153,11 @@ class XEP_0176(BaseTransportHandler): candidate_elt["rel-addr"] = candidate["rel_addr"] candidate_elt["rel-port"] = str(candidate["rel_port"]) + if add_trickle: + transport_elt.addElement( + ("http://gultsch.de/xmpp/drafts/jingle/transports/ice-udp/option", "trickle") + ) + self.host.trigger.point("XEP-0176_build_transport", transport_elt, ice_data) return transport_elt @@ -228,7 +233,7 @@ class XEP_0176(BaseTransportHandler): content_data = session["contents"][content_name] transport_data = content_data["transport_data"] ice_data = transport_data["local_ice_data"] - return self.build_transport(ice_data) + return self.build_transport(ice_data, add_trickle=True) async def _send_ice_buffer( self, @@ -320,8 +325,11 @@ class XEP_0176(BaseTransportHandler): elif action == self._j.A_SESSION_INITIATE: # responder side, we give our candidates - transport_elt = self.build_transport(transport_data["local_ice_data"]) + transport_elt = self.build_transport( + transport_data["local_ice_data"], add_trickle=True + ) elif action == self._j.A_TRANSPORT_INFO: + if session["state"] == self._j.STATE_PENDING: # Session is not yet active; we buffer the arguments to replay them # when the session becomes active. This makes the frontend's life easier.