summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-03-09 03:01:56 -0500
committerPeter Kozak <spag@golwen.net>2013-03-09 03:01:56 -0500
commitbc450bb73fea9e8eb363f89e806e4f6084cf0511 (patch)
treea83fefc84f69dc00781302a17ffd292752bbc35e
parent923a758a963c791c0b79f1fe58b6b3447bd2a310 (diff)
perimeter control method added
-rw-r--r--app/models/intruder.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/intruder.rb b/app/models/intruder.rb
index 9a1c39a..bdfa753 100644
--- a/app/models/intruder.rb
+++ b/app/models/intruder.rb
@@ -50,6 +50,17 @@ class Intruder < ActiveRecord::Base
}
end
+ def self.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)
+ end
+ return event.fire()
+ end
+
private
def set_key_if_empty
if self.key.blank?