Class: Telephony::Signals::Agents::PresencesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Telephony::Signals::Agents::PresencesController
- Defined in:
- app/controllers/telephony/signals/agents/presences_controller.rb
Instance Method Summary collapse
Instance Method Details
#authenticate ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/telephony/signals/agents/presences_controller.rb', line 9 def authenticate @agent = Agent.find_by_csr_id params[:csr_id] @agent.verify_status! @agent.with_lock do if @agent.offline? if params[:csr_default_status] == 'not_available' @agent.not_available else @agent.available end end end response = Pusher[params[:channel_name]] .authenticate(params[:socket_id], user_id: @agent.id) render json: response end |
#create ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/telephony/signals/agents/presences_controller.rb', line 29 def create = params["presence"]["time_ms"].to_i params[:presence][:events].each do |data| @agent = Agent.where(id: data[:user_id]).first if @agent @agent.with_lock do @agent.process_presence_event(data[:name], ) end end end head :ok end |