FIX - support legacy YACA availability

This commit is contained in:
Dominik9906
2026-08-29 00:27:53 +02:00
parent 04969e7ec0
commit f063e1ec67
2 changed files with 43 additions and 9 deletions
@@ -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)',
+28 -9
View File
@@ -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()