From 51c51156e22b16fb5c120aed8dfef13a2d10b465 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Thu, 27 Jun 2013 14:59:00 +0200 Subject: call method returns call_uuid --- app/models/sip_account.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'app/models/sip_account.rb') diff --git a/app/models/sip_account.rb b/app/models/sip_account.rb index fea5f3e..a2644e9 100644 --- a/app/models/sip_account.rb +++ b/app/models/sip_account.rb @@ -156,11 +156,13 @@ class SipAccount < ActiveRecord::Base def call( phone_number, caller_id_number = nil, caller_id_name = 'Call', auto_answer = false ) require 'freeswitch_event' - return FreeswitchAPI.execute( + origination_uuid = UUID.new.generate + if FreeswitchAPI.execute( 'originate', - "{origination_uuid=#{UUID.new.generate},origination_caller_id_number='#{caller_id_number||phone_number}',origination_caller_id_name='#{caller_id_name}',sip_auto_answer='#{auto_answer}'}user/#{self.auth_name} #{phone_number}", - true - ); + "{origination_uuid=#{origination_uuid},origination_caller_id_number='#{caller_id_number||phone_number}',origination_caller_id_name='#{caller_id_name}',sip_auto_answer='#{auto_answer}'}user/#{self.auth_name} #{phone_number}", + true) + return origination_uuid + end end def target_group_ids_by_permission(permission) -- cgit v1.2.3