Skip to content

Commit

Permalink
Fixes zammad#3247 - CTI-API should handle doubled requests better.
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfschmidt authored and thorsteneckel committed Jul 19, 2021
1 parent b8b5778 commit b3da6d3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/models/cti/driver/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ def process
end

log = Cti::Log.process(@params)
if log.present?

# push new call notification
push_incoming_call(log)
# push new call notification
push_incoming_call(log)

# open screen if call got answered
push_open_ticket_screen(log)
# open screen if call got answered
push_open_ticket_screen(log)
end

result || {}
end
Expand Down
12 changes: 12 additions & 0 deletions spec/requests/integration/cti_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,18 @@

travel 1.second

# inbound - I - answer for hangup by customer
post "/api/v1/cti/#{token}", params: {
event: 'answer',
direction: 'in',
call_id: '1234567890-3',
to: '4930600000000',
from: '4912347114711',
}, as: :json
expect(response).to have_http_status(:ok)

travel 1.second

# inbound - II - new call
post "/api/v1/cti/#{token}", params: {
event: 'newCall',
Expand Down

0 comments on commit b3da6d3

Please sign in to comment.