diff options
Diffstat (limited to 'app/models/sip_account.rb')
-rw-r--r-- | app/models/sip_account.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/app/models/sip_account.rb b/app/models/sip_account.rb index 668fbfe..a2644e9 100644 --- a/app/models/sip_account.rb +++ b/app/models/sip_account.rb @@ -154,14 +154,15 @@ class SipAccount < ActiveRecord::Base return SipRegistration.where(:sip_user => self.auth_name).first end - def call( phone_number, origin_cid_number = nil, origin_cid_name = 'Call' ) - origin_cid_number = origin_cid_number || phone_number + 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='#{phone_number}',origination_caller_id_name='#{origin_cid_name}'}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) |