diff --git a/frontend/src/voiceProviders.contract.test.ts b/frontend/src/voiceProviders.contract.test.ts index 01bbf28..c086ce8 100644 --- a/frontend/src/voiceProviders.contract.test.ts +++ b/frontend/src/voiceProviders.contract.test.ts @@ -116,6 +116,21 @@ describe('voice provider contracts', () => { expect(phoneApp).not.toContain('callMuted = !callMuted') }) + it('keeps calls compatible with Yaca releases before the server status export', () => { + expect(serverVoice).toContain('is_missing_yaca_status_export') + expect(serverVoice).toContain('normalized:find("no such export", 1, true)') + expect(serverVoice).toContain('warned_about_legacy_yaca_status') + expect(serverVoice).toContain( + 'using legacy compatibility because yaca-voice is started', + ) + expect(serverVoice).toMatch( + /if is_missing_yaca_status_export\(enabled\) then[\s\S]*?return true/, + ) + expect(serverVoice).toMatch( + /if success then\s+return enabled == true\s+end/, + ) + }) + it('supports explicit automatic call-provider discovery on client and server', () => { expect(config).toContain( 'VoiceProvider = "pma", -- auto, yaca (alias: yaca-voice)', diff --git a/sky_phone/source/bridge/server/voice.lua b/sky_phone/source/bridge/server/voice.lua index 496806b..6982033 100644 --- a/sky_phone/source/bridge/server/voice.lua +++ b/sky_phone/source/bridge/server/voice.lua @@ -18,6 +18,13 @@ local radio_provider_aliases = { ["pma-voice"] = "pma", salty = "saltychat", } +local warned_about_legacy_yaca_status = false + +local function is_missing_yaca_status_export(error_message) + local normalized = tostring(error_message):lower() + return normalized:find("isenabled", 1, true) ~= nil + and normalized:find("no such export", 1, true) ~= nil +end local function yaca_is_enabled() if GetResourceState("yaca-voice") ~= "started" then @@ -27,16 +34,28 @@ local function yaca_is_enabled() local success, enabled = pcall(function() return exports["yaca-voice"]:isEnabled() end) - if not success then - Bridge.Debug( - "error", - "[sky_phone] Yaca could not report its availability: %s", - tostring(enabled), - { always = true } - ) - return false + if success then + return enabled == true end - return enabled == true + if is_missing_yaca_status_export(enabled) then + if not warned_about_legacy_yaca_status then + warned_about_legacy_yaca_status = true + Bridge.Debug( + "warn", + "[sky_phone] Yaca does not expose the server isEnabled status; using legacy compatibility because yaca-voice is started.", + { always = true } + ) + end + return true + end + + Bridge.Debug( + "error", + "[sky_phone] Yaca could not report its availability: %s", + tostring(enabled), + { always = true } + ) + return false end local function resolve_call_provider()