mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-09-04 08:13:23 +00:00
FIX - support configurable company service numbers
Company service lines were validated as full-length SIM numbers, which rejected short configured numbers such as 911 and stopped dependent server modules from initializing. Accept non-empty service numbers up to the configured SIM length, resolve configured service lines before direct SIM dialing for phone and payphone calls, and load Companies and SIM before Phone. Add focused normalization boundary tests.
This commit is contained in:
@@ -11,6 +11,17 @@ function SkyPhoneSimNumber.Normalize(value, length, prefix)
|
||||
return number
|
||||
end
|
||||
|
||||
function SkyPhoneSimNumber.NormalizeService(value, maximum_length)
|
||||
if type(value) ~= "string" and type(value) ~= "number" then
|
||||
return nil
|
||||
end
|
||||
local number = tostring(value):gsub("%D", "")
|
||||
if number == "" or #number > maximum_length then
|
||||
return nil
|
||||
end
|
||||
return number
|
||||
end
|
||||
|
||||
function SkyPhoneSimNumber.FromEntropy(entropy, length, prefix)
|
||||
if type(entropy) ~= "string" or entropy == "" then
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user