summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-03-09 03:56:10 -0500
committerPeter Kozak <spag@golwen.net>2013-03-09 03:56:10 -0500
commitcf506e96cfdd2f399934251f79c6f681503b7d5f (patch)
tree5bc9b5a357fcdf29c2af4ad4aba674f7853e2b50 /app/models
parentbc450bb73fea9e8eb363f89e806e4f6084cf0511 (diff)
perimeter_db_rescan class, instance methods added
Diffstat (limited to 'app/models')
-rw-r--r--app/models/intruder.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/models/intruder.rb b/app/models/intruder.rb
index bdfa753..97120a7 100644
--- a/app/models/intruder.rb
+++ b/app/models/intruder.rb
@@ -50,13 +50,23 @@ class Intruder < ActiveRecord::Base
}
end
- def self.control(action, attributes={})
+ def perimeter_db_rescan
+ Intruder.perimeter_control(:db_rescan, :key => self.key)
+ end
+
+ def self.perimeter_db_rescan(key=nil)
+ Intruder.perimeter_control(:db_rescan, :key => key)
+ end
+
+ def self.perimeter_control(action, attributes={})
require 'freeswitch_event'
event = FreeswitchEvent.new('CUSTOM')
event.add_header('Event-Subclass', 'perimeter::control')
event.add_header('action', action)
attributes.each do |name, value|
- event.add_header(name, value)
+ if !name.blank? && value then
+ event.add_header(name, value)
+ end
end
return event.fire()
end