diff --git a/app/assets/javascripts/app/controllers/cti.coffee b/app/assets/javascripts/app/controllers/cti.coffee index cd8ebf3a4..5bba344db 100644 --- a/app/assets/javascripts/app/controllers/cti.coffee +++ b/app/assets/javascripts/app/controllers/cti.coffee @@ -63,16 +63,17 @@ class App.CTI extends App.Controller ) notify: (data) -> - App.Event.trigger 'notify', { - type: 'notice' - msg: App.i18n.translateContent('Call from %s for %s', data.from, data.to) - timeout: 12000 - } + text = App.i18n.translateContent('Call from %s for %s', data.from_comment || data_from, data.to_comment || data.to) + title = App.Utils.html2text(text.replace(/<.+?>/g, '"')) + @notifyDesktop( + url: '#cti' + title: title + ) + App.OnlineNotification.play() featureActive: => return true - if @Config.get('sipgate_integration') - return true + return true if @Config.get('sipgate_integration') false render: -> @@ -98,6 +99,30 @@ class App.CTI extends App.Controller "#{mins}:#{secs}" for item in @list + if item.state is 'newCall' + item.state_human = 'ringing' + else if item.state is 'answer' + item.state_human = 'connected' + else if item.state is 'hangup' + if item.comment is 'cancel' + item.state_human = 'not reached' + else if item.comment is 'noAnswer' + item.state_human = 'not reached' + else if item.comment is 'congestion' + item.state_human = 'not reached' + else if item.comment is 'busy' + item.state_human = 'busy' + else if item.comment is 'notFound' + item.state_human = 'not exist' + else if item.comment is 'normalClearing' + item.state_human = '' + else + item.state_human = item.comment + else + item.state_human = item.state + if item.comment + item.state_human += ", #{item.comment}" + if item.start && item.end item.duration = format((Date.parse(item.end) - Date.parse(item.start))/1000) @html App.view('cti/index')( @@ -121,7 +146,11 @@ class App.CTI extends App.Controller @navupdate '#cti' counter: => - @meta.counter + count = 0 + for item in @list + if item.state is 'hangup' && !item.done + count++ + @meta.counter + count switch: (state = undefined) => diff --git a/app/assets/javascripts/app/views/cti/index.jst.eco b/app/assets/javascripts/app/views/cti/index.jst.eco index 313bb3b05..f4d637872 100644 --- a/app/assets/javascripts/app/views/cti/index.jst.eco +++ b/app/assets/javascripts/app/views/cti/index.jst.eco @@ -8,9 +8,8 @@ <%- @T('From') %> <%- @T('To') %> - <%- @T('State') %> - <%- @T('Comment') %> - <%- @T('Duration') %> + + <%- @T('Duration') %> <%- @T('Time') %> @@ -20,8 +19,7 @@ <% if item.state is 'hangup': %>checked<% end %>><% end %> <% if item.from_comment: %><%= item.from_comment %>
<% end %><%= item.from %> <% if item.to_comment: %><%= item.to_comment %>
<% end %><%= item.to %> - <%= item.state %> - <%= item.comment %> + <%- @T(item.state_human) %> <%= item.duration %> <%- @humanTime(item.created_at) %> diff --git a/app/models/cti/log.rb b/app/models/cti/log.rb index bf97b138a..39a94b056 100644 --- a/app/models/cti/log.rb +++ b/app/models/cti/log.rb @@ -11,9 +11,9 @@ module Cti Cti::Log.create( direction: 'in', from: '007', - from_comment: '', + from_comment: 'AAA', to: '008', - to_comment: '', + to_comment: 'BBB', call_id: '1', comment: '', state: 'newCall',