adhearsion-asterisk 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,8 @@
1
1
  # develop
2
2
 
3
+ # v0.3.0 - 2012-03-29
4
+ # Remove the monkey-patched version of `CallController#stream_file` since Punchblock now supports stopping output
5
+
3
6
  # v0.2.0 - 2012-03-22
4
7
  * Update to work with Adhearsion 2.0.0.rc2
5
8
  * Remove overloaded `CallController#play` and `#play!` - we should use Adhearsion's core auto-detection
@@ -1,5 +1,4 @@
1
1
  require 'adhearsion'
2
- require 'adhearsion/asterisk/core_ext/adhearsion/call_controller'
3
2
  require 'active_support/dependencies/autoload'
4
3
  require 'adhearsion/asterisk/version'
5
4
  require 'adhearsion/asterisk/call_controller_methods'
@@ -1,5 +1,5 @@
1
1
  module Adhearsion
2
2
  module Asterisk
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -451,78 +451,6 @@ module Adhearsion::Asterisk
451
451
  subject.play_soundfile(audiofile).should == false
452
452
  end
453
453
  end
454
-
455
- describe "#stream_file" do
456
- let(:allowed_digits) { '35' }
457
- let(:prompt) { 'tt-monkeys' }
458
-
459
- let :output_params do
460
- {
461
- :name => 'STREAM FILE',
462
- :params => [
463
- 'tt-monkeys',
464
- '35'
465
- ]
466
- }
467
- end
468
-
469
- let(:output_component) do
470
- Punchblock::Component::Asterisk::AGI::Command.new output_params
471
- end
472
-
473
- let(:result) { 53 }
474
- let(:endpos) { '5000' }
475
-
476
- let :reason do
477
- Punchblock::Component::Asterisk::AGI::Command::Complete::Success.new :code => 200,
478
- :result => result,
479
- :data => "endpos=#{endpos}"
480
- end
481
-
482
- before do
483
- output_component
484
- Punchblock::Component::Asterisk::AGI::Command.expects(:new).once.with(output_params).returns output_component
485
- output_component.expects(:complete_event).at_least_once.returns mock('success', :reason => reason)
486
- end
487
-
488
- it "plays the correct output" do
489
- subject.expects(:execute_component_and_await_completion).once.with(output_component).returns(output_component)
490
- subject.stream_file prompt, allowed_digits
491
- end
492
-
493
- it "returns a single digit amongst the allowed when pressed" do
494
- subject.expects(:execute_component_and_await_completion).once.with(output_component).returns(output_component)
495
- subject.stream_file(prompt, allowed_digits).should == '5'
496
- end
497
-
498
- context 'when nothing was pressed' do
499
- let(:result) { 0 }
500
-
501
- it "returns nil" do
502
- subject.expects(:execute_component_and_await_completion).once.with(output_component).returns(output_component)
503
- subject.stream_file(prompt, allowed_digits).should == nil
504
- end
505
- end
506
-
507
- context 'when output fails' do
508
- let(:result) { -1 }
509
-
510
- it "raises Adhearsion::PlaybackError" do
511
- subject.expects(:execute_component_and_await_completion).once.with(output_component).returns(output_component)
512
- lambda { subject.stream_file prompt, allowed_digits }.should raise_error Adhearsion::CallController::Output::PlaybackError
513
- end
514
- end
515
-
516
- context 'when output fails to open' do
517
- let(:result) { 0 }
518
- let(:endpos) { '0' }
519
-
520
- it "raises Adhearsion::PlaybackError" do
521
- subject.expects(:execute_component_and_await_completion).once.with(output_component).returns(output_component)
522
- lambda { subject.stream_file prompt, allowed_digits }.should raise_error Adhearsion::CallController::Output::PlaybackError
523
- end
524
- end
525
- end # describe #stream_file
526
454
  end
527
455
  end#main describe
528
456
  end
@@ -6,12 +6,6 @@ module Adhearsion::Asterisk
6
6
 
7
7
  let(:mock_call) { stub_everything 'Call' }
8
8
 
9
- it 'should monkeypatch Adhearsion::CallController' do
10
- cc = Adhearsion::CallController.new(mock_call)
11
- cc.expects(:play_time).returns true
12
- cc.play
13
- end
14
-
15
9
  it 'should extend Adhearsion::CallController with Asterisk methods' do
16
10
  Adhearsion::CallController.new(mock_call).should respond_to :play_time
17
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adhearsion-asterisk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-03-22 00:00:00.000000000 Z
13
+ date: 2012-03-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: adhearsion
17
- requirement: &2164421920 !ruby/object:Gem::Requirement
17
+ requirement: &2152681880 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 2.0.0.rc2
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2164421920
25
+ version_requirements: *2152681880
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: activesupport
28
- requirement: &2164421300 !ruby/object:Gem::Requirement
28
+ requirement: &2152681220 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 3.0.10
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2164421300
36
+ version_requirements: *2152681220
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: bundler
39
- requirement: &2164420660 !ruby/object:Gem::Requirement
39
+ requirement: &2152680480 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 1.0.0
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *2164420660
47
+ version_requirements: *2152680480
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rspec
50
- requirement: &2164420140 !ruby/object:Gem::Requirement
50
+ requirement: &2152679880 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 2.5.0
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *2164420140
58
+ version_requirements: *2152679880
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: ci_reporter
61
- requirement: &2164419580 !ruby/object:Gem::Requirement
61
+ requirement: &2152679240 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 1.6.3
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *2164419580
69
+ version_requirements: *2152679240
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: simplecov
72
- requirement: &2164418800 !ruby/object:Gem::Requirement
72
+ requirement: &2152678520 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: '0'
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *2164418800
80
+ version_requirements: *2152678520
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: simplecov-rcov
83
- requirement: &2164418180 !ruby/object:Gem::Requirement
83
+ requirement: &2152677920 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '0'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *2164418180
91
+ version_requirements: *2152677920
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: yard
94
- requirement: &2164417560 !ruby/object:Gem::Requirement
94
+ requirement: &2152677240 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: 0.6.0
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *2164417560
102
+ version_requirements: *2152677240
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: rake
105
- requirement: &2164417020 !ruby/object:Gem::Requirement
105
+ requirement: &2168705200 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: '0'
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *2164417020
113
+ version_requirements: *2168705200
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: mocha
116
- requirement: &2164416400 !ruby/object:Gem::Requirement
116
+ requirement: &2168704540 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ! '>='
@@ -121,10 +121,10 @@ dependencies:
121
121
  version: '0'
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *2164416400
124
+ version_requirements: *2168704540
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: bones
127
- requirement: &2164415840 !ruby/object:Gem::Requirement
127
+ requirement: &2168704040 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ! '>='
@@ -132,10 +132,10 @@ dependencies:
132
132
  version: '0'
133
133
  type: :development
134
134
  prerelease: false
135
- version_requirements: *2164415840
135
+ version_requirements: *2168704040
136
136
  - !ruby/object:Gem::Dependency
137
137
  name: guard-rspec
138
- requirement: &2164415340 !ruby/object:Gem::Requirement
138
+ requirement: &2168703200 !ruby/object:Gem::Requirement
139
139
  none: false
140
140
  requirements:
141
141
  - - ! '>='
@@ -143,10 +143,10 @@ dependencies:
143
143
  version: '0'
144
144
  type: :development
145
145
  prerelease: false
146
- version_requirements: *2164415340
146
+ version_requirements: *2168703200
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: ruby_gntp
149
- requirement: &2164414720 !ruby/object:Gem::Requirement
149
+ requirement: &2168702500 !ruby/object:Gem::Requirement
150
150
  none: false
151
151
  requirements:
152
152
  - - ! '>='
@@ -154,7 +154,7 @@ dependencies:
154
154
  version: '0'
155
155
  type: :development
156
156
  prerelease: false
157
- version_requirements: *2164414720
157
+ version_requirements: *2168702500
158
158
  description: An Adhearsion Plugin providing Asterisk-specific dialplan methods, AMI
159
159
  access, and access to Asterisk configuration
160
160
  email:
@@ -182,7 +182,6 @@ files:
182
182
  - lib/adhearsion/asterisk/config_generator/queues.rb
183
183
  - lib/adhearsion/asterisk/config_generator/voicemail.rb
184
184
  - lib/adhearsion/asterisk/config_manager.rb
185
- - lib/adhearsion/asterisk/core_ext/adhearsion/call_controller.rb
186
185
  - lib/adhearsion/asterisk/plugin.rb
187
186
  - lib/adhearsion/asterisk/queue_proxy.rb
188
187
  - lib/adhearsion/asterisk/queue_proxy/agent_proxy.rb
@@ -214,7 +213,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
214
213
  version: '0'
215
214
  segments:
216
215
  - 0
217
- hash: 819784652951999828
216
+ hash: -71015258719465438
218
217
  required_rubygems_version: !ruby/object:Gem::Requirement
219
218
  none: false
220
219
  requirements:
@@ -223,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
223
222
  version: '0'
224
223
  segments:
225
224
  - 0
226
- hash: 819784652951999828
225
+ hash: -71015258719465438
227
226
  requirements: []
228
227
  rubyforge_project: adhearsion-asterisk
229
228
  rubygems_version: 1.8.10
@@ -1,40 +0,0 @@
1
- module Adhearsion
2
-
3
- ##
4
- # Monkeypatches to Adhearsion for Asterisk-specific functionality.
5
- #
6
- class CallController
7
- #
8
- # Plays a single output, not only files, accepting interruption by one of the digits specified
9
- # Currently still stops execution, will be fixed soon in Punchblock
10
- #
11
- # @param [Object] String or Hash specifying output and options
12
- # @param [String] String with the digits that are allowed to interrupt output
13
- # @return [String|nil] The pressed digit, or nil if nothing was pressed
14
- #
15
- def stream_file(argument, digits = '0123456789#*')
16
- begin
17
- output_component = ::Punchblock::Component::Asterisk::AGI::Command.new :name => "STREAM FILE",
18
- :params => [
19
- argument,
20
- digits
21
- ]
22
- execute_component_and_await_completion output_component
23
-
24
- reason = output_component.complete_event.reason
25
-
26
- case reason.result
27
- when 0
28
- raise CallController::Output::PlaybackError if reason.data == "endpos=0"
29
- nil
30
- when -1
31
- raise CallController::Output::PlaybackError
32
- else
33
- [reason.result].pack 'U*'
34
- end
35
- rescue StandardError => e
36
- raise CallController::Output::PlaybackError, "Output failed for argument #{argument.inspect}"
37
- end
38
- end
39
- end
40
- end