changeset 4277:b4b4ea8c5c87

plugin XEP-0167: Let use a `call_setup_cb` method in session: when set, the `call_setup_cb` method will be used instead of calling the `call_setup` bridge signal. This will be useful to incoming `Conferences` component to handle the signaling internally. rel 445
author Goffi <goffi@goffi.org>
date Fri, 05 Jul 2024 17:18:37 +0200
parents 00a9316547ed
children 240d8b7ad906
files libervia/backend/plugins/plugin_xep_0167/__init__.py libervia/backend/plugins/plugin_xep_0338.py
diffstat 2 files changed, 22 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_xep_0167/__init__.py	Fri Jul 05 17:18:37 2024 +0200
+++ b/libervia/backend/plugins/plugin_xep_0167/__init__.py	Fri Jul 05 17:18:37 2024 +0200
@@ -51,6 +51,7 @@
     C.PI_NAME: "Jingle RTP Sessions",
     C.PI_IMPORT_NAME: "XEP-0167",
     C.PI_TYPE: "XEP",
+    C.PI_MODES: C.PLUG_MODE_BOTH,
     C.PI_PROTOCOLS: ["XEP-0167"],
     C.PI_DEPENDENCIES: ["XEP-0166"],
     C.PI_MAIN: "XEP_0167",
@@ -502,19 +503,30 @@
         # we should have the answer long before 2 min
         answer_sdp_d.addTimeout(2 * 60, reactor)
 
-        self.host.bridge.call_setup(
-            session["id"],
-            data_format.serialise(
+        call_setup = session.get("call_setup_cb")
+
+        if call_setup is None:
+            self.host.bridge.call_setup(
+                session["id"],
+                data_format.serialise(
+                    {
+                        "role": session["role"],
+                        "sdp": sdp,
+                    }
+                ),
+                client.profile,
+            )
+        else:
+            await call_setup(
+                client,
+                session,
                 {
                     "role": session["role"],
                     "sdp": sdp,
-                }
-            ),
-            client.profile,
-        )
+                },
+            )
 
         answer_sdp = await answer_sdp_d
-
         parsed_answer = mapping.parse_sdp(answer_sdp, session["role"])
         session["metadata"].update(parsed_answer["metadata"])
         self.propagate_data(session, parsed_answer)
@@ -583,7 +595,7 @@
         else:
             log.warning(f"FIXME: unmanaged action {action}")
 
-        self.host.trigger.point(
+        await self.host.trigger.async_point(
             "XEP-0167_jingle_handler",
             client,
             action,
--- a/libervia/backend/plugins/plugin_xep_0338.py	Fri Jul 05 17:18:37 2024 +0200
+++ b/libervia/backend/plugins/plugin_xep_0338.py	Fri Jul 05 17:18:37 2024 +0200
@@ -132,7 +132,7 @@
             jingle_elt = session["jingle_elt"]
             self.add_group_element(jingle_elt, session)
 
-    def _jingle_handler_trigger(
+    async def _jingle_handler_trigger(
         self,
         client: SatXMPPEntity,
         action: str,