class AsteriskManager::Call
Attributes
channel_1[RW]
channel_2[RW]
created_at[RW]
Public Class Methods
calls()
click to toggle source
# File lib/asterisk-manager/call.rb, line 25 def self.calls @calls ||= {} end
for_channel_1_and_channel_2(channel_1, channel_2)
click to toggle source
# File lib/asterisk-manager/call.rb, line 29 def self.for_channel_1_and_channel_2(channel_1, channel_2) calls[ [ channel_1, channel_2 ] ] ||= new(channel_1: channel_1, channel_2: channel_2) end
new(arguments = {})
click to toggle source
# File lib/asterisk-manager/call.rb, line 7 def initialize(arguments = {}) self.channel_1 = arguments[:channel_1] self.channel_2 = arguments[:channel_2] self.created_at = Time.now end
Public Instance Methods
duration()
click to toggle source
# File lib/asterisk-manager/call.rb, line 17 def duration x = seconds.round hours = x / 3600 minutes = (x - hours * 3600) / 60 seconds = (x - hours * 3600 - minutes * 60) "#{hours}:#{'%02d' % minutes}:#{'%02d' % seconds}" end
seconds()
click to toggle source
# File lib/asterisk-manager/call.rb, line 13 def seconds Time.now - created_at end