diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/pager_group.rb | 13 |
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 |