Class: ExotelApi::CallController

Inherits:
StartController show all
Defined in:
app/controllers/exotel_api/call_controller.rb

Instance Method Summary collapse

Methods inherited from StartController

#direction

Instance Method Details

#after_greetingObject

response - switch case ivr_menu, hangup



17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/exotel_api/call_controller.rb', line 17

def after_greeting
  begin
    _call = direction
    if _call.present?
      applet = "{\"select\":\"#{_call.after_greeting(params)}\"}" if defined?(_call.after_greeting)
    end
  rescue => e
    logger.error e.message
    logger.error e.backtrace.join("\n")
  end
  render :plain => applet, content_type: "text/html", status: 200
end

#after_keypressObject

response - audio file or list of URLs of audio files



56
57
58
59
60
61
62
63
64
65
66
67
# File 'app/controllers/exotel_api/call_controller.rb', line 56

def after_keypress
  begin
    _call = direction
    if _call.present?
      urls = _call.after_keypress(params) if defined?(_call.after_keypress)
    end
  rescue => e
    logger.error e.message
    logger.error e.backtrace.join("\n")
  end
  render :plain => urls, content_type: "text/plain", status: 200
end

#after_keypress_greetingObject

response - switch case ivr_menu, hangup



69
70
71
72
73
74
75
76
77
78
79
80
# File 'app/controllers/exotel_api/call_controller.rb', line 69

def after_keypress_greeting
  begin
    _call = direction
    if _call.present?
      applet = "{\"select\":\"#{_call.after_keypress_greeting(params)}\"}" if defined?(_call.after_keypress_greeting)
    end
  rescue => e
    logger.error e.message
    logger.error e.backtrace.join("\n")
  end
  render :plain => applet, content_type: "text/html", status: 200
end

#finishObject

response - status 200 and plain ”



95
96
97
98
99
100
101
102
103
104
105
106
# File 'app/controllers/exotel_api/call_controller.rb', line 95

def finish
  begin
    _call = direction
    if _call.present?
      _call.finish(params) if defined?(_call.finish)
    end
  rescue => e
    logger.error e.message
    logger.error e.backtrace.join("\n")
  end
  render :plain => '', content_type: "text/html", :status => 200
end

#greetingObject

response - audio file or list of URLS of audio files



4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/exotel_api/call_controller.rb', line 4

def greeting
  begin
    _call = direction
    if _call.present?
      urls = _call.greeting(params) if defined?(_call.greeting)
    end
  rescue => e
    logger.error e.message
    logger.error e.backtrace.join("\n")
  end
  render :plain => urls, content_type: "text/plain", :status => 200
end

#ivr_menuObject

response - audio file or list of URLS of audio files



30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/controllers/exotel_api/call_controller.rb', line 30

def ivr_menu
  begin
    _call = direction
    if _call.present?
      urls = _call.ivr_menu(params) if defined?(_call.ivr_menu)
    end
  rescue => e
    logger.error e.message
    logger.error e.backtrace.join("\n")
  end
  render :plain => urls, content_type: "text/plain", :status => 200
end

#keypressObject

response - status 200 and plain ”



43
44
45
46
47
48
49
50
51
52
53
54
# File 'app/controllers/exotel_api/call_controller.rb', line 43

def keypress
  begin
    _call = direction
    if _call.present?
      _call.keypress(params) if defined?(_call.keypress)
    end
  rescue => e
    logger.error e.message
    logger.error e.backtrace.join("\n")
  end
  render :plain => '', content_type: "text/html", :status => 200
end

#play_againObject

response - status 200, 404 or 302 and plain ”



82
83
84
85
86
87
88
89
90
91
92
93
# File 'app/controllers/exotel_api/call_controller.rb', line 82

def play_again
  begin
    _call = direction
    if _call.present?
      applet = "{\"select\":\"#{_call.play_again(params)}\"}" if defined?(_call.play_again)
    end
  rescue => e
    logger.error e.message
    logger.error e.backtrace.join("\n")
  end
  render :plain => applet, content_type: "text/html", :status => 200
end