From 50adbb4747ce93594686bf4a0b8193c923f9d129 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Wed, 29 May 2013 13:52:44 +0200 Subject: bridge method added --- app/models/call.rb | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'app/models/call.rb') 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 -- cgit v1.2.3