diff libervia/web/pages/calls/_browser/__init__.py @ 1560:84f312be53b4

browser (calls): handle "ringing" info message and update status when received
author Goffi <goffi@goffi.org>
date Wed, 16 Aug 2023 18:34:07 +0200
parents 855729ef75f2
children 7dbb131bbb9e
line wrap: on
line diff
--- a/libervia/web/pages/calls/_browser/__init__.py	Wed Aug 16 16:52:53 2023 +0200
+++ b/libervia/web/pages/calls/_browser/__init__.py	Wed Aug 16 18:34:07 2023 +0200
@@ -14,7 +14,7 @@
 profile = window.profile or ""
 bridge = Bridge()
 GATHER_TIMEOUT = 10000
-ALLOWED_STATUSES = (None, "dialing")
+ALLOWED_STATUSES = (None, "dialing", "ringing")
 AUDIO = "audio"
 VIDEO = "video"
 ALLOWED_CALL_MODES = {AUDIO, VIDEO}
@@ -40,6 +40,7 @@
         self.call_status_tpl = Template("call/call_status.html")
         self.audio_player_elt = document["audio_player"]
         bridge.register_signal("action_new", self._on_action_new)
+        bridge.register_signal("call_info", self._on_call_info)
         bridge.register_signal("call_setup", self._on_call_setup)
         bridge.register_signal("call_ended", self._on_call_ended)
 
@@ -225,6 +226,12 @@
             return
         aio.run(self.end_call(json.loads(data_s)))
 
+    def _on_call_info(self, session_id: str, info_type, info_data_s: str, profile: str):
+        if self.sid != session_id:
+            return
+        if info_type == "ringing":
+            self.status = "ringing"
+
     def _on_call_setup(self, session_id: str, setup_data_s: str, profile: str) -> None:
         """Called when we have received answer SDP from responder