Class: LiveCallRouting::Twilio::V3Controller

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/pager_tree/integrations/live_call_routing/twilio/v3_controller.rb

Instance Method Summary collapse

Instance Method Details

#droppedObject



14
15
16
17
18
19
20
21
22
# File 'app/controllers/pager_tree/integrations/live_call_routing/twilio/v3_controller.rb', line 14

def dropped
  set_integration

  @integration.adapter_source_log = @integration.logs.create!(level: :info, format: :json, message: params.to_unsafe_h) if @integration.try(:log_incoming_requests?)
  @integration.adapter_controller = self
  @integration.adapter_alert = @integration.alerts.find_by(thirdparty_id: params[:CallSid])
  @integration.adapter_incoming_request_params = params
  @integration.adapter_response_dropped
end

#musicObject



5
6
7
8
9
10
11
12
# File 'app/controllers/pager_tree/integrations/live_call_routing/twilio/v3_controller.rb', line 5

def music
  set_integration

  @integration.adapter_source_log = @integration.logs.create!(level: :info, format: :json, message: params.to_unsafe_h) if @integration.try(:log_incoming_requests?)
  @integration.adapter_controller = self
  @integration.adapter_incoming_request_params = params
  @integration.adapter_response_music
end

#queue_statusObject



24
25
26
27
28
# File 'app/controllers/pager_tree/integrations/live_call_routing/twilio/v3_controller.rb', line 24

def queue_status
  ::PagerTree::Integrations.deferred_request_class.constantize.perform_later_from_request!(request)

  head :ok
end

#queue_status_deferred(deferred_request) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/controllers/pager_tree/integrations/live_call_routing/twilio/v3_controller.rb', line 30

def queue_status_deferred(deferred_request)
  params = deferred_request.params

  id = params.dig("id")
  @integration = find_integration(id)

  deferred_request. = @integration.

  @integration.adapter_source_log = @integration.logs.create!(level: :info, format: :json, message: deferred_request.request) if @integration.log_incoming_requests?
  @integration.adapter_incoming_request_params = params
  @integration.adapter_incoming_deferred_request = deferred_request

  @integration.adapter_process_queue_status_deferred
end