Mercurial > libervia-web
comparison 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 |
comparison
equal
deleted
inserted
replaced
1559:410064b31dca | 1560:84f312be53b4 |
---|---|
12 | 12 |
13 log.warning = log.warn | 13 log.warning = log.warn |
14 profile = window.profile or "" | 14 profile = window.profile or "" |
15 bridge = Bridge() | 15 bridge = Bridge() |
16 GATHER_TIMEOUT = 10000 | 16 GATHER_TIMEOUT = 10000 |
17 ALLOWED_STATUSES = (None, "dialing") | 17 ALLOWED_STATUSES = (None, "dialing", "ringing") |
18 AUDIO = "audio" | 18 AUDIO = "audio" |
19 VIDEO = "video" | 19 VIDEO = "video" |
20 ALLOWED_CALL_MODES = {AUDIO, VIDEO} | 20 ALLOWED_CALL_MODES = {AUDIO, VIDEO} |
21 INACTIVE_CLASS = "inactive" | 21 INACTIVE_CLASS = "inactive" |
22 MUTED_CLASS = "muted" | 22 MUTED_CLASS = "muted" |
38 self.call_status_wrapper_elt = document["call_status_wrapper"] | 38 self.call_status_wrapper_elt = document["call_status_wrapper"] |
39 self.call_avatar_tpl = Template("call/call_avatar.html") | 39 self.call_avatar_tpl = Template("call/call_avatar.html") |
40 self.call_status_tpl = Template("call/call_status.html") | 40 self.call_status_tpl = Template("call/call_status.html") |
41 self.audio_player_elt = document["audio_player"] | 41 self.audio_player_elt = document["audio_player"] |
42 bridge.register_signal("action_new", self._on_action_new) | 42 bridge.register_signal("action_new", self._on_action_new) |
43 bridge.register_signal("call_info", self._on_call_info) | |
43 bridge.register_signal("call_setup", self._on_call_setup) | 44 bridge.register_signal("call_setup", self._on_call_setup) |
44 bridge.register_signal("call_ended", self._on_call_ended) | 45 bridge.register_signal("call_ended", self._on_call_ended) |
45 | 46 |
46 # call/hang up buttons | 47 # call/hang up buttons |
47 self._call_mode = VIDEO | 48 self._call_mode = VIDEO |
223 f"ignoring call_ended not linked to our call ({self.sid}): {session_id}" | 224 f"ignoring call_ended not linked to our call ({self.sid}): {session_id}" |
224 ) | 225 ) |
225 return | 226 return |
226 aio.run(self.end_call(json.loads(data_s))) | 227 aio.run(self.end_call(json.loads(data_s))) |
227 | 228 |
229 def _on_call_info(self, session_id: str, info_type, info_data_s: str, profile: str): | |
230 if self.sid != session_id: | |
231 return | |
232 if info_type == "ringing": | |
233 self.status = "ringing" | |
234 | |
228 def _on_call_setup(self, session_id: str, setup_data_s: str, profile: str) -> None: | 235 def _on_call_setup(self, session_id: str, setup_data_s: str, profile: str) -> None: |
229 """Called when we have received answer SDP from responder | 236 """Called when we have received answer SDP from responder |
230 | 237 |
231 @param session_id: Session identifier | 238 @param session_id: Session identifier |
232 @param sdp: Session Description Protocol data | 239 @param sdp: Session Description Protocol data |