Don't allow extensions to be a prefix of other extensions

This commit is contained in:
clerie 2022-09-03 08:58:24 +02:00
parent 6a227b4dce
commit 710d68268f

View File

@ -34,6 +34,10 @@ class ExtensionConfig:
raise Exception("static_target is required for static extension {}".format(self.num)) raise Exception("static_target is required for static extension {}".format(self.num))
def check_global(self, extensions): def check_global(self, extensions):
for e in extensions.extensions:
if e.num != self.num and e.num.startswith(self.num):
raise Exception("Extension {} uses {} as prefix, which is already defined as an extension".format(e.num, self.num))
if self.type == "callgroup": if self.type == "callgroup":
for member in self.callgroup_members: for member in self.callgroup_members:
if member not in extensions.extensions_by_num.keys(): if member not in extensions.extensions_by_num.keys():