exotel_api 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13d423efa38ef4e16ec11cfc99f08f50074729e6
4
- data.tar.gz: 58a898623c86440fb283ed9349347ef7382ada99
3
+ metadata.gz: 4cd9032584002a065e8875e00362bd88717a81fb
4
+ data.tar.gz: 1dfbb9cdc4766ea346aa792bf2196b9426c810f4
5
5
  SHA512:
6
- metadata.gz: cd2b8ca7059d3f6c7301fd96ee0cd70b967721ce27797f9e7edd7ca809eab1dfbf83408d183ca90c508158aeec77577b11440dc87b9bdd96ac44b79b6efc73b3
7
- data.tar.gz: 2d2da0337a928c79ce1c00c2113f96b54fc8815290603a68b9071f58cbc4d2939184c05ff0e86b055d898bce7176c198fc24686533b6a1fc495e24e3ec36ff87
6
+ metadata.gz: ab95301818d01ee0ed2ce99113ccb591d5c39bb1326306234644087ab6bc0368fc61569cddc38eac2db53279f45ce4cd4416221e5ea145232b124dd3239a1db9
7
+ data.tar.gz: 1b518905b133c183a984f24deaeddcf7ca3571984417b8dbaed3fb3ba8e0360b03b0d8cda78fa70ba7b00759897e976bfc48bd55e176ba1f3bc116ecc8aed85b
@@ -1,7 +1,7 @@
1
1
  module ExotelApi
2
2
  module Call
3
3
  module AfterDtmf
4
- class ConnectController < ApplicationController
4
+ class ConnectController < StartController
5
5
  #response - nil
6
6
  def status
7
7
  begin
@@ -15,24 +15,7 @@ module ExotelApi
15
15
  end
16
16
  render :plain => '', content_type: "text/plain", :status => 200
17
17
  end
18
-
19
- private
20
- def find_call
21
- if params[:CustomField].present?
22
- params[:CustomField].titleize.split.join.constantize::Call::AfterDtmf::Connect.find_by_call_sid(params[:CallSid])
23
- else
24
- Call.find_by_call_sid(params[:CallSid])
25
- end
26
- end
27
-
28
- def direction
29
- if params[:Direction] == 'incoming'
30
- eval(ExotelApi.inbound_query)
31
- else
32
- find_call
33
- end
34
- end
35
18
  end
36
19
  end
37
20
  end
38
- end
21
+ end
@@ -1,6 +1,6 @@
1
1
  module ExotelApi
2
2
  module Call
3
- class AfterDtmfController < ApplicationController
3
+ class AfterDtmfController < StartController
4
4
  #response - list of URLs
5
5
  def greeting
6
6
  begin
@@ -40,23 +40,6 @@ module ExotelApi
40
40
  end
41
41
  render :plain => phones, content_type: "text/plain", :status => 200
42
42
  end
43
-
44
- private
45
- def find_call
46
- if params[:CustomField].present?
47
- params[:CustomField].titleize.split.join.constantize::Call::AfterDtmf.find_by_call_sid(params[:CallSid])
48
- else
49
- Call.find_by_call_sid(params[:CallSid])
50
- end
51
- end
52
-
53
- def direction
54
- if params[:Direction] == 'incoming'
55
- eval(ExotelApi.inbound_query)
56
- else
57
- find_call
58
- end
59
- end
60
43
  end
61
44
  end
62
- end
45
+ end
@@ -1,7 +1,7 @@
1
1
  module ExotelApi
2
2
  module Call
3
3
  module AfterGreeting
4
- class ConnectController < ApplicationController
4
+ class ConnectController < StartController
5
5
  #response - nil
6
6
  def status
7
7
  begin
@@ -15,24 +15,7 @@ module ExotelApi
15
15
  end
16
16
  render :plain => '', content_type: "text/plain", :status => 200
17
17
  end
18
-
19
- private
20
- def find_call
21
- if params[:CustomField].present?
22
- params[:CustomField].titleize.split.join.constantize::Call::AfterGreeting::Connect.find_by_call_sid(params[:CallSid])
23
- else
24
- Call.find_by_call_sid(params[:CallSid])
25
- end
26
- end
27
-
28
- def direction
29
- if params[:Direction] == 'incoming'
30
- eval(ExotelApi.inbound_query)
31
- else
32
- find_call
33
- end
34
- end
35
18
  end
36
19
  end
37
20
  end
38
- end
21
+ end
@@ -1,6 +1,6 @@
1
1
  module ExotelApi
2
2
  module Call
3
- class AfterGreetingController < ApplicationController
3
+ class AfterGreetingController < StartController
4
4
  #response - phone
5
5
  def connect
6
6
  begin
@@ -14,23 +14,6 @@ module ExotelApi
14
14
  end
15
15
  render :plain => phones, content_type: "text/plain", :status => 200
16
16
  end
17
-
18
- private
19
- def find_call
20
- if params[:CustomField].present?
21
- params[:CustomField].titleize.split.join.constantize::Call::AfterGreeting.find_by_call_sid(params[:CallSid])
22
- else
23
- Call.find_by_call_sid(params[:CallSid])
24
- end
25
- end
26
-
27
- def direction
28
- if params[:Direction] == 'incoming'
29
- eval(ExotelApi.inbound_query)
30
- else
31
- find_call
32
- end
33
- end
34
17
  end
35
18
  end
36
- end
19
+ end
@@ -1,6 +1,6 @@
1
1
  module ExotelApi
2
2
  module Call
3
- class ConnectController < CallController
3
+ class ConnectController < StartController
4
4
  #response - nil
5
5
  def status
6
6
  begin
@@ -14,23 +14,6 @@ module ExotelApi
14
14
  end
15
15
  render :plain => '', content_type: "text/plain", :status => 200
16
16
  end
17
-
18
- private
19
- def find_call
20
- if params[:CustomField].present?
21
- params[:CustomField].titleize.split.join.constantize::Call::Connect.find_by_call_sid(params[:CallSid])
22
- else
23
- Call.find_by_call_sid(params[:CallSid])
24
- end
25
- end
26
-
27
- def direction
28
- if params[:Direction] == 'incoming'
29
- eval(ExotelApi.inbound_query)
30
- else
31
- find_call
32
- end
33
- end
34
17
  end
35
18
  end
36
- end
19
+ end
@@ -1,5 +1,5 @@
1
1
  module ExotelApi
2
- class CallController < ApplicationController
2
+ class CallController < StartController
3
3
  skip_before_filter :verify_authenticity_token
4
4
  #response - greeting,menu,connect
5
5
  def start
@@ -105,23 +105,23 @@ module ExotelApi
105
105
  end
106
106
  render :plain => applet, content_type: "text/html", status: 200
107
107
  end
108
-
109
-
110
- private
111
- def find_call
112
- if params[:CustomField].present?
113
- params[:CustomField].titleize.split.join.constantize::Call.find_by_call_sid(params[:CallSid])
114
- else
115
- Call.find_by_call_sid(params[:CallSid])
116
- end
117
- end
118
-
119
- def direction
120
- if params[:Direction] == 'incoming'
121
- eval(ExotelApi.inbound_query)
122
- else
123
- find_call
108
+ #response - status code 200,302
109
+ def repeat
110
+ begin
111
+ _call = direction
112
+ if _call.present?
113
+ answer = _call.play_again(params) if defined?(_call.play_again)
114
+ if answer == 'yes'
115
+ status = '200'
116
+ else
117
+ status = '302'
118
+ end
119
+ end
120
+ rescue => e
121
+ logger.error e.message
122
+ logger.error e.backtrace.join("\n")
124
123
  end
124
+ render :plain => '', content_type: "text/plain", :status => status
125
125
  end
126
126
  end
127
- end
127
+ end
@@ -58,8 +58,6 @@ module ExotelApi
58
58
  begin
59
59
  _call = direction
60
60
  if _call.present?
61
- _call.repeat += 1
62
- _call.save
63
61
  status = _call.repeat_callback(params) if defined?(_call.repeat_callback)
64
62
  end
65
63
  rescue => e
@@ -0,0 +1,19 @@
1
+ module ExotelApi
2
+ class StartController < ApplicationController
3
+ def direction
4
+ if params[:Direction] == 'incoming'
5
+ eval(ExotelApi.inbound_query)
6
+ else
7
+ find_call
8
+ end
9
+ end
10
+ private
11
+ def find_call
12
+ if params[:CustomField].present?
13
+ params[:CustomField].titleize.split.join.constantize::Call.find_by_call_sid(params[:CallSid])
14
+ else
15
+ eval(ExotelApi.status_callback_query)
16
+ end
17
+ end
18
+ end
19
+ end
data/config/routes.rb CHANGED
@@ -9,7 +9,7 @@ Rails.application.routes.draw do
9
9
  post 'status'
10
10
  end
11
11
  end
12
-
12
+
13
13
  namespace :call do
14
14
  get 'start'
15
15
  get 'greeting'
@@ -35,6 +35,7 @@ Rails.application.routes.draw do
35
35
  get 'status'
36
36
  end
37
37
  end
38
+ get 'repeat'
38
39
  end
39
40
  end
40
41
  end
@@ -1,3 +1,3 @@
1
1
  module ExotelApi
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exotel_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aashutosh Chaudhary
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-22 00:00:00.000000000 Z
11
+ date: 2017-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -111,6 +111,7 @@ files:
111
111
  - app/controllers/exotel_api/call/connect_controller.rb
112
112
  - app/controllers/exotel_api/call_controller.rb
113
113
  - app/controllers/exotel_api/ivr/call_controller.rb
114
+ - app/controllers/exotel_api/start_controller.rb
114
115
  - bin/console
115
116
  - bin/setup
116
117
  - config/routes.rb