Class: Twilio::Rails::PhoneController

Inherits:
ApplicationController show all
Defined in:
app/controllers/twilio/rails/phone_controller.rb

Instance Method Summary collapse

Instance Method Details

#inboundObject



9
10
11
12
13
14
15
16
# File 'app/controllers/twilio/rails/phone_controller.rb', line 9

def inbound
  respond_to do |format|
    format.xml do
      phone_call = Twilio::Rails::Phone::CreateOperation.call(params: params_hash, tree: tree)
      render xml: Twilio::Rails::Phone::Twiml::GreetingOperation.call(phone_call_id: phone_call.id, tree: tree)
    end
  end
end

#outboundObject



18
19
20
21
22
23
24
25
# File 'app/controllers/twilio/rails/phone_controller.rb', line 18

def outbound
  respond_to do |format|
    format.xml do
      phone_call = Twilio::Rails::Phone::FindOperation.call(params: params_hash)
      render xml: Twilio::Rails::Phone::Twiml::GreetingOperation.call(phone_call_id: phone_call.id, tree: tree)
    end
  end
end

#promptObject



27
28
29
30
31
32
33
34
35
# File 'app/controllers/twilio/rails/phone_controller.rb', line 27

def prompt
  respond_to do |format|
    format.xml do
      phone_call = Twilio::Rails::Phone::FindOperation.call(params: params_hash)
      phone_call = Twilio::Rails::Phone::UpdateOperation.call(phone_call_id: phone_call.id, params: params_hash)
      render xml: Twilio::Rails::Phone::Twiml::PromptOperation.call(phone_call_id: phone_call.id, tree: tree, response_id: params[:response_id].to_i)
    end
  end
end

#prompt_responseObject



37
38
39
40
41
42
43
44
45
46
# File 'app/controllers/twilio/rails/phone_controller.rb', line 37

def prompt_response
  respond_to do |format|
    format.xml do
      phone_call = Twilio::Rails::Phone::FindOperation.call(params: params_hash)
      phone_call = Twilio::Rails::Phone::UpdateOperation.call(phone_call_id: phone_call.id, params: params_hash)
      response = Twilio::Rails::Phone::UpdateResponseOperation.call(phone_call_id: phone_call.id, response_id: params[:response_id].to_i, params: params_hash)
      render xml: Twilio::Rails::Phone::Twiml::PromptResponseOperation.call(phone_call_id: phone_call.id, tree: tree, response_id: params[:response_id].to_i, params: params_hash)
    end
  end
end

#receive_response_recordingObject



80
81
82
83
84
85
86
87
88
89
# File 'app/controllers/twilio/rails/phone_controller.rb', line 80

def receive_response_recording
  respond_to do |format|
    format.xml do
      phone_call = Twilio::Rails::Phone::FindOperation.call(params: params_hash)
      Twilio::Rails::Phone::ReceiveRecordingOperation.call(phone_call_id: phone_call.id, response_id: params[:response_id].to_i, params: params_hash)

      head :ok
    end
  end
end

#statusObject



69
70
71
72
73
74
75
76
77
78
# File 'app/controllers/twilio/rails/phone_controller.rb', line 69

def status
  respond_to do |format|
    format.xml do
      phone_call = Twilio::Rails::Phone::FindOperation.call(params: params_hash)
      phone_call = Twilio::Rails::Phone::UpdateOperation.call(phone_call_id: phone_call.id, params: params_hash)

      head :ok
    end
  end
end

#timeoutObject



48
49
50
51
52
53
54
55
56
# File 'app/controllers/twilio/rails/phone_controller.rb', line 48

def timeout
  respond_to do |format|
    format.xml do
      phone_call = Twilio::Rails::Phone::FindOperation.call(params: params_hash)
      phone_call = Twilio::Rails::Phone::UpdateOperation.call(phone_call_id: phone_call.id, params: params_hash)
      render xml: Twilio::Rails::Phone::Twiml::TimeoutOperation.call(phone_call_id: phone_call.id, tree: tree, response_id: params[:response_id].to_i)
    end
  end
end

#transcribeObject



58
59
60
61
62
63
64
65
66
67
# File 'app/controllers/twilio/rails/phone_controller.rb', line 58

def transcribe
  respond_to do |format|
    format.xml do
      phone_call = Twilio::Rails::Phone::FindOperation.call(params: params_hash)
      Twilio::Rails::Phone::UpdateResponseOperation.call(phone_call_id: phone_call.id, response_id: params[:response_id].to_i, params: params_hash)

      head :ok
    end
  end
end