diff options
author | Peter Kozak <spag@golwen.net> | 2013-03-09 03:00:38 -0500 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-03-09 03:00:38 -0500 |
commit | 75a0be231d264a2fbae4ce97a28deb2b66b19bb9 (patch) | |
tree | 06fa3ddc1647593018825ca8526e8a5121cd9e1f /misc/freeswitch/scripts | |
parent | b0913ad86e3f90527310607d45b4228b97a58ffc (diff) |
control event added
Diffstat (limited to 'misc/freeswitch/scripts')
-rw-r--r-- | misc/freeswitch/scripts/event/perimeter_defense.lua | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/misc/freeswitch/scripts/event/perimeter_defense.lua b/misc/freeswitch/scripts/event/perimeter_defense.lua index acdfa8d..5bd124b 100644 --- a/misc/freeswitch/scripts/event/perimeter_defense.lua +++ b/misc/freeswitch/scripts/event/perimeter_defense.lua @@ -31,9 +31,10 @@ end function PerimeterDefense.event_handlers(self) return { CUSTOM = { - ['sofia::pre_register'] = self.sofia_pre_register, - ['sofia::register_attempt'] = self.sofia_register_attempt, - ['sofia::register_failure'] = self.sofia_register_failure, + ['sofia::pre_register'] = self.sofia_pre_register, + ['sofia::register_attempt'] = self.sofia_register_attempt, + ['sofia::register_failure'] = self.sofia_register_failure, + ['perimeter::control'] = self.perimeter_control, }, CHANNEL_HANGUP = { [true] = self.channel_hangup }, }; @@ -112,3 +113,20 @@ function PerimeterDefense.channel_hangup(self, event) local record = self:to_call_record(event, 'channel_hangup'); self.perimeter:check(record); end + + +function PerimeterDefense.control_to_action(self, event) + return { + key = event:getHeader('key'), + }; +end + + +function PerimeterDefense.perimeter_control(self, event) + local action = event:getHeader('action'); + if self.perimeter['action_' .. action] then + self.perimeter['action_' .. action](self.perimeter, self:control_to_action(event)) + else + self.log:error('[perimeter_defense] PERIMETER_DEFENSE - could not execute action: ', action); + end +end |