Class: Telephony::Inbound::ConversationQueuesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/telephony/inbound/conversation_queues_controller.rb

Instance Method Summary collapse

Instance Method Details

#frontObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/telephony/inbound/conversation_queues_controller.rb', line 4

def front
  @inbound_conversation = InboundConversationQueue.dequeue params[:csr_id]
  render json: @inbound_conversation

rescue Telephony::Error::QueueEmpty
  render status: :not_found, json: { errors: [ "Queue is empty" ] }

rescue Telephony::Error::AgentOnACall
  render status: :unprocessable_entity, json: { errors: [ "You are already on a call" ] }

rescue => error
  msg = "Error dequeueing call: #{error.message}"
  Rails.logger.error msg
  render status: :server_error, json: { errors: [ msg ] }
end