Skip to content
Permalink
Browse files

Implemented CTI ticket create screen popup on answering call.

  • Loading branch information...
zammad-sync committed Jul 9, 2019
1 parent 9503ff2 commit 7faa4c310d5bb54116871b78c18f2e7507d0d162
Showing with 1,839 additions and 462 deletions.
  1. +3 −3 LICENSE-3RD-PARTY.txt
  2. +83 −0 app/assets/javascripts/app/controllers/_integration/cti.coffee
  3. +39 −4 app/assets/javascripts/app/controllers/_integration/placetel.coffee
  4. +38 −0 app/assets/javascripts/app/controllers/_integration/sipgate_io.coffee
  5. +1 −1 app/assets/javascripts/app/controllers/agent_ticket_create.coffee
  6. +78 −7 app/assets/javascripts/app/controllers/cti.coffee
  7. +15 −0 app/assets/javascripts/app/controllers/widget/remote_task.coffee
  8. +14 −0 app/assets/javascripts/app/lib/mixins/view_helpers.coffee
  9. +56 −33 app/assets/javascripts/app/views/cti/caller_log.jst.eco
  10. +2 −0 app/assets/javascripts/app/views/cti/caller_log_avatar.jst.eco
  11. +27 −0 app/assets/javascripts/app/views/integration/cti.jst.eco
  12. +28 −1 app/assets/javascripts/app/views/integration/placetel.jst.eco
  13. +47 −1 app/assets/javascripts/app/views/integration/sipgate.jst.eco
  14. +1 −1 app/assets/javascripts/app/views/navigation/menu.jst.eco
  15. +60 −0 app/assets/javascripts/app/views/navigation/menu_cti_ringing.jst.eco
  16. +87 −3 app/assets/stylesheets/zammad.scss
  17. +1 −1 app/controllers/cti_controller.rb
  18. +30 −66 app/controllers/integration/cti_controller.rb
  19. +35 −157 app/controllers/integration/placetel_controller.rb
  20. +45 −70 app/controllers/integration/sipgate_controller.rb
  21. +26 −0 app/models/cti/caller_id.rb
  22. +223 −0 app/models/cti/driver/base.rb
  23. +7 −0 app/models/cti/driver/cti.rb
  24. +139 −0 app/models/cti/driver/placetel.rb
  25. +107 −0 app/models/cti/driver/sipgate_io.rb
  26. +88 −28 app/models/cti/log.rb
  27. +2 −2 config/routes/integration_sipgate.rb
  28. +33 −0 spec/models/cti/caller_id_spec.rb
  29. +217 −7 spec/models/cti/log_spec.rb
  30. +301 −71 spec/requests/integration/cti_spec.rb
  31. +6 −6 test/browser/integration_cti_test.rb
@@ -57,7 +57,7 @@ License: MIT license
highlight.pack.js
Source: https://highlightjs.org
Copyright: 2006 Ivan Sagalaev (https://github.com/isagalaev)
License: BSD License
License: BSD License (BSD-3-Clause)
-----------------------------------------------------------------------------
jquery.flot.js
Source: https://github.com/dnschnur/flot
@@ -74,7 +74,7 @@ jquery.fineuploader-3.0.js
Source: http://github.com/Valums-File-Uploader/file-uploader
Copyright: 2010 Andrew Valums <andrew(at)valums.com>
2012 Ray Nicholus <fineuploader(at)garstasio.com>
License: MIT license, GNU GPL 2 or later, GNU LGPL 2 or later
License: GNU GPL 2 or later, GNU LGPL 2 or later
-----------------------------------------------------------------------------
jquery.noty.js
Source: https://github.com/needim/noty/
@@ -171,7 +171,7 @@ License: MIT license
Font Awesome icon font
Source: http://fontawesome.io/
Copyright: Font Awesome by Dave Gandy - http://fontawesome.io
License: SIL OFL 1.1
License: MIT License
-----------------------------------------------------------------------------
Simple line icons font
Source: https://github.com/thesabbir/simple-line-icons
@@ -26,8 +26,10 @@ class Form extends App.Controller
'submit form': 'update'
'click .js-inboundBlockCallerId .js-add': 'addInboundBlockCallerId'
'click .js-outboundRouting .js-add': 'addOutboundRouting'
'click .js-notifyMap .js-addMap': 'addNotifyMap'
'click .js-inboundBlockCallerId .js-remove': 'removeInboundBlockCallerId'
'click .js-outboundRouting .js-remove': 'removeOutboundRouting'
'click .js-notifyMap .js-removeMap': 'removeNotifyMap'

constructor: ->
super
@@ -43,6 +45,8 @@ class Form extends App.Controller
config.inbound = {}
if !config.inbound.block_caller_ids
config.inbound.block_caller_ids = []
if !config.notify_map
config.notify_map = []
config

setConfig: (value) ->
@@ -56,6 +60,32 @@ class Form extends App.Controller
cti_token: App.Setting.get('cti_token')
)

# placeholder
configure_attributes = [
{ name: 'user_ids', display: '', tag: 'column_select', multiple: true, null: true, relation: 'User', sortBy: 'firstname' },
]
new App.ControllerForm(
el: @$('.js-userSelectorBlank')
model:
configure_attributes: configure_attributes,
params:
user_ids: []
autofocus: false
)

for row in @config.notify_map
configure_attributes = [
{ name: 'user_ids', display: '', tag: 'column_select', multiple: true, null: true, relation: 'User', sortBy: 'firstname' },
]
new App.ControllerForm(
el: @$("[name=queue][value='#{row.queue}']").closest('tr').find('.js-userSelector')
model:
configure_attributes: configure_attributes,
params:
user_ids: row.user_ids
autofocus: false
)

updateCurrentConfig: =>
config = @config
cleanupInput = @cleanupInput
@@ -88,6 +118,17 @@ class Form extends App.Controller
}
)

# notify map
config.notify_map = []
@$('.js-notifyMap .js-row').each(->
queue = $(@).find('input[name="queue"]').val()
user_ids = $(@).find('select[name="user_ids"]').val()
config.notify_map.push {
queue: cleanupInput(queue)
user_ids: user_ids
}
)

@config = config

update: (e) =>
@@ -127,6 +168,41 @@ class Form extends App.Controller
}
@render()

addNotifyMap: (e) =>
e.preventDefault()
@updateCurrentConfig()
element = $(e.currentTarget).closest('tr')
queue = @cleanupInput(element.find('input[name="queue"]').val())
user_ids = element.find('select[name="user_ids"]').val()
if _.isEmpty(queue)
@notify(
type: 'error'
msg: App.i18n.translateContent('A queue is required!')
timeout: 6000
)
return
if _.isEmpty(user_ids)
@notify(
type: 'error'
msg: App.i18n.translateContent('A user is required!')
timeout: 6000
)
return

for row in @config.notify_map
if row.queue is queue
@notify(
type: 'error'
msg: App.i18n.translateContent('Queue already exists!')
timeout: 6000
)
return
@config.notify_map.push {
queue: queue
user_ids: user_ids
}
@render()

removeInboundBlockCallerId: (e) =>
e.preventDefault()
@updateCurrentConfig()
@@ -141,6 +217,13 @@ class Form extends App.Controller
element.remove()
@updateCurrentConfig()

removeNotifyMap: (e) =>
e.preventDefault()
@updateCurrentConfig()
element = $(e.currentTarget).closest('tr')
element.remove()
@updateCurrentConfig()

class State
@current: ->
App.Setting.get('cti_integration')
@@ -25,9 +25,11 @@ class Form extends App.Controller
events:
'submit form': 'update'
'click .js-inboundBlockCallerId .js-add': 'addInboundBlockCallerId'
'click .js-outboundRouting .js-add': 'addOutboundRouting'
'click .js-inboundBlockCallerId .js-remove': 'removeInboundBlockCallerId'
'click .js-outboundRouting .js-add': 'addOutboundRouting'
'click .js-outboundRouting .js-remove': 'removeOutboundRouting'
'click .js-userDeviceMap .js-add': 'addUserDeviceMap'
'click .js-userDeviceMap .js-remove': 'removeUserDeviceMap'

constructor: ->
super
@@ -43,6 +45,8 @@ class Form extends App.Controller
config.inbound = {}
if !config.inbound.block_caller_ids
config.inbound.block_caller_ids = []
if !config.user_device_map
config.user_device_map = []
config

setConfig: (value) ->
@@ -60,7 +64,7 @@ class Form extends App.Controller
config = @config
cleanupInput = @cleanupInput

config.api_token = @$('input[name=api_token]').val()
config.api_token = cleanupInput(@$('input[name=api_token]').val())

# default caller_id
default_caller_id = @$('input[name=default_caller_id]').val()
@@ -90,6 +94,17 @@ class Form extends App.Controller
}
)

# user device map
config.user_device_map = []
@$('.js-userDeviceMap .js-row').each(->
device_id = $(@).find('input[name="device_id"]').val()
user_id = $(@).find('input[name="user_id"]').val()
config.user_device_map.push {
device_id: device_id
user_id: user_id
}
)

@config = config

update: (e) =>
@@ -114,6 +129,13 @@ class Form extends App.Controller
}
@render()

removeInboundBlockCallerId: (e) =>
e.preventDefault()
@updateCurrentConfig()
element = $(e.currentTarget).closest('tr')
element.remove()
@updateCurrentConfig()

addOutboundRouting: (e) =>
e.preventDefault()
@updateCurrentConfig()
@@ -129,14 +151,27 @@ class Form extends App.Controller
}
@render()

removeInboundBlockCallerId: (e) =>
removeOutboundRouting: (e) =>
e.preventDefault()
@updateCurrentConfig()
element = $(e.currentTarget).closest('tr')
element.remove()
@updateCurrentConfig()

removeOutboundRouting: (e) =>
addUserDeviceMap: (e) =>
e.preventDefault()
@updateCurrentConfig()
element = $(e.currentTarget).closest('tr')
user_id = @cleanupInput(element.find('input[name="user_id"]').val())
device_id = @cleanupInput(element.find('input[name="device_id"]').val())
return if _.isEmpty(user_id) || _.isEmpty(device_id)
@config.user_device_map.push {
user_id: user_id
device_id: device_id
}
@render()

removeUserDeviceMap: (e) =>
e.preventDefault()
@updateCurrentConfig()
element = $(e.currentTarget).closest('tr')
@@ -28,6 +28,8 @@ class Form extends App.Controller
'click .js-outboundRouting .js-add': 'addOutboundRouting'
'click .js-inboundBlockCallerId .js-remove': 'removeInboundBlockCallerId'
'click .js-outboundRouting .js-remove': 'removeOutboundRouting'
'click .js-userRemoteMap .js-add': 'addUserRemoteMap'
'click .js-userRemoteMap .js-remove': 'removeUserRemoteMap'

constructor: ->
super
@@ -43,6 +45,8 @@ class Form extends App.Controller
config.inbound = {}
if !config.inbound.block_caller_ids
config.inbound.block_caller_ids = []
if !config.user_remote_map
config.user_remote_map = []
config

setConfig: (value) ->
@@ -59,6 +63,9 @@ class Form extends App.Controller
config = @config
cleanupInput = @cleanupInput

config.api_user = cleanupInput(@$('input[name=api_user]').val())
config.api_password = cleanupInput(@$('input[name=api_password]').val())

# default caller_id
default_caller_id = @$('input[name=default_caller_id]').val()
config.outbound.default_caller_id = cleanupInput(default_caller_id)
@@ -87,6 +94,17 @@ class Form extends App.Controller
}
)

# user device map
config.user_remote_map = []
@$('.js-userRemoteMap .js-row').each(->
remote_user_id = $(@).find('input[name="remote_user_id"]').val()
user_id = $(@).find('input[name="user_id"]').val()
config.user_remote_map.push {
remote_user_id: remote_user_id
user_id: user_id
}
)

@config = config

update: (e) =>
@@ -140,6 +158,26 @@ class Form extends App.Controller
element.remove()
@updateCurrentConfig()

addUserRemoteMap: (e) =>
e.preventDefault()
@updateCurrentConfig()
element = $(e.currentTarget).closest('tr')
user_id = @cleanupInput(element.find('input[name="user_id"]').val())
remote_user_id = @cleanupInput(element.find('input[name="remote_user_id"]').val())
return if _.isEmpty(user_id) || _.isEmpty(remote_user_id)
@config.user_remote_map.push {
user_id: user_id
remote_user_id: remote_user_id
}
@render()

removeUserRemoteMap: (e) =>
e.preventDefault()
@updateCurrentConfig()
element = $(e.currentTarget).closest('tr')
element.remove()
@updateCurrentConfig()

class State
@current: ->
App.Setting.get('sipgate_integration')
@@ -199,7 +199,7 @@ class App.TicketCreate extends App.Controller

if _.isEmpty(params.ticket_id) && _.isEmpty(params.article_id)
if !_.isEmpty(params.customer_id)
@renderQueue(options: { customer_id: params.customer_id })
@renderQueue(options: params)
return
@renderQueue()
return

0 comments on commit 7faa4c3

Please sign in to comment.
You can’t perform that action at this time.