From 581e8073c534a06e0a847bba91873b611f8c0a1e Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Mon, 24 Nov 2025 11:38:19 +0100 Subject: [PATCH] Improved call status feedback and decreased call connect timeout --- sbapp/main.py | 17 +++++++++++------ sbapp/sideband/core.py | 5 +++-- sbapp/sideband/voice.py | 8 ++++++-- sbapp/ui/voice.py | 11 +++++++---- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/sbapp/main.py b/sbapp/main.py index 65ade54..0b4c163 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -1504,11 +1504,17 @@ class SidebandApp(MDApp): if service_voice_running: self.sideband.voice_running = True else: self.sideband.voice_running = False - incoming_call = self.sideband.getstate("voice.incoming_call") - if incoming_call: - self.sideband.setstate("voice.incoming_call", None) - if RNS.vendor.platformutils.is_android(): toast(f"Call from {incoming_call}") - else: toast(f"Call from {incoming_call}", duration=7) + if self.sideband.voice_running: + incoming_call = self.sideband.getstate("voice.incoming_call") + ended_call = self.sideband.getstate("voice.ongoing_ended") + if incoming_call: + self.sideband.setstate("voice.incoming_call", None) + dn = multilingual_markup(escape_markup(str(incoming_call)).encode("utf-8")).decode("utf-8") + toast(f"Call from {dn}", duration=4) + + if ended_call: + self.sideband.setstate("voice.ongoing_ended", False) + toast("Call ended", duration=4) if self.root.ids.screen_manager.current == "messages_screen": self.messages_view.update() @@ -5866,7 +5872,6 @@ class SidebandApp(MDApp): if self.sideband.voice_running: if self.sideband.telephone.is_ringing or self.sideband.telephone.is_in_call: self.sideband.telephone.hangup() - toast("Call ended") ### Telemetry Screen ###################################### diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index e84514c..4a33e77 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -5475,10 +5475,11 @@ class SidebandCore(): def missed_call(self, remote_identity): display_name = self.voice_display_name(remote_identity.hash) self.setstate("voice.missed_call", display_name) - # if self.gui_foreground(): RNS.log("Squelching call notification since GUI is in foreground", RNS.LOG_DEBUG) - # else: self.notify(title="Missed voice call", content=f"From {display_name}", group="LXST.Telephony", context_id="incoming_call") self.notify(title="Missed call", content=f"From {display_name}", group="lxst.telephony.call", context_id="incoming_call") + def ended_call(self, remote_identity): + self.setstate("voice.ongoing_ended", True) + rns_config = """# This template is used to generate a # running configuration for Sideband's # internal RNS instance. Incorrect changes diff --git a/sbapp/sideband/voice.py b/sbapp/sideband/voice.py index 1721a43..92dcabd 100644 --- a/sbapp/sideband/voice.py +++ b/sbapp/sideband/voice.py @@ -213,8 +213,12 @@ class ReticulumTelephone(): self.direction = None self.state = self.STATE_AVAILABLE - if call_was_connecting: self.log_call("outgoing-failure", remote_identity) - elif was_in_call: self.log_call("ongoing-ended", remote_identity) + if call_was_connecting: + self.log_call("outgoing-failure", remote_identity) + self.owner.setstate("voice.connection_failure", True) + elif was_in_call: + self.log_call("ongoing-ended", remote_identity) + self.owner.ended_call(remote_identity) elif was_ringing: self.log_call("incoming-missed", remote_identity) self.owner.missed_call(remote_identity) diff --git a/sbapp/ui/voice.py b/sbapp/ui/voice.py index 80e05aa..4060a6c 100644 --- a/sbapp/ui/voice.py +++ b/sbapp/ui/voice.py @@ -111,6 +111,10 @@ class Voice(): if telephone.caller: ih.text = RNS.hexrep(telephone.caller.hash, delimit=False) if telephone.active_profile: self.call_profile = telephone.active_profile + if self.app.sideband.getstate("voice.connection_failure"): + self.app.sideband.setstate("voice.connection_failure", False) + toast("Could not connect call", duration=5) + else: db.disabled = True; db.text = "Voice calls disabled" ih.disabled = True @@ -212,12 +216,11 @@ class Voice(): if self.app.sideband.telephone.is_available: destination_hash = RNS.Destination.hash_from_name_and_identity("lxst.telephony", self.dial_target) - if not RNS.Transport.has_path(destination_hash): - self.request_path(destination_hash) - + if not RNS.Transport.has_path(destination_hash): self.request_path(destination_hash) else: RNS.log(f"Calling {RNS.prettyhexrep(self.dial_target)}...", RNS.LOG_DEBUG) - self.app.sideband.telephone.dial(self.dial_target, profile=self.call_profile) + if self.app.sideband.telephone.dial(self.dial_target, profile=self.call_profile) == "no_path": + self.request_path(destination_hash) self.update_call_status() elif self.app.sideband.telephone.is_in_call or self.app.sideband.telephone.call_is_connecting: