From d1b472bbe1698aba086f7a8c0c9647a239e615d1 Mon Sep 17 00:00:00 2001 From: ttabouch12 Date: Sat, 14 Nov 2026 10:45:06 +0300 Subject: [PATCH] SimBridge 2.6.0: SimBridge voicemail and call screening Gateway module: - RecorderPort: clockless media port that plays a prompt and beep, then records until silence, a limit or hang-up (tested). - Voicemail.record answers a leg and records a message; CallBridge.takeOver hands a ringing session's caller to it. - ScreeningEndpoint wraps the cellular endpoint: chosen calls are answered, asked who is calling, recorded, then put through with a waiting tone. SIM phone app: - No-answer timer takes a message instead of rejecting when voicemail is on; screening for unknown or hidden numbers; TTS prompts made once per text (Prompts); WAV helpers; "machine" control op and status. Main phone: - Voicemail arrives as a message with a WAV attachment (played inline), transcribed with the call-translation speech engine; screened callers are shown in a notification; dashboard controls and prompt editing. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01A6dfuLYcfqCCHsvZhJ8pKM --- CHANGELOG.md | 14 ++ README.md | 1 + app/build.gradle.kts | 4 +- .../voicesipagent/app/GatewayControl.kt | 45 ++++- .../voicesipagent/app/GatewayRuntime.kt | 26 ++- .../sparkcyf/voicesipagent/app/Prompts.kt | 94 +++++++++ .../voicesipagent/gateway/AnsweringMachine.kt | 184 ++++++++++++++++++ .../voicesipagent/gateway/CallBridge.kt | 17 ++ .../gateway/AnsweringMachineTest.kt | 92 +++++++++ phone/build.gradle.kts | 4 +- .../io/github/simbridge/MessageStore.kt | 5 + .../kotlin/io/github/simbridge/Notifier.kt | 13 ++ .../io/github/simbridge/PhoneControl.kt | 16 ++ .../kotlin/io/github/simbridge/Voicemail.kt | 52 +++++ .../io/github/simbridge/ui/ChatScreen.kt | 20 ++ .../io/github/simbridge/ui/SimPhoneScreen.kt | 28 +++ phone/src/main/res/values-ar/strings.xml | 11 ++ phone/src/main/res/values-es/strings.xml | 11 ++ phone/src/main/res/values-fa/strings.xml | 11 ++ phone/src/main/res/values-fr/strings.xml | 11 ++ phone/src/main/res/values-ru/strings.xml | 11 ++ phone/src/main/res/values-tr/strings.xml | 11 ++ phone/src/main/res/values/strings.xml | 11 ++ 23 files changed, 683 insertions(+), 9 deletions(-) create mode 100644 app/src/main/kotlin/io/github/sparkcyf/voicesipagent/app/Prompts.kt create mode 100644 gateway/src/main/kotlin/io/github/sparkcyf/voicesipagent/gateway/AnsweringMachine.kt create mode 100644 gateway/src/test/kotlin/io/github/sparkcyf/voicesipagent/gateway/AnsweringMachineTest.kt create mode 100644 phone/src/main/kotlin/io/github/simbridge/Voicemail.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bb1868..edbc7d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## SimBridge 2.6.0 + +Update both apps. Pairing is kept. + +- **SimBridge voicemail:** when you don't answer, the SIM phone takes the call, plays your greeting + and a tone, and records the message (up to 2 minutes). It arrives as a message from the caller + with the recording (play it in the chat) and its words written out (cloud or on-device speech, + as set for call translation). Turn it on in Dashboard > Controls > Calls; it rings for the + no-answer time first (25 s if that is off). +- **Call screening:** for unknown or hidden numbers the SIM phone answers, asks who is calling and + why, and shows you what they said in a notification just before your phone rings. The caller + hears a waiting tone meanwhile. Note: a screened call counts as answered for the caller. +- Both spoken texts can be changed (Dashboard > Controls > Calls > Edit what callers hear). + ## SimBridge 2.5.0 Update both apps. Pairing is kept. diff --git a/README.md b/README.md index fa36edb..9c76e79 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ main phone only ever uses Wi-Fi. See the [disclaimer](DISCLAIMER.md). | 🎧 **HD voice** | 16 kHz wideband audio between the phones (L16), falling back to normal phone quality (G.711) when needed. | | 🔒 **Encrypted and paired** | Pair once by scanning a QR code. Signalling runs over **TLS** pinned to the SIM phone's key, audio over **SRTP**, and every call or text needs the paired password. Mobile-data and internet addresses are refused. | | 💬 **Texts, pictures and group chats** | A Google Messages-style app: conversations, contact photos, bubbles, notifications with **Reply** and **Mark as read**, **Sent / Delivered** reports, picture messages (MMS) and **group texts**. | +| 📼 **Voicemail and call screening** | Unanswered calls leave a message that arrives written out; unknown callers can be asked who they are before your phone rings. | | 🧹 **Rules, spam filter, quiet hours** | Choose who always alerts, stays silent, is archived or blocked; promotions go to Archived; quiet hours let only VIP contacts through. | | 🔔 **App notifications from the SIM phone** | Your bank or carrier app on the SIM phone? Its notifications arrive as messages on the main phone. | | 🛡️ **Watchdog, daily report, charge limit** | The gateway restarts itself after a crash, sends a morning health text, and can stop charging at 80–95 %. | diff --git a/app/build.gradle.kts b/app/build.gradle.kts index bb590ed..00c6f74 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -15,8 +15,8 @@ android { applicationId = "io.github.simbridge.gateway" minSdk = 30 targetSdk = 36 - versionCode = 460 - versionName = "2.5.0" + versionCode = 470 + versionName = "2.6.0" // Filter all transitive JNI libraries as well as PJSIP's own module outputs. ndk { //abiFilters += listOf("arm64-v8a", "x86_64") diff --git a/app/src/main/kotlin/io/github/sparkcyf/voicesipagent/app/GatewayControl.kt b/app/src/main/kotlin/io/github/sparkcyf/voicesipagent/app/GatewayControl.kt index bc879e4..64c952c 100644 --- a/app/src/main/kotlin/io/github/sparkcyf/voicesipagent/app/GatewayControl.kt +++ b/app/src/main/kotlin/io/github/sparkcyf/voicesipagent/app/GatewayControl.kt @@ -27,7 +27,7 @@ import org.json.JSONObject * persistent queue while no phone is registered. */ /** Control operations that change something on this phone; each is written to the [Audit] log. */ -private val AUDITED = setOf("control", "ussd", "ussd-reply", "screen-start", "network-mode", "apn-select", "apn-add", "sms-app", +private val AUDITED = setOf("machine", "control", "ussd", "ussd-reply", "screen-start", "network-mode", "apn-select", "apn-add", "sms-app", "at-place", "charge-limit", "locate", "block-rules", "voicemail") /** Who changed what on this phone, and when (the last 200 entries). */ @@ -64,6 +64,16 @@ class GatewayControl(private val app: Context, private val rt: GatewayRuntime) { if (set.isNotEmpty()) privilegedRaw("notif-access", AppNotifications.COMPONENT) send(JSONObject().put("op", "control-result").put("action", "notif-apps").put("ok", true), from) } + "machine" -> { + prefs.edit().apply { + if (o.has("voicemail")) putBoolean("vm_on", o.optBoolean("voicemail")) + if (o.has("screen")) putInt("screen_mode", o.optInt("screen").coerceIn(0, 2)) + o.optString("greeting").takeIf { it.isNotBlank() }?.let { putString("vm_greeting", it.take(300)) } + o.optString("screenPrompt").takeIf { it.isNotBlank() }?.let { putString("screen_prompt", it.take(300)) } + }.apply() + prompts.prepare(greeting); prompts.prepare(screenPrompt) + send(status(), from) + } "audit" -> send(JSONObject().put("op", "audit").put("list", Audit.recent(app)), from) "charge-limit" -> rt.worker { privileged("charge-limit", o.optString("value", "off")) @@ -255,6 +265,7 @@ class GatewayControl(private val app: Context, private val rt: GatewayRuntime) { o.put("hotspot", hotspotOn()) privilegedRaw("charge-limit-get", "").takeUnless { it.startsWith("error") }?.let { o.put("chargeLimit", it) } o.put("dailyReport", prefs.getBoolean("daily_report", true)) + o.put("vmOn", voicemailOn).put("screenMode", screenMode).put("greeting", greeting).put("screenPrompt", screenPrompt) o.put("smsApp", MmsGateway.isDefaultSmsApp(app)) o.put("noAnswerSec", noAnswerSec) if (hasPhoneState()) runCatching { app.getSystemService(TelephonyManager::class.java).voiceMailNumber }.getOrNull()?.let { o.put("voicemail", it) } @@ -513,8 +524,40 @@ class GatewayControl(private val app: Context, private val rt: GatewayRuntime) { private var wifiWatch: android.net.ConnectivityManager.NetworkCallback? = null + // ------------------------------------------------------------ voicemail and call screening + + val prompts = Prompts(app) + val voicemailOn: Boolean get() = prefs.getBoolean("vm_on", false) + /** 0 off, 1 numbers not in contacts (and hidden ones), 2 hidden numbers only. */ + val screenMode: Int get() = prefs.getInt("screen_mode", 0) + val greeting: String get() = prefs.getString("vm_greeting", null) + ?: "Hello. I can't take your call right now. Please leave a message after the tone." + val screenPrompt: String get() = prefs.getString("screen_prompt", null) + ?: "Hello. Please say your name and why you are calling, then wait a moment." + + fun shouldScreen(number: String?): Boolean = when (screenMode) { + 1 -> number.isNullOrBlank() || (ContactNames.lookup(app, number) == null && !isBlocked(number)) + 2 -> number.isNullOrBlank() + else -> false + } + + /** A message left after no answer; kept until the main phone has it. */ + fun voicemailMessage(p: io.github.sparkcyf.voicesipagent.voice.Party, audio: ShortArray, rate: Int, at: Long) { + AppLog.i("voicemail message: ${audio.size * 1000L / rate} ms") + deliver(JSONObject().put("op", "voicemail-msg").put("from", p.number ?: "").put("name", ContactNames.lookup(app, p.number) ?: "") + .put("sim", p.sim ?: 0).put("at", at).put("rate", rate) + .put("wav", android.util.Base64.encodeToString(Wav.encode(audio, rate), android.util.Base64.NO_WRAP))) + } + + /** What a screened caller said; only useful right now, so not kept. */ + fun screened(p: io.github.sparkcyf.voicesipagent.voice.Party, audio: ShortArray, rate: Int) { + send(JSONObject().put("op", "screened").put("from", p.number ?: "").put("rate", rate) + .put("wav", android.util.Base64.encodeToString(Wav.encode(audio, rate), android.util.Base64.NO_WRAP))) + } + /** Called once when the gateway starts. */ fun start() { + prompts.prepare(greeting); prompts.prepare(screenPrompt) scheduleReport() if (prefs.getBoolean("crashed", false)) { prefs.edit().putBoolean("crashed", false).apply() diff --git a/app/src/main/kotlin/io/github/sparkcyf/voicesipagent/app/GatewayRuntime.kt b/app/src/main/kotlin/io/github/sparkcyf/voicesipagent/app/GatewayRuntime.kt index af524da..ba97fe1 100644 --- a/app/src/main/kotlin/io/github/sparkcyf/voicesipagent/app/GatewayRuntime.kt +++ b/app/src/main/kotlin/io/github/sparkcyf/voicesipagent/app/GatewayRuntime.kt @@ -707,7 +707,12 @@ class GatewayRuntime private constructor(context: Context) { // to be non-empty; "phone" is a readable placeholder when no DID/username is configured. val inboundTarget = s.inboundTarget.ifBlank { s.username.ifBlank { if (s.serverMode) "phone" else "" } } val b = CallBridge( - sideA = cellular, + // Some calls are answered and screened first (control.screenMode). + sideA = io.github.sparkcyf.voicesipagent.gateway.ScreeningEndpoint(cellular, + shouldScreen = { leg -> control.shouldScreen(leg.remote.number) }, + prompt = { f -> control.prompts.get(control.screenPrompt, f) }, + onScreened = { leg, audio, f -> control.screened(leg.remote, audio, f.sampleRate) }, + log = { AppLog.i("bridge: $it") }), sideB = sideB, routeAtoB = { leg -> if (control.isBlocked(leg.remote.number)) { @@ -750,12 +755,25 @@ class GatewayRuntime private constructor(context: Context) { val st = s.outbound?.state // "Voicemail": an unanswered call is rejected after N seconds, so the carrier's // forwarding (busy / no answer) takes it to voicemail. - val sec = control.noAnswerSec + val sec = control.noAnswerSec.takeIf { it > 0 } ?: if (control.voicemailOn) 25 else 0 if (sec > 0 && st == LegState.RINGING && s.connectedAtMs == null && s.endedAtMs == null && !noAnswer.containsKey(s.id)) { val r = Runnable { if (s.connectedAtMs == null && s.endedAtMs == null) { - AppLog.i("no answer after ${sec}s: handing the call to the carrier (voicemail)") - s.inbound.hangup(io.github.sparkcyf.voicesipagent.voice.HangupCause.BUSY) + val b = bridge + if (control.voicemailOn && b != null) { + // SimBridge's own voicemail: answer, record, send the message to the main phone. + AppLog.i("no answer after ${sec}s: taking a message") + b.takeOver(s) { leg -> + io.github.sparkcyf.voicesipagent.gateway.Voicemail.record(leg, + greeting = { f -> control.prompts.get(control.greeting, f) ?: ShortArray(0) }, + maxMs = 120_000, + onMessage = { party, audio, f, at -> control.voicemailMessage(party, audio, f.sampleRate, at) }, + log = { AppLog.i("bridge: $it") }) + } + } else { + AppLog.i("no answer after ${sec}s: handing the call to the carrier (voicemail)") + s.inbound.hangup(io.github.sparkcyf.voicesipagent.voice.HangupCause.BUSY) + } } } noAnswer[s.id] = r diff --git a/app/src/main/kotlin/io/github/sparkcyf/voicesipagent/app/Prompts.kt b/app/src/main/kotlin/io/github/sparkcyf/voicesipagent/app/Prompts.kt new file mode 100644 index 0000000..e23bdc6 --- /dev/null +++ b/app/src/main/kotlin/io/github/sparkcyf/voicesipagent/app/Prompts.kt @@ -0,0 +1,94 @@ +package io.github.sparkcyf.voicesipagent.app + +import android.content.Context +import android.speech.tts.TextToSpeech +import android.speech.tts.UtteranceProgressListener +import io.github.sparkcyf.voicesipagent.voice.PcmFormat +import java.io.File +import java.util.concurrent.ConcurrentHashMap +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit + +/** + * Spoken prompts for the answering machine and call screening, made with this phone's + * text-to-speech and kept in memory per text and rate. [get] never waits on the call path: + * it returns null until [prepare] has made the prompt. + */ +class Prompts(private val app: Context) { + private val cache = ConcurrentHashMap() + + fun get(text: String, f: PcmFormat): ShortArray? = cache["${f.sampleRate}|$text"] + + /** Makes both rates of [text] in the background (a few seconds the first time). */ + fun prepare(text: String) { + if (text.isBlank() || listOf(8000, 16000).all { cache.containsKey("$it|$text") }) return + Thread({ + val pcm = synchronized(this) { synth(text) } ?: return@Thread + listOf(PcmFormat.NARROWBAND, PcmFormat.WIDEBAND).forEach { f -> cache["${f.sampleRate}|$text"] = Wav.resample(pcm.first, pcm.second, f.sampleRate) } + AppLog.i("prompt ready (${pcm.first.size * 1000L / pcm.second} ms)") + }, "prompts").start() + } + + private fun synth(text: String): Pair? { + val ready = CountDownLatch(1) + var ok = false + val tts = TextToSpeech(app) { ok = it == TextToSpeech.SUCCESS; ready.countDown() } + try { + if (!ready.await(10, TimeUnit.SECONDS) || !ok) return null + val out = File(app.cacheDir, "prompt-${text.hashCode()}.wav") + val done = CountDownLatch(1) + tts.setOnUtteranceProgressListener(object : UtteranceProgressListener() { + override fun onStart(id: String?) {} + override fun onDone(id: String?) = done.countDown() + @Deprecated("old API") override fun onError(id: String?) = done.countDown() + }) + tts.synthesizeToFile(text, null, out, "p") + if (!done.await(20, TimeUnit.SECONDS)) return null + return Wav.read(out.readBytes()).also { out.delete() } + } finally { + tts.shutdown() + } + } +} + +/** 16-bit mono WAV in and out, and a simple resampler. */ +object Wav { + fun encode(pcm: ShortArray, rate: Int): ByteArray { + val b = java.nio.ByteBuffer.allocate(44 + pcm.size * 2).order(java.nio.ByteOrder.LITTLE_ENDIAN) + b.put("RIFF".toByteArray()).putInt(36 + pcm.size * 2).put("WAVE".toByteArray()) + b.put("fmt ".toByteArray()).putInt(16).putShort(1).putShort(1).putInt(rate).putInt(rate * 2).putShort(2).putShort(16) + b.put("data".toByteArray()).putInt(pcm.size * 2) + pcm.forEach { b.putShort(it) } + return b.array() + } + + /** First channel of a 16-bit PCM WAV, with its rate. */ + fun read(bytes: ByteArray): Pair? { + val b = java.nio.ByteBuffer.wrap(bytes).order(java.nio.ByteOrder.LITTLE_ENDIAN) + if (bytes.size < 44) return null + b.position(12) + var rate = 0; var channels = 1 + while (b.remaining() >= 8) { + val id = String(ByteArray(4).also { b.get(it) }); val len = b.int + when (id) { + "fmt " -> { b.short; channels = b.short.toInt(); rate = b.int; b.position(b.position() + len - 8) } + "data" -> { + val n = minOf(len, b.remaining()) / 2 / channels + return ShortArray(n) { val v = b.short; repeat(channels - 1) { b.short }; v } to rate + } + else -> b.position(minOf(b.limit(), b.position() + len)) + } + } + return null + } + + fun resample(x: ShortArray, from: Int, to: Int): ShortArray { + if (from == to || x.isEmpty() || from <= 0) return x + val ratio = from.toDouble() / to + return ShortArray((x.size / ratio).toInt()) { i -> + val p = i * ratio; val j = p.toInt(); val t = p - j + val a = x[minOf(j, x.size - 1)]; val c = x[minOf(j + 1, x.size - 1)] + (a + (c - a) * t).toInt().toShort() + } + } +} diff --git a/gateway/src/main/kotlin/io/github/sparkcyf/voicesipagent/gateway/AnsweringMachine.kt b/gateway/src/main/kotlin/io/github/sparkcyf/voicesipagent/gateway/AnsweringMachine.kt new file mode 100644 index 0000000..ff224d1 --- /dev/null +++ b/gateway/src/main/kotlin/io/github/sparkcyf/voicesipagent/gateway/AnsweringMachine.kt @@ -0,0 +1,184 @@ +package io.github.sparkcyf.voicesipagent.gateway + +import io.github.sparkcyf.voicesipagent.voice.CallLeg +import io.github.sparkcyf.voicesipagent.voice.CallEndpoint +import io.github.sparkcyf.voicesipagent.voice.EndpointStatusListener +import io.github.sparkcyf.voicesipagent.voice.FrameClockListener +import io.github.sparkcyf.voicesipagent.voice.HangupCause +import io.github.sparkcyf.voicesipagent.voice.IncomingCallHandler +import io.github.sparkcyf.voicesipagent.voice.LegState +import io.github.sparkcyf.voicesipagent.voice.MediaPort +import io.github.sparkcyf.voicesipagent.voice.Party +import io.github.sparkcyf.voicesipagent.voice.PcmFormat +import io.github.sparkcyf.voicesipagent.voice.VoiceFormat +import kotlin.math.PI +import kotlin.math.sin + +/** + * The far end of an answered call when nobody is at the phone: plays [prompt], then a short beep, + * then records what the caller says until [maxMs], [silenceMs] of quiet after some speech, or the + * caller hangs up. Afterwards it plays [after] (a hold tone, or nothing) until it is replaced. + * + * It is a clockless [MediaPort]: a [MediaBridge] with the cellular port drives it. + */ +class RecorderPort( + override val format: PcmFormat, + prompt: ShortArray, + private val maxMs: Int, + private val silenceMs: Int, + private val after: ShortArray? = null, + private val onDone: (ShortArray) -> Unit, +) : MediaPort { + private val out: ShortArray = prompt + beep(format) + private var outPos = 0 + private val rec = ArrayList() + private var spokeMs = 0 + private var quietMs = 0 + private var afterPos = 0 + @Volatile var done = false + private set + + override val isClockSource = false + override fun setClockListener(listener: FrameClockListener?) {} + + /** What the caller hears. */ + override fun readFrame(): ShortArray { + val n = format.frameSamples + if (outPos < out.size) { + val f = ShortArray(n) + System.arraycopy(out, outPos, f, 0, minOf(n, out.size - outPos)) + outPos += n + return f + } + val a = after + if (done && a != null && a.isNotEmpty()) { + val f = ShortArray(n) { a[(afterPos + it) % a.size] } + afterPos = (afterPos + n) % a.size + return f + } + return format.silence() + } + + /** What the caller says; recorded once the prompt and beep are over. */ + override fun writeFrame(frame: ShortArray) { + if (done || outPos < out.size) return + rec += frame.copyOf() + val ms = VoiceFormat.FRAME_MS + if (VoiceFormat.peak(frame) > SPEECH_PEAK) { spokeMs += ms; quietMs = 0 } else quietMs += ms + val total = rec.size * ms + if (total >= maxMs || (spokeMs >= 400 && quietMs >= silenceMs)) finish() + } + + /** Ends the recording now (the caller hung up). Safe to call more than once. */ + @Synchronized fun finish() { + if (done) return + done = true + // Cut the trailing quiet, keep a little. + val keep = (rec.size - (quietMs - 300).coerceAtLeast(0) / VoiceFormat.FRAME_MS).coerceIn(0, rec.size) + val all = ShortArray(keep * format.frameSamples) + for (i in 0 until keep) System.arraycopy(rec[i], 0, all, i * format.frameSamples, format.frameSamples) + onDone(if (spokeMs >= 400) all else ShortArray(0)) + } + + companion object { + private const val SPEECH_PEAK = 1500 + + /** 400 ms at 1 kHz, like an answering machine. */ + fun beep(f: PcmFormat): ShortArray = ShortArray(f.sampleRate * 4 / 10) { i -> + (sin(2 * PI * 1000 * i / f.sampleRate) * 9000).toInt().toShort() + } + + /** A soft ring-back style tone (0.4 s on, 2.6 s off) for the caller waiting to be put through. */ + fun holdTone(f: PcmFormat): ShortArray = ShortArray(f.sampleRate * 3) { i -> + if (i < f.sampleRate * 4 / 10) ((sin(2 * PI * 425 * i / f.sampleRate)) * 4000).toInt().toShort() else 0 + } + } +} + +/** + * Wraps the cellular endpoint so some calls are screened before they ring the main phone: the + * call is answered, the caller hears [prompt] and says who they are, the recording goes to + * [onScreened], and then the call is put through as usual (the caller hears a waiting tone). + */ +class ScreeningEndpoint( + private val inner: CallEndpoint, + private val shouldScreen: (CallLeg) -> Boolean, + private val prompt: (PcmFormat) -> ShortArray?, + private val onScreened: (leg: CallLeg, audio: ShortArray, format: PcmFormat) -> Unit, + private val log: (String) -> Unit = {}, +) : CallEndpoint by inner { + override fun setIncomingCallHandler(handler: IncomingCallHandler?) { + if (handler == null) { inner.setIncomingCallHandler(null); return } + inner.setIncomingCallHandler { leg -> + if (!runCatching { shouldScreen(leg) }.getOrDefault(false)) handler.onIncomingCall(leg) + else screen(leg, handler) + } + } + + private fun screen(leg: CallLeg, then: IncomingCallHandler) { + var bridge: MediaBridge? = null + var handed = false + fun handOver() { + if (handed) return + handed = true + // The bridge's own media takes the cellular clock over; ours just stops being called. + if (leg.state != LegState.ENDED) then.onIncomingCall(leg) + } + val listener = object : CallLeg.Listener { + override fun onMediaChanged(leg: CallLeg, media: MediaPort?) { + if (media == null || bridge != null) return + val p = prompt(media.format) + if (p == null) { handOver(); return } + val port = RecorderPort(media.format, p, maxMs = 7000, silenceMs = 1200, after = RecorderPort.holdTone(media.format)) { audio -> + log("screening: ${audio.size * 1000L / media.format.sampleRate} ms recorded") + if (audio.isNotEmpty()) runCatching { onScreened(leg, audio, media.format) } + handOver() + } + bridge = MediaBridge(media, port).also { it.start() } + } + + override fun onStateChanged(leg: CallLeg, state: LegState) { + if (state == LegState.ENDED) { bridge?.stop(); leg.removeListener(this) } + } + } + leg.addListener(listener) + log("screening an incoming call") + leg.answer() + leg.media?.let { listener.onMediaChanged(leg, it) } + } +} + +/** + * Takes an unanswered call off the main phone and records a message: answers it, plays the + * greeting and beep, records, hangs up, and hands the recording to [onMessage]. + */ +object Voicemail { + fun record(leg: CallLeg, greeting: (PcmFormat) -> ShortArray, maxMs: Int, onMessage: (Party, ShortArray, PcmFormat, Long) -> Unit, + log: (String) -> Unit = {}) { + val at = System.currentTimeMillis() + var bridge: MediaBridge? = null + var port: RecorderPort? = null + val listener = object : CallLeg.Listener { + override fun onMediaChanged(leg: CallLeg, media: MediaPort?) { + if (media == null || bridge != null) return + val p = RecorderPort(media.format, greeting(media.format), maxMs, silenceMs = 3500) { audio -> + log("voicemail: ${audio.size * 1000L / media.format.sampleRate} ms recorded") + if (audio.isNotEmpty()) runCatching { onMessage(leg.remote, audio, media.format, at) } + if (leg.state != LegState.ENDED) leg.hangup(HangupCause.NORMAL) + } + port = p + bridge = MediaBridge(media, p).also { it.start() } + } + + override fun onStateChanged(leg: CallLeg, state: LegState) { + if (state != LegState.ENDED) return + bridge?.stop() + port?.finish() // the caller hung up: keep what was said + leg.removeListener(this) + } + } + leg.addListener(listener) + log("voicemail: answering") + if (leg.state == LegState.CONNECTED) leg.media?.let { listener.onMediaChanged(leg, it) } else leg.answer() + } +} diff --git a/gateway/src/main/kotlin/io/github/sparkcyf/voicesipagent/gateway/CallBridge.kt b/gateway/src/main/kotlin/io/github/sparkcyf/voicesipagent/gateway/CallBridge.kt index 50c52b9..040ec6c 100644 --- a/gateway/src/main/kotlin/io/github/sparkcyf/voicesipagent/gateway/CallBridge.kt +++ b/gateway/src/main/kotlin/io/github/sparkcyf/voicesipagent/gateway/CallBridge.kt @@ -207,6 +207,23 @@ class CallBridge( } } + /** + * Takes the caller's leg away from the current session (for voicemail): the main phone stops + * ringing, the session ends, and the inbound leg stays up. [then] runs on the bridge thread with + * the leg; nothing happens if the session already ended or was answered. + */ + fun takeOver(s: BridgeSession, then: (CallLeg) -> Unit) = post { + if (session !== s || s.connectedAtMs != null) return@post + session = null + s.endedAtMs = System.currentTimeMillis() + s.answerTimer?.cancel(false) + s.mediaTimer?.cancel(false) + s.outbound?.let { if (it.state != LegState.ENDED) it.hangup(HangupCause.CANCELLED) } + log("$s handed to voicemail") + notifyChanged(s) + then(s.inbound) + } + private fun endSession(s: BridgeSession, cause: HangupCause) { if (session !== s) return session = null diff --git a/gateway/src/test/kotlin/io/github/sparkcyf/voicesipagent/gateway/AnsweringMachineTest.kt b/gateway/src/test/kotlin/io/github/sparkcyf/voicesipagent/gateway/AnsweringMachineTest.kt new file mode 100644 index 0000000..e31aa7b --- /dev/null +++ b/gateway/src/test/kotlin/io/github/sparkcyf/voicesipagent/gateway/AnsweringMachineTest.kt @@ -0,0 +1,92 @@ +package io.github.sparkcyf.voicesipagent.gateway + +import io.github.sparkcyf.voicesipagent.voice.HangupCause +import io.github.sparkcyf.voicesipagent.voice.LegDirection +import io.github.sparkcyf.voicesipagent.voice.LegState +import io.github.sparkcyf.voicesipagent.voice.Party +import io.github.sparkcyf.voicesipagent.voice.PcmFormat +import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue +import org.junit.Test + +class AnsweringMachineTest { + private val f = PcmFormat.NARROWBAND + private fun loud() = ShortArray(f.frameSamples) { 5000 } + private fun quiet() = ShortArray(f.frameSamples) + + @Test + fun playsPromptAndBeepThenRecordsUntilSilence() { + var got: ShortArray? = null + val prompt = ShortArray(f.frameSamples * 5) { 1 } + val p = RecorderPort(f, prompt, maxMs = 60_000, silenceMs = 1000) { got = it } + // Prompt (5 frames) + beep (400 ms = 20 frames) are played first; speech then is ignored. + repeat(25) { assertEquals(f.frameSamples, p.readFrame().size); p.writeFrame(loud()) } + repeat(50) { p.readFrame(); p.writeFrame(loud()) } // 1 s of speech + repeat(60) { p.readFrame(); p.writeFrame(quiet()) } // then quiet: stops after 1 s + assertTrue(p.done) + val ms = got!!.size * 1000 / f.sampleRate + assertTrue("recorded $ms ms", ms in 1200..1400) // speech + 300 ms of the quiet + } + + @Test + fun hangupKeepsWhatWasSaidAndSilenceGivesNothing() { + var got: ShortArray? = null + val p = RecorderPort(f, ShortArray(0), maxMs = 60_000, silenceMs = 3000) { got = it } + repeat(20) { p.writeFrame(quiet()); p.readFrame() } // beep (said during it: not kept) + repeat(30) { p.writeFrame(loud()) } + p.finish(); p.finish() + assertEquals(30 * f.frameSamples, got!!.size) + + var empty: ShortArray? = null + val q = RecorderPort(f, ShortArray(0), maxMs = 60_000, silenceMs = 3000) { empty = it } + repeat(20) { q.readFrame() } + repeat(40) { q.writeFrame(quiet()) } + q.finish() + assertEquals(0, empty!!.size) + } + + @Test + fun voicemailTakesTheCallerOffTheRingingPhone() { + val cell = FakeEndpoint("cellular") + val sip = FakeEndpoint("sip").apply { onDial = { it.remoteRinging() } } + val bridge = CallBridge(cell, sip, { "phone" }, { it.target }, GatewayConfig(cellularInboundTarget = "phone")) + bridge.start() + val caller = cell.incoming("+905551112233") + bridge.drain() + val session = bridge.session!! + var message: ShortArray? = null + bridge.takeOver(session) { leg -> Voicemail.record(leg, { ShortArray(0) }, 30_000, { _, a, _, _ -> message = a }) } + bridge.drain() + assertTrue(sip.dialed.first().actions.contains("hangup:CANCELLED")) + assertEquals(LegState.CONNECTED, caller.state) + val port = FakePort(isClockSource = true, fill = 6000) + caller.mediaUp(port) + repeat(200) { port.clock!!.onFrame() } // beep, then 3.6 s of speech + caller.remoteEnded(HangupCause.NORMAL) + assertTrue(message!!.isNotEmpty()) + bridge.stop() + } + + @Test + fun screenedCallsAreAnsweredRecordedThenPutThrough() { + val cell = FakeEndpoint("cellular") + var screened: ShortArray? = null + var handed = false + val ep = ScreeningEndpoint(cell, { it.remote.number == "+1" }, { ShortArray(0) }, { _, a, _ -> screened = a }) + ep.setIncomingCallHandler { handed = true } + val leg = FakeLeg("cellular", LegDirection.INBOUND, Party("+1"), null) + cell.handler!!.onIncomingCall(leg) + assertTrue(leg.actions.contains("answer")) + val port = FakePort(isClockSource = true, fill = 6000) + leg.mediaUp(port) + repeat(20 + 350) { port.clock!!.onFrame() } // beep, then 7 s max + assertTrue(screened!!.isNotEmpty()) + assertTrue(handed) + + handed = false + ep.setIncomingCallHandler { handed = true } + val other = FakeLeg("cellular", LegDirection.INBOUND, Party("+2"), null) + cell.handler!!.onIncomingCall(other) + assertTrue(handed && other.actions.isEmpty()) + } +} diff --git a/phone/build.gradle.kts b/phone/build.gradle.kts index ee1ad94..98c3081 100644 --- a/phone/build.gradle.kts +++ b/phone/build.gradle.kts @@ -14,8 +14,8 @@ android { applicationId = "io.github.simbridge" minSdk = 34 targetSdk = 36 - versionCode = 260 - versionName = "2.5.0" + versionCode = 270 + versionName = "2.6.0" } // Same signing source as the gateway app: a git-ignored signing.properties in the project root. val localSigning = Properties().apply { diff --git a/phone/src/main/kotlin/io/github/simbridge/MessageStore.kt b/phone/src/main/kotlin/io/github/simbridge/MessageStore.kt index 1ec18ec..7644cc3 100644 --- a/phone/src/main/kotlin/io/github/simbridge/MessageStore.kt +++ b/phone/src/main/kotlin/io/github/simbridge/MessageStore.kt @@ -116,6 +116,11 @@ class MessageStore(context: Context) : SQLiteOpenHelper(context, "messages.db", if (status == Msg.FAILED || (rank[status] ?: 0) > (rank[cur] ?: -1)) setStatus(id, status) } + fun setBody(id: Long, body: String) { + writableDatabase.execSQL("UPDATE m SET body=? WHERE id=?", arrayOf(body, id)) + changed() + } + fun setStatus(id: Long, status: Int) { writableDatabase.update("m", ContentValues().apply { put("status", status) }, "id=?", arrayOf(id.toString())) changed() diff --git a/phone/src/main/kotlin/io/github/simbridge/Notifier.kt b/phone/src/main/kotlin/io/github/simbridge/Notifier.kt index 97f1c2a..57d15bc 100644 --- a/phone/src/main/kotlin/io/github/simbridge/Notifier.kt +++ b/phone/src/main/kotlin/io/github/simbridge/Notifier.kt @@ -127,6 +127,19 @@ class Notifier(private val context: Context, private val core: LinkCore) { fun cancel(key: String) = nm.cancel(key.hashCode()) + /** Who a screened caller says they are; the call itself rings right after. */ + fun screened(who: String, said: String) { + val n = Notification.Builder(context, CH_MISSED) + .setSmallIcon(R.drawable.ic_link) + .setContentTitle(context.getString(R.string.screen_title, who)) + .setContentText(said) + .setStyle(Notification.BigTextStyle().bigText(said)) + .setCategory(Notification.CATEGORY_CALL) + .setTimeoutAfter(60_000) + .setAutoCancel(true).build() + runCatching { nm.notify(ID_ALERT + 7, n) } + } + fun callAccountOff() { val n = Notification.Builder(context, CH_ALERTS) .setSmallIcon(R.drawable.ic_link) diff --git a/phone/src/main/kotlin/io/github/simbridge/PhoneControl.kt b/phone/src/main/kotlin/io/github/simbridge/PhoneControl.kt index 43ab179..549bbcc 100644 --- a/phone/src/main/kotlin/io/github/simbridge/PhoneControl.kt +++ b/phone/src/main/kotlin/io/github/simbridge/PhoneControl.kt @@ -29,6 +29,11 @@ data class GatewayStatus( /** Samsung battery protection: "off", or the percent charging stops at. Null when unknown. */ val chargeLimit: String? = null, val dailyReport: Boolean = true, + /** SimBridge voicemail on the SIM phone, call screening (0 off, 1 unknown, 2 hidden) and the spoken texts. */ + val vmOn: Boolean = false, + val screenMode: Int = 0, + val greeting: String = "", + val screenPrompt: String = "", val powerSaver: Boolean, val dataOn: Boolean, val hotspot: Boolean, @@ -54,6 +59,10 @@ data class GatewayStatus( chargeMin = if (o.has("chargeMin")) o.optInt("chargeMin") else null, chargeLimit = o.optString("chargeLimit").ifBlank { null }, dailyReport = o.optBoolean("dailyReport", true), + vmOn = o.optBoolean("vmOn"), + screenMode = o.optInt("screenMode"), + greeting = o.optString("greeting"), + screenPrompt = o.optString("screenPrompt"), powerSaver = o.optBoolean("powerSaver"), dataOn = o.optBoolean("dataOn"), hotspot = o.optBoolean("hotspot"), @@ -126,6 +135,8 @@ class PhoneControl(private val core: LinkCore) { "mms" -> core.onIncomingMms(o) "data-detail" -> _dataDetail.value = DataDetail.parse(o) "screen-ready" -> _screen.value = ScreenOffer.parse(o) + "voicemail-msg" -> Voicemails.onMessage(core.context, core, o) + "screened" -> Voicemails.onScreened(core.context, core, o) "apps" -> _apps.value = (o.optJSONArray("list") ?: JSONArray()).let { a -> (0 until a.length()).map { a.getJSONObject(it).let { e -> e.optString("pkg") to e.optString("name") } } } to (o.optJSONArray("chosen") ?: JSONArray()).let { a -> (0 until a.length()).map { a.getString(it) }.toSet() } @@ -237,6 +248,11 @@ class PhoneControl(private val core: LinkCore) { send(JSONObject().put("op", "apn-add").put("name", name).put("apn", apn).put("mcc", mcc).put("mnc", mnc) .put("user", user).put("password", password)) fun setNoAnswer(seconds: Int) = send(JSONObject().put("op", "voicemail").put("seconds", seconds)) + fun setMachine(voicemail: Boolean? = null, screen: Int? = null, greeting: String? = null, screenPrompt: String? = null) = + send(JSONObject().put("op", "machine").apply { + voicemail?.let { put("voicemail", it) }; screen?.let { put("screen", it) } + greeting?.let { put("greeting", it) }; screenPrompt?.let { put("screenPrompt", it) } + }) fun setChargeLimit(value: String) = send(JSONObject().put("op", "charge-limit").put("value", value)) fun setDailyReport(on: Boolean) = send(JSONObject().put("op", "report").put("on", on)).also { refresh() } diff --git a/phone/src/main/kotlin/io/github/simbridge/Voicemail.kt b/phone/src/main/kotlin/io/github/simbridge/Voicemail.kt new file mode 100644 index 0000000..2e23caa --- /dev/null +++ b/phone/src/main/kotlin/io/github/simbridge/Voicemail.kt @@ -0,0 +1,52 @@ +package io.github.simbridge + +import android.app.Notification +import android.app.PendingIntent +import android.content.Context +import android.content.Intent +import org.json.JSONObject +import java.io.File + +/** + * Messages the SIM phone recorded for unanswered calls, and what screened callers said. Each + * voicemail becomes a message from the caller with the recording attached; the words are + * written in once recognized (cloud speech or on-device, as set for call translation). + */ +object Voicemails { + fun onMessage(ctx: Context, core: LinkCore, o: JSONObject) { + val from = o.optString("from").ifBlank { ctx.getString(R.string.unknown_caller) } + val rate = o.optInt("rate", 8000) + val wav = android.util.Base64.decode(o.optString("wav"), android.util.Base64.DEFAULT) + val at = o.optLong("at", System.currentTimeMillis()) + val file = "vm-$at.wav" + File(ctx.filesDir, "mms").apply { mkdirs() }.resolve(file).writeBytes(wav) + val sec = (wav.size - 44) / 2 / rate + val label = ctx.getString(R.string.vm_label, "%d:%02d".format(sec / 60, sec % 60)) + val att = MmsInfo(null, listOf(Attachment("audio/wav", file, label))).toJson() + val id = core.store.add(from, label, outgoing = false, status = Msg.RECEIVED, time = at, sim = o.optInt("sim", 0), att = att) + core.notifier.showMessages(MessageStore.keyOf(from), from) + Log.i("voicemail saved (#$id, ${sec}s)") + Thread({ + val pcm = Pcm.readWav(File(ctx.filesDir, "mms/$file"), rate) ?: return@Thread + val text = runCatching { Speech(ctx, core.prefs).transcribe(pcm, rate, core.prefs.callerLang) }.getOrNull()?.trim() + if (!text.isNullOrEmpty() && !Speech.isJunk(text)) { + core.store.setBody(id, "$label\n“$text”") + core.notifier.showMessages(MessageStore.keyOf(from), from) + } + }, "voicemail-text").start() + } + + /** A screened caller: show who they said they are, right before the call rings here. */ + fun onScreened(ctx: Context, core: LinkCore, o: JSONObject) { + val number = o.optString("from") + val who = core.contacts.lookup(number)?.name ?: number.ifBlank { ctx.getString(R.string.unknown_caller) } + val rate = o.optInt("rate", 8000) + val wav = android.util.Base64.decode(o.optString("wav"), android.util.Base64.DEFAULT) + Thread({ + val f = File(ctx.cacheDir, "screen.wav").apply { writeBytes(wav) } + val pcm = Pcm.readWav(f, rate) ?: return@Thread + val text = runCatching { Speech(ctx, core.prefs).transcribe(pcm, rate, core.prefs.callerLang) }.getOrNull()?.trim() + core.notifier.screened(who, text?.takeIf { it.isNotEmpty() && !Speech.isJunk(it) } ?: ctx.getString(R.string.screen_unclear)) + }, "screen-text").start() + } +} diff --git a/phone/src/main/kotlin/io/github/simbridge/ui/ChatScreen.kt b/phone/src/main/kotlin/io/github/simbridge/ui/ChatScreen.kt index a1cad71..c0bd3e2 100644 --- a/phone/src/main/kotlin/io/github/simbridge/ui/ChatScreen.kt +++ b/phone/src/main/kotlin/io/github/simbridge/ui/ChatScreen.kt @@ -1,6 +1,8 @@ package io.github.simbridge.ui import androidx.compose.foundation.background +import androidx.compose.material.icons.filled.Stop +import androidx.compose.material.icons.filled.PlayArrow import androidx.compose.foundation.horizontalScroll import androidx.compose.material.icons.automirrored.filled.Forward import androidx.compose.material.icons.filled.ContentCopy @@ -462,6 +464,24 @@ private fun AttachmentView(a: io.github.simbridge.Attachment, outgoing: Boolean) .clickable { open() }, contentScale = androidx.compose.ui.layout.ContentScale.FillWidth) return } + if (a.type.startsWith("audio/")) { + // Voicemail and voice notes play right here. + var player by remember { mutableStateOf(null) } + androidx.compose.runtime.DisposableEffect(a) { onDispose { player?.release() } } + androidx.compose.material3.AssistChip(onClick = { + val p = player + if (p != null) { p.release(); player = null } + else player = runCatching { + android.media.MediaPlayer().apply { + setDataSource(io.github.simbridge.Mms.fileOf(ctx, a).path); prepare(); start() + setOnCompletionListener { it.release(); player = null } + } + }.getOrNull() + }, label = { Text(a.name, maxLines = 1, overflow = TextOverflow.Ellipsis) }, + leadingIcon = { Icon(if (player != null) Icons.Filled.Stop else Icons.Filled.PlayArrow, null) }, + modifier = Modifier.padding(vertical = 2.dp)) + return + } androidx.compose.material3.AssistChip(onClick = open, label = { Text(a.name, maxLines = 1, overflow = TextOverflow.Ellipsis) }, leadingIcon = { Icon(Icons.Filled.AttachFile, null) }, modifier = Modifier.padding(vertical = 2.dp)) } diff --git a/phone/src/main/kotlin/io/github/simbridge/ui/SimPhoneScreen.kt b/phone/src/main/kotlin/io/github/simbridge/ui/SimPhoneScreen.kt index 92dcb4a..4f14a5c 100644 --- a/phone/src/main/kotlin/io/github/simbridge/ui/SimPhoneScreen.kt +++ b/phone/src/main/kotlin/io/github/simbridge/ui/SimPhoneScreen.kt @@ -261,6 +261,34 @@ fun SimPhoneScreen( label = { Text(if (sec == 0) stringResource(R.string.off) else "$sec s") }) } } + // SimBridge's own voicemail and call screening, run by the SIM phone. + ToggleRow(stringResource(R.string.vm_title), stringResource(R.string.vm_sub), s?.vmOn, online, null) { + core.control.setMachine(voicemail = it) + } + Muted(stringResource(R.string.screen_sub)) + Row(horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = Modifier.padding(top = 4.dp)) { + listOf(0 to R.string.off, 1 to R.string.screen_unknown, 2 to R.string.screen_hidden).forEach { (m, label) -> + FilterChip(s?.screenMode == m, { core.control.setMachine(screen = m) }, enabled = online, label = { Text(stringResource(label)) }) + } + } + var editPrompts by remember { mutableStateOf(false) } + TextButton({ editPrompts = true }, enabled = online && s != null) { Text(stringResource(R.string.vm_edit)) } + if (editPrompts && s != null) { + var g by remember { mutableStateOf(s.greeting) } + var q by remember { mutableStateOf(s.screenPrompt) } + androidx.compose.material3.AlertDialog( + onDismissRequest = { editPrompts = false }, + title = { Text(stringResource(R.string.vm_edit)) }, + text = { + Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { + androidx.compose.material3.OutlinedTextField(g, { g = it.take(300) }, label = { Text(stringResource(R.string.vm_greeting)) }) + androidx.compose.material3.OutlinedTextField(q, { q = it.take(300) }, label = { Text(stringResource(R.string.screen_prompt)) }) + } + }, + confirmButton = { TextButton({ core.control.setMachine(greeting = g, screenPrompt = q); editPrompts = false }) { Text(stringResource(R.string.save)) } }, + dismissButton = { TextButton({ editPrompts = false }) { Text(stringResource(R.string.cancel)) } }, + ) + } Spacer(Modifier.height(12.dp)) Text(stringResource(R.string.dash_audio_test), style = MaterialTheme.typography.bodyLarge) Muted(stringResource(R.string.dash_audio_test_sub)) diff --git a/phone/src/main/res/values-ar/strings.xml b/phone/src/main/res/values-ar/strings.xml index 7f154eb..555351d 100644 --- a/phone/src/main/res/values-ar/strings.xml +++ b/phone/src/main/res/values-ar/strings.xml @@ -337,4 +337,15 @@ كلمة مرور النسخة الاحتياطية اتركها فارغة لنسخة عادية، أو ضع كلمة مرور لتشفيرها. أدخل كلمة مرور هذه النسخة. + 🎙 بريد صوتي %1$s + البريد الصوتي من SimBridge + تسمع المكالمات التي لم يُرد عليها ترحيبًا؛ وتصل الرسالة هنا مكتوبة. + تعديل ما يسمعه المتصلون + ترحيب البريد الصوتي + فرز المكالمات: يرد هاتف SIM ويسأل عن المتصل ويعرض الإجابة قبل أن يرن هاتفك. + الأرقام المجهولة + الأرقام المخفية + سؤال الفرز + %1$s يقول: + (تعذّر فهم ما قيل) diff --git a/phone/src/main/res/values-es/strings.xml b/phone/src/main/res/values-es/strings.xml index e7e49e5..85af2aa 100644 --- a/phone/src/main/res/values-es/strings.xml +++ b/phone/src/main/res/values-es/strings.xml @@ -337,4 +337,15 @@ Contraseña de la copia Déjalo vacío para una copia simple, o pon una contraseña para cifrarla. Introduce la contraseña de esta copia. + 🎙 Buzón de voz %1$s + Buzón de SimBridge + Las llamadas sin respuesta oyen un saludo; el mensaje llega aquí con su texto. + Editar lo que oyen las personas que llaman + Saludo del buzón + Filtrar llamadas: el teléfono SIM contesta, pregunta quién llama y te muestra la respuesta antes de que suene tu teléfono. + Números desconocidos + Números ocultos + Pregunta de filtrado + %1$s dice: + (No se entendió lo que dijo) diff --git a/phone/src/main/res/values-fa/strings.xml b/phone/src/main/res/values-fa/strings.xml index 5e741bc..d707631 100644 --- a/phone/src/main/res/values-fa/strings.xml +++ b/phone/src/main/res/values-fa/strings.xml @@ -337,4 +337,15 @@ رمز پشتیبان برای پشتیبان ساده خالی بگذارید یا برای رمزگذاری رمز بگذارید. رمز این پشتیبان را وارد کنید. + 🎙 پیام صوتی %1$s + پیام‌گیر SimBridge + تماس‌های بی‌پاسخ یک خوشامد می‌شنوند؛ پیام با متن نوشته‌شده به اینجا می‌رسد. + ویرایش آنچه تماس‌گیرندگان می‌شنوند + خوشامد پیام‌گیر + غربال تماس‌ها: گوشی سیم‌کارت پاسخ می‌دهد، می‌پرسد چه کسی است و پیش از زنگ گوشی شما پاسخ را نشان می‌دهد. + شماره‌های ناشناس + شماره‌های پنهان + پرسش غربال + %1$s می‌گوید: + (گفته‌ها قابل فهم نبود) diff --git a/phone/src/main/res/values-fr/strings.xml b/phone/src/main/res/values-fr/strings.xml index ada6f3c..08c38b1 100644 --- a/phone/src/main/res/values-fr/strings.xml +++ b/phone/src/main/res/values-fr/strings.xml @@ -337,4 +337,15 @@ Mot de passe de la sauvegarde Laissez vide pour une sauvegarde simple, ou définissez un mot de passe pour la chiffrer. Saisissez le mot de passe de cette sauvegarde. + 🎙 Message vocal %1$s + Messagerie SimBridge + Les appels sans réponse entendent une annonce ; le message arrive ici avec son texte. + Modifier ce qu\'entendent les appelants + Annonce de messagerie + Filtrer les appels : le téléphone SIM répond, demande qui appelle et vous montre la réponse avant que votre téléphone sonne. + Numéros inconnus + Numéros masqués + Question de filtrage + %1$s dit : + (Impossible de comprendre ce qui a été dit) diff --git a/phone/src/main/res/values-ru/strings.xml b/phone/src/main/res/values-ru/strings.xml index e51999b..08b61b7 100644 --- a/phone/src/main/res/values-ru/strings.xml +++ b/phone/src/main/res/values-ru/strings.xml @@ -337,4 +337,15 @@ Пароль резервной копии Оставьте пустым для обычной копии или задайте пароль для шифрования. Введите пароль этой копии. + 🎙 Голосовое сообщение %1$s + Автоответчик SimBridge + Неотвеченные звонки слышат приветствие; сообщение приходит сюда с текстом. + Изменить, что слышат звонящие + Приветствие автоответчика + Проверка звонков: SIM-телефон отвечает, спрашивает, кто звонит, и показывает ответ до того, как зазвонит ваш телефон. + Неизвестные номера + Скрытые номера + Вопрос для проверки + %1$s говорит: + (Не удалось разобрать сказанное) diff --git a/phone/src/main/res/values-tr/strings.xml b/phone/src/main/res/values-tr/strings.xml index 9f80e1c..a98f71c 100644 --- a/phone/src/main/res/values-tr/strings.xml +++ b/phone/src/main/res/values-tr/strings.xml @@ -372,4 +372,15 @@ Yedek şifresi Düz yedek için boş bırakın veya şifrelemek için bir şifre girin. Bu yedeğin şifresini girin. + 🎙 Sesli mesaj %1$s + SimBridge sesli mesaj + Cevapsız aramalar bir karşılama duyar; mesaj yazıya dökülmüş olarak buraya gelir. + Arayanların duyacaklarını düzenle + Sesli mesaj karşılaması + Aramaları filtrele: SIM telefon açar, kimin aradığını sorar ve telefonunuz çalmadan önce cevabı gösterir. + Bilinmeyen numaralar + Gizli numaralar + Filtreleme sorusu + %1$s diyor ki: + (Ne söylendiği anlaşılamadı) diff --git a/phone/src/main/res/values/strings.xml b/phone/src/main/res/values/strings.xml index 9d4cac7..ba170bd 100644 --- a/phone/src/main/res/values/strings.xml +++ b/phone/src/main/res/values/strings.xml @@ -373,4 +373,15 @@ Backup password Leave empty for a plain backup, or set a password to encrypt it. Enter the password of this backup. + 🎙 Voicemail %1$s + SimBridge voicemail + Unanswered calls get a greeting; the message arrives here with its words written out. + Edit what callers hear + Voicemail greeting + Screen calls: the SIM phone answers, asks who is calling, and shows you the answer before your phone rings. + Unknown numbers + Hidden numbers + Screening question + %1$s says: + (Couldn\'t make out what they said)