summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts/common/perimeter.lua
diff options
context:
space:
mode:
Diffstat (limited to 'misc/freeswitch/scripts/common/perimeter.lua')
-rw-r--r--misc/freeswitch/scripts/common/perimeter.lua32
1 files changed, 29 insertions, 3 deletions
diff --git a/misc/freeswitch/scripts/common/perimeter.lua b/misc/freeswitch/scripts/common/perimeter.lua
index 0815d33..8ad38d3 100644
--- a/misc/freeswitch/scripts/common/perimeter.lua
+++ b/misc/freeswitch/scripts/common/perimeter.lua
@@ -94,12 +94,24 @@ end
function Perimeter.check(self, event)
- if not event or not event.key then
- self.log:warning('[perimeter] PERIMETER_CHECK - no event/key');
+ if not type(event) == 'list' then
+ self.log:warning('[perimeter] PERIMETER_CHECK - no event data');
+ return;
+ end
+ if not event.key then
+ self.log:warning('[perimeter] PERIMETER_CHECK - no key');
+ for key, value in pairs() do
+ self.log:debug('[perimeter] PERIMETER_CHECK event_data - "', key, '" = "', value, '"');
+ end
return;
end
- event.record = self:record_load(event);
+ event.record = self:record_load(event);
+
+ if event.record.ignore then
+ return
+ end
+
if event.record.banned <= self.ban_tries then
for check_name, check_points in pairs(self.checks[event.action]) do
if self.checks_available[check_name] then
@@ -239,3 +251,17 @@ function Perimeter.expand_variables(self, line, variables)
return variables[captured] or '';
end))
end
+
+
+function Perimeter.action_db_rescan(self, record)
+ require 'common.str';
+ require 'common.intruder';
+
+ if common.str.blank(record.key) then
+ self.log:info('[perimeter] PERIMETER rescan entire sources database');
+ self.sources = common.intruder.Intruder:new{ log = self.log, database = self.database }:sources_list();
+ else
+ self.log:info('[perimeter] PERIMETER rescan sources database - key: ', record.key);
+ self.sources[record.key] = common.intruder.Intruder:new{ log = self.log, database = self.database }:sources_list(record.key);
+ end
+end