Mercurial > libervia-backend
comparison libervia/backend/plugins/plugin_xep_0167/__init__.py @ 4115:0da563780ffc
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
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 16 Aug 2023 18:33:28 +0200 |
parents | bc60875cb3b8 |
children | 23fa52acf72c |
comparison
equal
deleted
inserted
replaced
4114:79ec7d7beef3 | 4115:0da563780ffc |
---|---|
385 raise e | 385 raise e |
386 | 386 |
387 if not accepted: | 387 if not accepted: |
388 raise exceptions.CancelError("User declined the incoming call.") | 388 raise exceptions.CancelError("User declined the incoming call.") |
389 | 389 |
390 async def jingle_preflight_info( | |
391 self, | |
392 client: SatXMPPEntity, | |
393 session: dict, | |
394 info_type: str, | |
395 info_data: dict|None = None | |
396 ) -> None: | |
397 if info_type == "ringing": | |
398 if not session.get("ringing", False): | |
399 self.host.bridge.call_info( | |
400 session["id"], "ringing", "", client.profile | |
401 ) | |
402 # we indicate that the ringing has started, to avoid sending several times | |
403 # the signal | |
404 session["ringing"] = True | |
405 else: | |
406 log.warning(f"Unknown preflight info type: {info_type!r}") | |
407 | |
390 async def jingle_preflight_cancel( | 408 async def jingle_preflight_cancel( |
391 self, | 409 self, |
392 client: SatXMPPEntity, | 410 client: SatXMPPEntity, |
393 session: dict, | 411 session: dict, |
394 cancel_error: exceptions.CancelError | 412 cancel_error: exceptions.CancelError |