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
This commit is contained in:
Goffi 2024-07-05 17:18:37 +02:00
commit 63b50a2d27
2 changed files with 22 additions and 10 deletions

View file

@ -51,6 +51,7 @@ PLUGIN_INFO = {
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 @@ class XEP_0167(BaseApplicationHandler):
# 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 @@ class XEP_0167(BaseApplicationHandler):
else:
log.warning(f"FIXME: unmanaged action {action}")
self.host.trigger.point(
await self.host.trigger.async_point(
"XEP-0167_jingle_handler",
client,
action,

View file

@ -132,7 +132,7 @@ class XEP_0338:
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,