plugin XEP-0167, XEP-0353: handle ringing:

- add a `jingle_preflight_info` method in the Jingle Application model to handle this kind
  of information
- XEP-0353 is calling `jingle_preflight_info` when a `ringing` message is received
- XEP-0167 use this information to send a `ringing` info to frontends
This commit is contained in:
Goffi 2023-08-16 18:33:28 +02:00
commit 09d88cdfe2

View file

@ -387,6 +387,24 @@ class XEP_0167(BaseApplicationHandler):
if not accepted:
raise exceptions.CancelError("User declined the incoming call.")
async def jingle_preflight_info(
self,
client: SatXMPPEntity,
session: dict,
info_type: str,
info_data: dict|None = None
) -> None:
if info_type == "ringing":
if not session.get("ringing", False):
self.host.bridge.call_info(
session["id"], "ringing", "", client.profile
)
# we indicate that the ringing has started, to avoid sending several times
# the signal
session["ringing"] = True
else:
log.warning(f"Unknown preflight info type: {info_type!r}")
async def jingle_preflight_cancel(
self,
client: SatXMPPEntity,