summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-06-04 13:09:25 +0200
committerPeter Kozak <spag@golwen.net>2013-06-04 13:09:25 +0200
commit67b1a49f66be8051e7a6b550d416553b1df472f4 (patch)
treecc3c9cddc507401e80f3a535136634ea869e7daf
parent63f253ee3786fdf2970a64b2bbfea5c2ee89b09f (diff)
hangup_all method added
-rw-r--r--app/models/pager_group.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/pager_group.rb b/app/models/pager_group.rb
index 21396ef..5c9c6ad 100644
--- a/app/models/pager_group.rb
+++ b/app/models/pager_group.rb
@@ -7,8 +7,21 @@ class PagerGroup < ActiveRecord::Base
validates_presence_of :sip_account_id
after_create :call
+ before_destroy :hangup_all
+
+ def identifier
+ "pager#{self.id}"
+ end
def call
self.sip_account.call("f-pager-#{self.id}")
end
+
+ def hangup_all
+ require 'freeswitch_event'
+ return FreeswitchAPI.execute(
+ 'conference', "#{self.identifier} hup all",
+ true
+ );
+ end
end