summaryrefslogtreecommitdiff
path: root/app/models/call.rb
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-05-29 13:52:44 +0200
committerPeter Kozak <spag@golwen.net>2013-05-29 13:52:44 +0200
commit50adbb4747ce93594686bf4a0b8193c923f9d129 (patch)
tree320a52c0e05abdb3a4123be216e0cb1dfe75a351 /app/models/call.rb
parent644a0cff1a3c91ed6c9c39b816fa6edfdf09c0cf (diff)
bridge method added
Diffstat (limited to 'app/models/call.rb')
-rw-r--r--app/models/call.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/app/models/call.rb b/app/models/call.rb
index a8a0d7f..2bbd08b 100644
--- a/app/models/call.rb
+++ b/app/models/call.rb
@@ -36,7 +36,7 @@ class Call < ActiveRecord::Base
def delete
require 'freeswitch_event'
- return FreeswitchAPI.execute('uuid_kill', self.uuid, true);
+ return FreeswitchAPI.execute('uuid_kill', self.uuid, true)
end
def transfer_blind(destination, call_leg=:aleg, auth_account=nil)
@@ -63,6 +63,25 @@ class Call < ActiveRecord::Base
return FreeswitchAPI.api_result(FreeswitchAPI.api('uuid_transfer', channel_uuid, destination))
end
+
+ def self.bridge(call_uuid1, call_uuid2, hangup_uuids=[])
+ if call_uuid1.blank? || call_uuid2.blank?
+ return nil
+ end
+
+ require 'freeswitch_event'
+ result = FreeswitchAPI.api_result(FreeswitchAPI.api('uuid_bridge', call_uuid1, call_uuid2))
+
+ if result
+ hangup_uuids.each do |kill_uuid|
+ FreeswitchAPI.execute('uuid_kill', kill_uuid, true)
+ end
+ end
+
+ return result
+ end
+
+
def get_variable_from_uuid(channel_uuid, variable_name)
if channel_uuid.blank?
return nil