diff --git a/app/assets/javascripts/app/controllers/cti.coffee b/app/assets/javascripts/app/controllers/cti.coffee index ffc5579c7..00c672cd8 100644 --- a/app/assets/javascripts/app/controllers/cti.coffee +++ b/app/assets/javascripts/app/controllers/cti.coffee @@ -106,14 +106,11 @@ class App.CTI extends App.Controller return format = (time) -> - # Minutes and seconds - mins = ~~(time / 60) - secs = time % 60 # Hours, minutes and seconds - hrs = ~~(time / 3600) - mins = ~~((time % 3600) / 60) - secs = time % 60 + hrs = ~~parseInt((time / 3600)) + mins = ~~parseInt(((time % 3600) / 60)) + secs = parseInt(time % 60) # Output like "1:01" or "4:03:59" or "123:03:59" mins = "0#{mins}" if mins < 10 diff --git a/app/models/cti/log.rb b/app/models/cti/log.rb index a551a5a6b..d72de8ce0 100644 --- a/app/models/cti/log.rb +++ b/app/models/cti/log.rb @@ -43,6 +43,178 @@ module Cti state: 'hangup', ) +example data, can be used for demo + + Cti::Log.create( + direction: 'in', + from: '4930609854180', + from_comment: 'Franz Bauer', + to: '4930609811111', + to_comment: 'Bob Smith', + call_id: '00001', + comment: '', + state: 'newCall', + done: false, + preferences: { + from: [ + { + caller_id: '4930726128135', + comment: nil, + level: 'known', + object: 'User', + o_id: 2, + user_id: 2, + } + ] + } + ) + + Cti::Log.create( + direction: 'out', + from: '4930609854180', + from_comment: 'Franz Bauer', + to: '4930609811111', + to_comment: 'Bob Smith', + call_id: '00002', + comment: '', + state: 'newCall', + preferences: { + to: [ + { + caller_id: '4930726128135', + comment: nil, + level: 'known', + object: 'User', + o_id: 2, + user_id: 2, + } + ] + } + ) + + Cti::Log.create( + direction: 'in', + from: '4930609854180', + from_comment: 'Franz Bauer', + to: '4930609811111', + to_comment: 'Bob Smith', + call_id: '00003', + comment: '', + state: 'answer', + preferences: { + from: [ + { + caller_id: '4930726128135', + comment: nil, + level: 'known', + object: 'User', + o_id: 2, + user_id: 2, + } + ] + } + ) + + Cti::Log.create( + direction: 'in', + from: '4930609854180', + from_comment: 'Franz Bauer', + to: '4930609811111', + to_comment: 'Bob Smith', + call_id: '00004', + comment: '', + state: 'hangup', + comment: 'normalClearing', + done: false, + preferences: { + from: [ + { + caller_id: '4930726128135', + comment: nil, + level: 'known', + object: 'User', + o_id: 2, + user_id: 2, + } + ] + } + ) + + Cti::Log.create( + direction: 'in', + from: '4930609854180', + from_comment: 'Franz Bauer', + to: '4930609811111', + to_comment: 'Bob Smith', + call_id: '00005', + comment: '', + state: 'hangup', + start: Time.zone.now - 15.seconds, + 'end': Time.zone.now, + preferences: { + from: [ + { + caller_id: '4930726128135', + comment: nil, + level: 'known', + object: 'User', + o_id: 2, + user_id: 2, + } + ] + } + ) + + Cti::Log.create( + direction: 'in', + from: '4930609854180', + from_comment: 'Franz Bauer', + to: '4930609811111', + to_comment: '', + call_id: '00006', + comment: '', + state: 'hangup', + start: Time.zone.now - 15.seconds, + 'end': Time.zone.now, + preferences: { + from: [ + { + caller_id: '4930726128135', + comment: nil, + level: 'known', + object: 'User', + o_id: 2, + user_id: 2, + } + ] + } + ) + + Cti::Log.create( + direction: 'in', + from: '4930609854180', + from_comment: 'Franz Bauer', + to: '4930609811111', + to_comment: 'Bob Smith', + call_id: '00007', + comment: '', + state: 'hangup', + start: Time.zone.now - 15.seconds, + 'end': Time.zone.now, + preferences: { + from: [ + { + caller_id: '4930726128135', + comment: nil, + level: 'maybe', + object: 'User', + o_id: 2, + user_id: 2, + } + ] + } + ) + =end =begin