From 710d68268f61d88af2b8300e047f17942f7c6762 Mon Sep 17 00:00:00 2001 From: clerie Date: Sat, 3 Sep 2022 08:58:24 +0200 Subject: [PATCH] Don't allow extensions to be a prefix of other extensions --- fieldpoc/extensions.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fieldpoc/extensions.py b/fieldpoc/extensions.py index b0fac2e..0de5902 100644 --- a/fieldpoc/extensions.py +++ b/fieldpoc/extensions.py @@ -34,6 +34,10 @@ class ExtensionConfig: raise Exception("static_target is required for static extension {}".format(self.num)) 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": for member in self.callgroup_members: if member not in extensions.extensions_by_num.keys():