adhearsion-asterisk 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - jruby-19mode # JRuby in 1.9 mode
6
+ - rbx-19mode # currently in active development, may or may not work for your project
7
+ - ruby-head
8
+ notifications:
9
+ irc: "irc.freenode.org#adhearsion"
@@ -1,5 +1,9 @@
1
1
  # develop
2
2
 
3
+ # v0.2.0 - 2012-03-22
4
+ * Update to work with Adhearsion 2.0.0.rc2
5
+ * Remove overloaded `CallController#play` and `#play!` - we should use Adhearsion's core auto-detection
6
+
3
7
  # v0.1.3 - 2012-01-30
4
8
  * Update to use Adhearsion's changed Plugin semantics (no more dialplan hooks)
5
9
  * Monkeypatch Adhearsion::CallController with Asterisk-specific overloads
@@ -18,15 +18,15 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
- s.add_runtime_dependency %q<adhearsion>, [">= 2.0.0.alpha2"]
21
+ s.add_runtime_dependency %q<adhearsion>, [">= 2.0.0.rc2"]
22
22
  s.add_runtime_dependency %q<activesupport>, [">= 3.0.10"]
23
23
 
24
- s.add_development_dependency %q<bundler>, ["~> 1.0.0"]
24
+ s.add_development_dependency %q<bundler>, [">= 1.0.0"]
25
25
  s.add_development_dependency %q<rspec>, [">= 2.5.0"]
26
26
  s.add_development_dependency %q<ci_reporter>, [">= 1.6.3"]
27
27
  s.add_development_dependency %q<simplecov>, [">= 0"]
28
28
  s.add_development_dependency %q<simplecov-rcov>, [">= 0"]
29
- s.add_development_dependency %q<yard>, ["~> 0.6.0"]
29
+ s.add_development_dependency %q<yard>, [">= 0.6.0"]
30
30
  s.add_development_dependency %q<rake>, [">= 0"]
31
31
  s.add_development_dependency %q<mocha>, [">= 0"]
32
32
  s.add_development_dependency %q<bones>
@@ -4,55 +4,6 @@ module Adhearsion
4
4
  # Monkeypatches to Adhearsion for Asterisk-specific functionality.
5
5
  #
6
6
  class CallController
7
- # Plays the specified sound file names. This method will handle Time/DateTime objects (e.g. Time.now),
8
- # Fixnums (e.g. 1000), Strings which are valid Fixnums (e.g "123"), and direct sound files. When playing
9
- # numbers, Adhearsion assumes you're saying the number, not the digits. For example, play("100")
10
- # is pronounced as "one hundred" instead of "one zero zero". To specify how the Date/Time objects are said
11
- # pass in as an array with the first parameter as the Date/Time/DateTime object along with a hash with the
12
- # additional options. See play_time for more information.
13
- #
14
- # Note: it is not necessary to supply a sound file extension; Asterisk will try to find a sound
15
- # file encoded using the current channel's codec, if one exists. If not, it will transcode from
16
- # the default codec (GSM). Asterisk stores its sound files in /var/lib/asterisk/sounds.
17
- #
18
- # @example Play file hello-world.???
19
- # play 'hello-world'
20
- # @example Speak current time
21
- # play Time.now
22
- # @example Speak today's date
23
- # play Date.today
24
- # @example Speak today's date in a specific format
25
- # play [Date.today, {:format => 'BdY'}]
26
- # @example Play sound file, speak number, play two more sound files
27
- # play %w"a-connect-charge-of 22 cents-per-minute will-apply"
28
- # @example Play two sound files
29
- # play "you-sound-cute", "what-are-you-wearing"
30
- #
31
- # @return [Boolean] true is returned if everything was successful. Otherwise, false indicates that
32
- # some sound file(s) could not be played.
33
- def play(*arguments)
34
- begin
35
- play! arguments
36
- rescue Adhearsion::PlaybackError => e
37
- return false
38
- end
39
- true
40
- end
41
-
42
- # Same as {#play}, but immediately raises an exception if a sound file cannot be played.
43
- #
44
- # @return [true]
45
- # @raise [Adhearsion::VoIP::PlaybackError] If a sound file cannot be played
46
- def play!(*arguments)
47
- result = true
48
- unless play_time(arguments)
49
- arguments.flatten.each do |argument|
50
- result &= play_numeric(argument) || play_soundfile(argument)
51
- end
52
- end
53
- raise Adhearsion::PlaybackError if !result
54
- end
55
-
56
7
  #
57
8
  # Plays a single output, not only files, accepting interruption by one of the digits specified
58
9
  # Currently still stops execution, will be fixed soon in Punchblock
@@ -74,15 +25,15 @@ module Adhearsion
74
25
 
75
26
  case reason.result
76
27
  when 0
77
- raise Adhearsion::PlaybackError if reason.data == "endpos=0"
28
+ raise CallController::Output::PlaybackError if reason.data == "endpos=0"
78
29
  nil
79
30
  when -1
80
- raise Adhearsion::PlaybackError
31
+ raise CallController::Output::PlaybackError
81
32
  else
82
33
  [reason.result].pack 'U*'
83
34
  end
84
35
  rescue StandardError => e
85
- raise Adhearsion::PlaybackError, "Output failed for argument #{argument.inspect}"
36
+ raise CallController::Output::PlaybackError, "Output failed for argument #{argument.inspect}"
86
37
  end
87
38
  end
88
39
  end
@@ -1,5 +1,5 @@
1
1
  module Adhearsion
2
2
  module Asterisk
3
- VERSION = "0.1.3"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -405,95 +405,6 @@ module Adhearsion::Asterisk
405
405
  end
406
406
  end#describe #queue
407
407
 
408
- describe "#play" do
409
- let(:audiofile) { "tt-monkeys" }
410
- let(:audiofile2) { "tt-weasels" }
411
-
412
- it 'should return true if play proceeds correctly' do
413
- subject.expects(:play!).with([audiofile])
414
- subject.play(audiofile).should be true
415
- end
416
-
417
- it 'should return false if an audio file cannot be found' do
418
- subject.expects(:play!).with([audiofile]).raises(Adhearsion::PlaybackError)
419
- subject.play(audiofile).should be false
420
-
421
- end
422
-
423
- it 'should return false when audio files cannot be found' do
424
- subject.expects(:play!).with([audiofile, audiofile2]).raises(Adhearsion::PlaybackError)
425
- subject.play(audiofile, audiofile2).should be false
426
- end
427
- end
428
-
429
- describe "#play!" do
430
- let(:audiofile) { "tt-monkeys" }
431
- let(:audiofile2) { "tt-weasels" }
432
- let(:numeric) { 20 }
433
- let(:numeric_string) { "42" }
434
- let(:date) { Date.parse('2011-10-24') }
435
- let(:time) { Time.at(875121313) }
436
-
437
- describe "with a single argument" do
438
- it 'passing a single string to play() results in play_soundfile being called with that file name' do
439
- subject.expects(:play_time).with([audiofile]).returns(false)
440
- subject.expects(:play_numeric).with(audiofile).returns(false)
441
- subject.expects(:play_soundfile).with(audiofile).returns(true)
442
- subject.play!(audiofile)
443
- end
444
-
445
- it 'If a number is passed to play(), the play_numeric method is called with that argument' do
446
- subject.expects(:play_time).with([numeric]).returns(false)
447
- subject.expects(:play_numeric).with(numeric).returns(true)
448
- subject.play!(numeric)
449
- end
450
-
451
- it 'if a string representation of a number is passed to play(), the play_numeric method is called with that argument' do
452
- subject.expects(:play_time).with([numeric_string]).returns(false)
453
- subject.expects(:play_numeric).with(numeric_string).returns(true)
454
- subject.play!(numeric_string)
455
- end
456
-
457
- it 'If a Time is passed to play(), the play_time method is called with that argument' do
458
- subject.expects(:play_time).with([time]).returns(true)
459
- subject.play!(time)
460
- end
461
-
462
- it 'If a Date is passed to play(), the play_time method is called with that argument' do
463
- subject.expects(:play_time).with([date]).returns(true)
464
- subject.play!(date)
465
- end
466
-
467
- it 'raises an exception if play fails' do
468
- subject.expects(:play_time).with([audiofile]).returns(false)
469
- subject.expects(:play_numeric).with(audiofile).returns(false)
470
- subject.expects(:play_soundfile).with(audiofile).returns(false)
471
- lambda { subject.play!(audiofile) }.should raise_error(Adhearsion::PlaybackError)
472
- end
473
- end
474
-
475
- describe "with multiple arguments" do
476
- it 'loops over the arguments, issuing separate play commands' do
477
- subject.expects(:play_time).with([audiofile, audiofile2]).returns(false)
478
- subject.expects(:play_numeric).with(audiofile).returns(false)
479
- subject.expects(:play_soundfile).with(audiofile).returns(true)
480
- subject.expects(:play_numeric).with(audiofile2).returns(false)
481
- subject.expects(:play_soundfile).with(audiofile2).returns(true)
482
- subject.play!(audiofile, audiofile2)
483
- end
484
-
485
- it 'raises an exception if play fails with multiple argument' do
486
- subject.expects(:play_time).with([audiofile, audiofile2]).returns(false)
487
- subject.expects(:play_numeric).with(audiofile).returns(false)
488
- subject.expects(:play_soundfile).with(audiofile).returns(false)
489
- subject.expects(:play_numeric).with(audiofile2).returns(false)
490
- subject.expects(:play_soundfile).with(audiofile2).returns(false)
491
- lambda { subject.play!(audiofile, audiofile2) }.should raise_error(Adhearsion::PlaybackError)
492
- end
493
- end
494
-
495
- end
496
-
497
408
  describe "#play_time" do
498
409
  let(:date) { Date.parse('2011-10-24') }
499
410
  let(:date_format) { 'ABdY' }
@@ -598,7 +509,7 @@ module Adhearsion::Asterisk
598
509
 
599
510
  it "raises Adhearsion::PlaybackError" do
600
511
  subject.expects(:execute_component_and_await_completion).once.with(output_component).returns(output_component)
601
- lambda { subject.stream_file prompt, allowed_digits }.should raise_error Adhearsion::PlaybackError
512
+ lambda { subject.stream_file prompt, allowed_digits }.should raise_error Adhearsion::CallController::Output::PlaybackError
602
513
  end
603
514
  end
604
515
 
@@ -608,7 +519,7 @@ module Adhearsion::Asterisk
608
519
 
609
520
  it "raises Adhearsion::PlaybackError" do
610
521
  subject.expects(:execute_component_and_await_completion).once.with(output_component).returns(output_component)
611
- lambda { subject.stream_file prompt, allowed_digits }.should raise_error Adhearsion::PlaybackError
522
+ lambda { subject.stream_file prompt, allowed_digits }.should raise_error Adhearsion::CallController::Output::PlaybackError
612
523
  end
613
524
  end
614
525
  end # describe #stream_file
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.1.3
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,22 +10,22 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-01-30 00:00:00.000000000 Z
13
+ date: 2012-03-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: adhearsion
17
- requirement: &2152671220 !ruby/object:Gem::Requirement
17
+ requirement: &2164421920 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
21
21
  - !ruby/object:Gem::Version
22
- version: 2.0.0.alpha2
22
+ version: 2.0.0.rc2
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2152671220
25
+ version_requirements: *2164421920
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: activesupport
28
- requirement: &2152670680 !ruby/object:Gem::Requirement
28
+ requirement: &2164421300 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,21 +33,21 @@ dependencies:
33
33
  version: 3.0.10
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2152670680
36
+ version_requirements: *2164421300
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: bundler
39
- requirement: &2156501700 !ruby/object:Gem::Requirement
39
+ requirement: &2164420660 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
- - - ~>
42
+ - - ! '>='
43
43
  - !ruby/object:Gem::Version
44
44
  version: 1.0.0
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *2156501700
47
+ version_requirements: *2164420660
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rspec
50
- requirement: &2156501180 !ruby/object:Gem::Requirement
50
+ requirement: &2164420140 !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: *2156501180
58
+ version_requirements: *2164420140
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: ci_reporter
61
- requirement: &2156500640 !ruby/object:Gem::Requirement
61
+ requirement: &2164419580 !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: *2156500640
69
+ version_requirements: *2164419580
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: simplecov
72
- requirement: &2156500080 !ruby/object:Gem::Requirement
72
+ requirement: &2164418800 !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: *2156500080
80
+ version_requirements: *2164418800
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: simplecov-rcov
83
- requirement: &2156499560 !ruby/object:Gem::Requirement
83
+ requirement: &2164418180 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,21 +88,21 @@ dependencies:
88
88
  version: '0'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *2156499560
91
+ version_requirements: *2164418180
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: yard
94
- requirement: &2156499080 !ruby/object:Gem::Requirement
94
+ requirement: &2164417560 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
- - - ~>
97
+ - - ! '>='
98
98
  - !ruby/object:Gem::Version
99
99
  version: 0.6.0
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *2156499080
102
+ version_requirements: *2164417560
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: rake
105
- requirement: &2156498600 !ruby/object:Gem::Requirement
105
+ requirement: &2164417020 !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: *2156498600
113
+ version_requirements: *2164417020
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: mocha
116
- requirement: &2156498120 !ruby/object:Gem::Requirement
116
+ requirement: &2164416400 !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: *2156498120
124
+ version_requirements: *2164416400
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: bones
127
- requirement: &2156497700 !ruby/object:Gem::Requirement
127
+ requirement: &2164415840 !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: *2156497700
135
+ version_requirements: *2164415840
136
136
  - !ruby/object:Gem::Dependency
137
137
  name: guard-rspec
138
- requirement: &2156497200 !ruby/object:Gem::Requirement
138
+ requirement: &2164415340 !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: *2156497200
146
+ version_requirements: *2164415340
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: ruby_gntp
149
- requirement: &2156496760 !ruby/object:Gem::Requirement
149
+ requirement: &2164414720 !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: *2156496760
157
+ version_requirements: *2164414720
158
158
  description: An Adhearsion Plugin providing Asterisk-specific dialplan methods, AMI
159
159
  access, and access to Asterisk configuration
160
160
  email:
@@ -166,6 +166,7 @@ extra_rdoc_files: []
166
166
  files:
167
167
  - .gitignore
168
168
  - .rspec
169
+ - .travis.yml
169
170
  - CHANGELOG.md
170
171
  - Gemfile
171
172
  - Guardfile
@@ -213,7 +214,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
213
214
  version: '0'
214
215
  segments:
215
216
  - 0
216
- hash: 2593107876374281234
217
+ hash: 819784652951999828
217
218
  required_rubygems_version: !ruby/object:Gem::Requirement
218
219
  none: false
219
220
  requirements:
@@ -222,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
223
  version: '0'
223
224
  segments:
224
225
  - 0
225
- hash: 2593107876374281234
226
+ hash: 819784652951999828
226
227
  requirements: []
227
228
  rubyforge_project: adhearsion-asterisk
228
229
  rubygems_version: 1.8.10