ADD - expand phone application platform

Add the Companies app, resilient call handling, custom app registry, vendor compatibility, storage policies, frontend bridge, tests, documentation, config, locale, and SQL migrations.
This commit is contained in:
Leon.Schmidt
2026-08-11 00:22:39 +02:00
parent 72e5f91e02
commit 42ac955052
77 changed files with 17630 additions and 333 deletions
+24
View File
@@ -27,6 +27,9 @@ end
local function reserve_sim(sim_type)
local sim_id
local number = SkyPhoneSimNumber.Reserve(uuid, function(candidate)
if SkyPhoneCompanies.IsServiceNumber(candidate) then
return false
end
sim_id = uuid()
local result = Bridge.Database.Query([[
INSERT IGNORE INTO `sky_phone_sims` (`id`, `phone_number`, `sim_type`)
@@ -85,6 +88,15 @@ local function ensure_sim(source, slot, sim_type)
if metadata.sim_id and (not sim or sim.sim_type ~= sim_type or sim.phone_number ~= metadata.phone_number) then
return nil, "invalid_sim"
end
if sim and SkyPhoneCompanies.IsServiceNumber(sim.phone_number) then
Bridge.Debug(
"error",
"[sky_phone] SIM %s uses reserved company service number %s.",
tostring(sim.id),
tostring(sim.phone_number)
)
return nil, "invalid_sim"
end
if not sim then
sim = reserve_sim(sim_type)
if not Bridge.Inventory.SetSlotMetadata(source, slot.slot, sim_metadata(sim)) then
@@ -129,6 +141,16 @@ local function insert_sim(source, phone_imei, confirmed)
pending_insertions[source] = nil
return { success = false, error = "sim_request_expired" }
end
if SkyPhoneCompanies.IsServiceNumber(pending.sim.phone_number) then
pending_insertions[source] = nil
Bridge.Debug(
"error",
"[sky_phone] Refused to insert SIM %s with reserved company service number %s.",
tostring(pending.sim.id),
tostring(pending.sim.phone_number)
)
return { success = false, error = "invalid_sim" }
end
local sim_slot = Bridge.Inventory.GetSlot(source, pending.slot)
if not sim_slot or sim_slot.name ~= pending.item_name or not sim_slot.metadata
or sim_slot.metadata.sim_id ~= pending.sim.id then
@@ -203,6 +225,7 @@ local function insert_sim(source, phone_imei, confirmed)
pending_insertions[source] = nil
operation_locks[source] = nil
if old_sim then
SkyPhoneCompanies.ClearCallAvailability(source)
SkyPhoneCalls.EndForSim(old_sim.id, "sim_removed")
end
SkyPhone.RefreshDevice(phone_imei)
@@ -304,6 +327,7 @@ Bridge.Callbacks.Register("sky_phone:sim:eject", function(source)
return { success = false, error = "request_failed" }
end
operation_locks[source] = nil
SkyPhoneCompanies.ClearCallAvailability(source)
SkyPhoneCalls.EndForSim(sim.id, "sim_removed")
SkyPhone.RefreshDevice(session.imei)
return { success = true }