adhearsion 2.4.0.beta2 → 2.4.0.beta3
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 +4 -4
- data/CHANGELOG.md +7 -6
- data/lib/adhearsion/call_controller/input.rb +4 -0
- data/lib/adhearsion/call_controller/output/abstract_player.rb +5 -1
- data/lib/adhearsion/configuration.rb +6 -0
- data/lib/adhearsion/generators/app/templates/Gemfile.erb +5 -1
- data/lib/adhearsion/process.rb +0 -2
- data/lib/adhearsion/punchblock_plugin.rb +2 -2
- data/lib/adhearsion/punchblock_plugin/initializer.rb +8 -4
- data/lib/adhearsion/version.rb +1 -1
- data/spec/adhearsion/call_controller/dial_spec.rb +21 -20
- data/spec/adhearsion/call_controller/input_spec.rb +14 -0
- data/spec/adhearsion/call_controller/output_spec.rb +104 -2
- data/spec/adhearsion/process_spec.rb +2 -2
- data/spec/adhearsion/punchblock_plugin/initializer_spec.rb +16 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a21555092db2b8678e869cbf61fe9d365c6ba61f
|
4
|
+
data.tar.gz: 118c8bdbf5dedcf3c52287175ba13637b5b711c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1b0b67df4b8b76a4f77e724dcc7b2523c719d37bb6eed73a7adaf3bbb90db792de9d69cbd09b0f860221605125092684756d84430c176c8aa5bff072ff476cd
|
7
|
+
data.tar.gz: e5c9deb98506f8ce27a1185b89ffe17eb474f79432dc697436566897d1c5b839007eaf0231fa08d8e243c514907b2572b42d6fa3f4f5079f8da4ae6ccdda67e2
|
data/CHANGELOG.md
CHANGED
@@ -1,22 +1,23 @@
|
|
1
1
|
# [develop](https://github.com/adhearsion/adhearsion)
|
2
2
|
|
3
|
-
# [2.4.0.
|
3
|
+
# [2.4.0.beta3](https://github.com/adhearsion/adhearsion/compare/v2.3.5...v2.4.0.beta3) - [2013-08-27](https://rubygems.org/gems/adhearsion/versions/2.4.0.beta3)
|
4
4
|
* Deprecation: Ruby 1.9.2 support is deprecated and will be dropped in a future version of Adhearsion
|
5
|
+
* Deprecation: Some media options from Punchblock config are now overriden by other core config, and will eventually be removed.
|
6
|
+
* Deprecation: Core implementations of `CallController#ask` and `#menu` are deprecated, and will be replaced in future with those in [adhearsion-asr](http://github.com/adhearsion/adhearsion-asr). See http://adhearsion.com/docs/common_problems#toc_3 for details.
|
5
7
|
* Feature: Update to Punchblock 2.0 for JRuby compatibility, better performance and Rayo spec compliance
|
6
|
-
* Feature: Add Call#wait_for_end
|
7
|
-
* Feature: Add joined call attribute to dial status
|
8
|
+
* Feature: Add `Call#wait_for_end`, which blocks until the call ends and returns its end reason
|
8
9
|
* Feature: Track call start/end time and duration
|
9
|
-
* Feature: Add per-call join duration and disposition to DialStatus
|
10
|
+
* Feature: Add per-call join duration and disposition to `DialStatus`
|
10
11
|
* Feature: Add `CallController#dial_and_confirm` which allows parallel confirmation of outbound calls and apologies to losing parties
|
11
12
|
* Feature: Add `CallController::Dial::Dial#split`, `#rejoin`, `#merge` and `#skip_cleanup` to support conferencing and transfer use cases
|
12
13
|
* Feature: Add `#originate` method to console as alias for `Adhearsion::OutboundCall.originate`
|
13
14
|
* Feature: Allow the console to be disabled using `--no-console`
|
14
|
-
* Feature: Add CLI
|
15
|
+
* Feature: Add CLI commands to generate hooks for a plugin to register on [ahnhub.com](http://www.ahnhub.com)
|
15
16
|
* Bugfix: Removed unnecessary Mocha reference from generated plugin
|
16
17
|
* Bugfix: Call loggers are deleted after a call finishes, fixing a memory leak
|
17
18
|
* Bugfix: A menu definition's block context is now available
|
18
19
|
* Bugfix: Ensure call's command registry is not leaked outside the actor
|
19
|
-
* Bugfix: An application's lib
|
20
|
+
* Bugfix: An application's `lib/` directory is now in the load path so dependencies may be reasolved more simply. You may now `require 'foo'` instead of `require "#{Adhearsion.root}/lib/foo.rb"`
|
20
21
|
* Bugfix: Resolve hostname to some local name when experiencing network issues
|
21
22
|
* Bugfix: Ensure smooth shutdown of console and XMPP connections
|
22
23
|
* Bugfix: Warn when booting Adhearsion with an invalid environment name
|
@@ -41,6 +41,8 @@ module Adhearsion
|
|
41
41
|
# @see CallController#pass
|
42
42
|
#
|
43
43
|
def ask(*args, &block)
|
44
|
+
logger.warn "This implementation of #ask is deprecated due to issues with dropped DTMF. For a solution, see http://adhearsion.com/docs/common_problems#toc_3"
|
45
|
+
|
44
46
|
options = args.last.kind_of?(Hash) ? args.pop : {}
|
45
47
|
sound_files = args.flatten
|
46
48
|
|
@@ -129,6 +131,8 @@ module Adhearsion
|
|
129
131
|
# @see CallController#pass
|
130
132
|
#
|
131
133
|
def menu(*args, &block)
|
134
|
+
logger.warn "This implementation of #menu is deprecated due to issues with dropped DTMF. For a solution, see http://adhearsion.com/docs/common_problems#toc_3"
|
135
|
+
|
132
136
|
options = args.last.kind_of?(Hash) ? args.pop : {}
|
133
137
|
sound_files = args.flatten
|
134
138
|
|
@@ -21,9 +21,13 @@ module Adhearsion
|
|
21
21
|
|
22
22
|
def new_output(options)
|
23
23
|
defaults = {}
|
24
|
-
|
24
|
+
|
25
|
+
default_voice = Adhearsion.config.platform.media.default_voice || Adhearsion.config.punchblock[:default_voice]
|
25
26
|
defaults[:voice] = default_voice if default_voice
|
26
27
|
|
28
|
+
renderer = Adhearsion.config.platform.media.default_renderer || Adhearsion.config.punchblock[:media_engine]
|
29
|
+
defaults[:renderer] = renderer if renderer
|
30
|
+
|
27
31
|
Punchblock::Component::Output.new defaults.merge(options)
|
28
32
|
end
|
29
33
|
end
|
@@ -58,6 +58,12 @@ module Adhearsion
|
|
58
58
|
after_hangup_lifetime 30, :transform => Proc.new { |v| v.to_i }, :desc => <<-__
|
59
59
|
Lifetime of a call after it has hung up
|
60
60
|
__
|
61
|
+
|
62
|
+
desc "Media configuration"
|
63
|
+
media {
|
64
|
+
default_voice nil, desc: 'The default voice used for all output. Set nil to use platform default.'
|
65
|
+
default_renderer nil, desc: 'The default renderer used for all output. Set nil to use platform default.'
|
66
|
+
}
|
61
67
|
end
|
62
68
|
|
63
69
|
Loquacious::Configuration.for :platform, &block if block_given?
|
@@ -1,6 +1,10 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem
|
3
|
+
gem 'adhearsion', '~> <%= Adhearsion::VERSION.split('.')[0,2].join('.') %>'
|
4
|
+
|
5
|
+
# This is here by default due to deprecation of #ask and #menu.
|
6
|
+
# See http://adhearsion.com/docs/common_problems#toc_3 for details
|
7
|
+
gem 'adhearsion-asr'
|
4
8
|
|
5
9
|
#
|
6
10
|
# Here are some example plugins you might like to use. Simply
|
data/lib/adhearsion/process.rb
CHANGED
@@ -23,8 +23,8 @@ module Adhearsion
|
|
23
23
|
connection_timeout 60 , :transform => Proc.new { |v| PunchblockPlugin.validate_number v }, :desc => "The amount of time to wait for a connection"
|
24
24
|
reconnect_attempts 1.0/0.0 , :transform => Proc.new { |v| PunchblockPlugin.validate_number v }, :desc => "The number of times to (re)attempt connection to the server"
|
25
25
|
reconnect_timer 5 , :transform => Proc.new { |v| PunchblockPlugin.validate_number v }, :desc => "Delay between connection attempts"
|
26
|
-
media_engine nil , :transform => Proc.new { |v| v.to_sym }, :desc => "The media engine to use. Defaults to platform default."
|
27
|
-
default_voice nil , :transform => Proc.new { |v| v.to_sym }, :desc => "The default TTS voice to use."
|
26
|
+
media_engine nil , :transform => Proc.new { |v| v.to_sym }, :desc => "The media engine to use. Defaults to platform default. This is deprecated, please see core media config options for forward compatability."
|
27
|
+
default_voice nil , :transform => Proc.new { |v| v.to_sym }, :desc => "The default TTS voice to use. This is deprecated, please see core media config options for forward compatability."
|
28
28
|
end
|
29
29
|
|
30
30
|
init :punchblock do
|
@@ -27,9 +27,7 @@ module Adhearsion
|
|
27
27
|
:host => self.config.host,
|
28
28
|
:port => self.config.port,
|
29
29
|
:certs => self.config.certs_directory,
|
30
|
-
:root_domain => self.config.root_domain
|
31
|
-
:media_engine => self.config.media_engine,
|
32
|
-
:default_voice => self.config.default_voice
|
30
|
+
:root_domain => self.config.root_domain
|
33
31
|
}
|
34
32
|
|
35
33
|
self.client = Punchblock.client_with_connection self.config.platform, connection_options
|
@@ -159,7 +157,13 @@ module Adhearsion
|
|
159
157
|
end
|
160
158
|
|
161
159
|
def resource
|
162
|
-
[
|
160
|
+
[machine_identifier, ::Process.pid].join '-'
|
161
|
+
end
|
162
|
+
|
163
|
+
def machine_identifier
|
164
|
+
Adhearsion::Process.fqdn
|
165
|
+
rescue SocketError
|
166
|
+
Socket.gethostname
|
163
167
|
end
|
164
168
|
|
165
169
|
def connection
|
data/lib/adhearsion/version.rb
CHANGED
@@ -478,9 +478,9 @@ module Adhearsion
|
|
478
478
|
|
479
479
|
sleep 0.5
|
480
480
|
|
481
|
-
other_mock_call << mock_end
|
482
|
-
second_root_call << mock_end
|
483
|
-
second_other_mock_call << mock_end
|
481
|
+
other_mock_call.async << mock_end
|
482
|
+
second_root_call.async << mock_end
|
483
|
+
second_other_mock_call.async << mock_end
|
484
484
|
|
485
485
|
latch.wait(1).should be_true
|
486
486
|
|
@@ -499,9 +499,9 @@ module Adhearsion
|
|
499
499
|
|
500
500
|
sleep 0.5
|
501
501
|
|
502
|
-
other_mock_call << mock_end
|
503
|
-
second_root_call << mock_end
|
504
|
-
second_other_mock_call << mock_end
|
502
|
+
other_mock_call.async << mock_end
|
503
|
+
second_root_call.async << mock_end
|
504
|
+
second_other_mock_call.async << mock_end
|
505
505
|
|
506
506
|
latch.wait(1).should be_true
|
507
507
|
|
@@ -580,9 +580,9 @@ module Adhearsion
|
|
580
580
|
|
581
581
|
sleep 0.5
|
582
582
|
|
583
|
-
other_mock_call << mock_end
|
584
|
-
second_root_call << mock_end
|
585
|
-
second_other_mock_call << mock_end
|
583
|
+
other_mock_call.async << mock_end
|
584
|
+
second_root_call.async << mock_end
|
585
|
+
second_other_mock_call.async << mock_end
|
586
586
|
|
587
587
|
latch.wait(1).should be_true
|
588
588
|
|
@@ -993,7 +993,9 @@ module Adhearsion
|
|
993
993
|
|
994
994
|
other_mock_call.should_receive(:dial).once.with(to, from: nil)
|
995
995
|
other_mock_call.should_receive(:join).once.with(call)
|
996
|
-
other_mock_call.should_receive(:hangup).once
|
996
|
+
other_mock_call.should_receive(:hangup).once.and_return do
|
997
|
+
other_mock_call << mock_end
|
998
|
+
end
|
997
999
|
|
998
1000
|
second_other_mock_call.should_receive(:dial).once.with(second_to, from: nil)
|
999
1001
|
second_other_mock_call.should_receive(:join).never
|
@@ -1010,7 +1012,6 @@ module Adhearsion
|
|
1010
1012
|
confirmation_latch.wait(1).should be_true
|
1011
1013
|
|
1012
1014
|
other_mock_call << Punchblock::Event::Unjoined.new(call_uri: call.id)
|
1013
|
-
other_mock_call << mock_end
|
1014
1015
|
|
1015
1016
|
latch.wait(2).should be_true
|
1016
1017
|
|
@@ -1476,9 +1477,9 @@ module Adhearsion
|
|
1476
1477
|
|
1477
1478
|
sleep 0.5
|
1478
1479
|
|
1479
|
-
other_mock_call << mock_end
|
1480
|
-
second_root_call << mock_end
|
1481
|
-
second_other_mock_call << mock_end
|
1480
|
+
other_mock_call.async << mock_end
|
1481
|
+
second_root_call.async << mock_end
|
1482
|
+
second_other_mock_call.async << mock_end
|
1482
1483
|
|
1483
1484
|
latch.wait(1).should be_true
|
1484
1485
|
|
@@ -1497,9 +1498,9 @@ module Adhearsion
|
|
1497
1498
|
|
1498
1499
|
sleep 0.5
|
1499
1500
|
|
1500
|
-
other_mock_call << mock_end
|
1501
|
-
second_root_call << mock_end
|
1502
|
-
second_other_mock_call << mock_end
|
1501
|
+
other_mock_call.async << mock_end
|
1502
|
+
second_root_call.async << mock_end
|
1503
|
+
second_other_mock_call.async << mock_end
|
1503
1504
|
|
1504
1505
|
latch.wait(1).should be_true
|
1505
1506
|
|
@@ -1578,9 +1579,9 @@ module Adhearsion
|
|
1578
1579
|
|
1579
1580
|
sleep 0.5
|
1580
1581
|
|
1581
|
-
other_mock_call << mock_end
|
1582
|
-
second_root_call << mock_end
|
1583
|
-
second_other_mock_call << mock_end
|
1582
|
+
other_mock_call.async << mock_end
|
1583
|
+
second_root_call.async << mock_end
|
1584
|
+
second_other_mock_call.async << mock_end
|
1584
1585
|
|
1585
1586
|
latch.wait(1).should be_true
|
1586
1587
|
|
@@ -166,6 +166,13 @@ module Adhearsion
|
|
166
166
|
MenuDSL::Menu.should_receive(:new).and_return(menu_instance)
|
167
167
|
end
|
168
168
|
|
169
|
+
it "logs a warning about dropped DTMF" do
|
170
|
+
menu_instance.should_receive(:continue).and_return(result_done)
|
171
|
+
|
172
|
+
call.logger.should_receive(:warn).with(/deprecated/)
|
173
|
+
subject.menu sound_files
|
174
|
+
end
|
175
|
+
|
169
176
|
it "exits the function if MenuResultDone" do
|
170
177
|
menu_instance.should_receive(:should_continue?).and_return(true)
|
171
178
|
menu_instance.should_receive(:continue).and_return(result_done)
|
@@ -271,6 +278,13 @@ module Adhearsion
|
|
271
278
|
MenuDSL::Menu.should_receive(:new).and_return(menu_instance)
|
272
279
|
end
|
273
280
|
|
281
|
+
it "logs a warning about dropped DTMF" do
|
282
|
+
menu_instance.should_receive(:continue).and_return(result_done)
|
283
|
+
|
284
|
+
call.logger.should_receive(:warn).with(/deprecated/)
|
285
|
+
subject.ask sound_files
|
286
|
+
end
|
287
|
+
|
274
288
|
it "exits the function if MenuResultDone" do
|
275
289
|
menu_instance.should_receive(:continue).and_return(result_done)
|
276
290
|
result = subject.ask sound_files
|
@@ -748,7 +748,7 @@ module Adhearsion
|
|
748
748
|
end
|
749
749
|
end
|
750
750
|
|
751
|
-
describe "with a default voice set" do
|
751
|
+
describe "with a default voice set in PB config" do
|
752
752
|
before { Adhearsion.config.punchblock.default_voice = 'foo' }
|
753
753
|
|
754
754
|
it 'sets the voice on the output component' do
|
@@ -761,6 +761,57 @@ module Adhearsion
|
|
761
761
|
after { Adhearsion.config.punchblock.default_voice = nil }
|
762
762
|
end
|
763
763
|
|
764
|
+
describe "with a default voice set in core and PB config" do
|
765
|
+
before do
|
766
|
+
Adhearsion.config.punchblock.default_voice = 'foo'
|
767
|
+
Adhearsion.config.platform.media.default_voice = 'bar'
|
768
|
+
end
|
769
|
+
|
770
|
+
it 'prefers core config to set the voice on the output component' do
|
771
|
+
str = "Hello world"
|
772
|
+
ssml = RubySpeech::SSML.draw { string str }
|
773
|
+
expect_ssml_output ssml, voice: 'bar'
|
774
|
+
subject.say(str)
|
775
|
+
end
|
776
|
+
|
777
|
+
after do
|
778
|
+
Adhearsion.config.punchblock.default_voice = nil
|
779
|
+
Adhearsion.config.platform.media.default_voice = nil
|
780
|
+
end
|
781
|
+
end
|
782
|
+
|
783
|
+
describe "with a default media engine set in PB config" do
|
784
|
+
before { Adhearsion.config.punchblock.media_engine = 'foo' }
|
785
|
+
|
786
|
+
it 'sets the renderer on the output component' do
|
787
|
+
str = "Hello world"
|
788
|
+
ssml = RubySpeech::SSML.draw { string str }
|
789
|
+
expect_ssml_output ssml, renderer: 'foo'
|
790
|
+
subject.say(str)
|
791
|
+
end
|
792
|
+
|
793
|
+
after { Adhearsion.config.punchblock.media_engine = nil }
|
794
|
+
end
|
795
|
+
|
796
|
+
describe "with a default renderer set in core and PB config" do
|
797
|
+
before do
|
798
|
+
Adhearsion.config.punchblock.media_engine = 'foo'
|
799
|
+
Adhearsion.config.platform.media.default_renderer = 'bar'
|
800
|
+
end
|
801
|
+
|
802
|
+
it 'prefers core config to set the renderer on the output component' do
|
803
|
+
str = "Hello world"
|
804
|
+
ssml = RubySpeech::SSML.draw { string str }
|
805
|
+
expect_ssml_output ssml, renderer: 'bar'
|
806
|
+
subject.say(str)
|
807
|
+
end
|
808
|
+
|
809
|
+
after do
|
810
|
+
Adhearsion.config.punchblock.media_engine = nil
|
811
|
+
Adhearsion.config.platform.media.default_renderer = nil
|
812
|
+
end
|
813
|
+
end
|
814
|
+
|
764
815
|
describe "converts the argument to a string" do
|
765
816
|
it 'calls output with a string' do
|
766
817
|
argument = 123
|
@@ -795,7 +846,7 @@ module Adhearsion
|
|
795
846
|
end
|
796
847
|
end
|
797
848
|
|
798
|
-
describe "with a default voice set" do
|
849
|
+
describe "with a default voice set in PB config" do
|
799
850
|
before { Adhearsion.config.punchblock.default_voice = 'foo' }
|
800
851
|
|
801
852
|
it 'sets the voice on the output component' do
|
@@ -808,6 +859,57 @@ module Adhearsion
|
|
808
859
|
after { Adhearsion.config.punchblock.default_voice = nil }
|
809
860
|
end
|
810
861
|
|
862
|
+
describe "with a default voice set in core and PB config" do
|
863
|
+
before do
|
864
|
+
Adhearsion.config.punchblock.default_voice = 'foo'
|
865
|
+
Adhearsion.config.platform.media.default_voice = 'bar'
|
866
|
+
end
|
867
|
+
|
868
|
+
it 'prefers core config to set the voice on the output component' do
|
869
|
+
str = "Hello world"
|
870
|
+
ssml = RubySpeech::SSML.draw { string str }
|
871
|
+
expect_async_ssml_output ssml, voice: 'bar'
|
872
|
+
subject.say!(str)
|
873
|
+
end
|
874
|
+
|
875
|
+
after do
|
876
|
+
Adhearsion.config.punchblock.default_voice = nil
|
877
|
+
Adhearsion.config.platform.media.default_voice = nil
|
878
|
+
end
|
879
|
+
end
|
880
|
+
|
881
|
+
describe "with a default media engine set in PB config" do
|
882
|
+
before { Adhearsion.config.punchblock.media_engine = 'foo' }
|
883
|
+
|
884
|
+
it 'sets the renderer on the output component' do
|
885
|
+
str = "Hello world"
|
886
|
+
ssml = RubySpeech::SSML.draw { string str }
|
887
|
+
expect_async_ssml_output ssml, renderer: 'foo'
|
888
|
+
subject.say!(str)
|
889
|
+
end
|
890
|
+
|
891
|
+
after { Adhearsion.config.punchblock.media_engine = nil }
|
892
|
+
end
|
893
|
+
|
894
|
+
describe "with a default renderer set in core and PB config" do
|
895
|
+
before do
|
896
|
+
Adhearsion.config.punchblock.media_engine = 'foo'
|
897
|
+
Adhearsion.config.platform.media.default_renderer = 'bar'
|
898
|
+
end
|
899
|
+
|
900
|
+
it 'prefers core config to set the renderer on the output component' do
|
901
|
+
str = "Hello world"
|
902
|
+
ssml = RubySpeech::SSML.draw { string str }
|
903
|
+
expect_async_ssml_output ssml, renderer: 'bar'
|
904
|
+
subject.say!(str)
|
905
|
+
end
|
906
|
+
|
907
|
+
after do
|
908
|
+
Adhearsion.config.punchblock.media_engine = nil
|
909
|
+
Adhearsion.config.platform.media.default_renderer = nil
|
910
|
+
end
|
911
|
+
end
|
912
|
+
|
811
913
|
describe "converts the argument to a string" do
|
812
914
|
it 'calls output with a string' do
|
813
915
|
argument = 123
|
@@ -107,8 +107,8 @@ module Adhearsion
|
|
107
107
|
context "when networking issues crop up" do
|
108
108
|
before { Socket.stub(:gethostbyname).and_raise(SocketError) }
|
109
109
|
|
110
|
-
it "should
|
111
|
-
Adhearsion::Process.fqdn.
|
110
|
+
it "should raise SocketError" do
|
111
|
+
expect { Adhearsion::Process.fqdn }.to raise_error(SocketError)
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
@@ -18,8 +18,6 @@ module Adhearsion
|
|
18
18
|
config.connection_timeout = 60
|
19
19
|
config.reconnect_attempts = 1.0/0.0
|
20
20
|
config.reconnect_timer = 5
|
21
|
-
config.media_engine = nil
|
22
|
-
config.default_voice = nil
|
23
21
|
end
|
24
22
|
end
|
25
23
|
|
@@ -37,8 +35,6 @@ module Adhearsion
|
|
37
35
|
config.connection_timeout = options[:connection_timeout] if options.has_key?(:connection_timeout)
|
38
36
|
config.reconnect_attempts = options[:reconnect_attempts] if options.has_key?(:reconnect_attempts)
|
39
37
|
config.reconnect_timer = options[:reconnect_timer] if options.has_key?(:reconnect_timer)
|
40
|
-
config.media_engine = options[:media_engine] if options.has_key?(:media_engine)
|
41
|
-
config.default_voice = options[:default_voice] if options.has_key?(:default_voice)
|
42
38
|
end
|
43
39
|
|
44
40
|
Initializer.init
|
@@ -93,14 +89,6 @@ module Adhearsion
|
|
93
89
|
it "should properly set the reconnect_timer value" do
|
94
90
|
subject.reconnect_timer.should be == 5
|
95
91
|
end
|
96
|
-
|
97
|
-
it "should properly set the media_engine value" do
|
98
|
-
subject.media_engine.should be == nil
|
99
|
-
end
|
100
|
-
|
101
|
-
it "should properly set the default_voice value" do
|
102
|
-
subject.default_voice.should be == nil
|
103
|
-
end
|
104
92
|
end
|
105
93
|
|
106
94
|
it "starts the client with the correct resource" do
|
@@ -110,9 +98,21 @@ module Adhearsion
|
|
110
98
|
initialize_punchblock
|
111
99
|
end
|
112
100
|
|
101
|
+
context "when the fqdn is not available" do
|
102
|
+
it "should use the local hostname instead" do
|
103
|
+
Adhearsion::Process.stub(:fqdn).and_raise SocketError
|
104
|
+
Socket.stub(:gethostname).and_return 'local_hostname'
|
105
|
+
|
106
|
+
username = "usera@127.0.0.1/local_hostname-1234"
|
107
|
+
|
108
|
+
Punchblock::Connection::XMPP.should_receive(:new).once.with(hash_including :username => username).and_return mock_client
|
109
|
+
initialize_punchblock
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
113
|
it "starts the client with any overridden settings" do
|
114
|
-
Punchblock::Connection::XMPP.should_receive(:new).once.with(username: 'userb@127.0.0.1/foo', password: '123', host: 'foo.bar.com', port: 200, certs: '/foo/bar', connection_timeout: 20, root_domain: 'foo.com'
|
115
|
-
initialize_punchblock username: 'userb@127.0.0.1/foo', password: '123', host: 'foo.bar.com', port: 200, certs_directory: '/foo/bar', connection_timeout: 20, root_domain: 'foo.com'
|
114
|
+
Punchblock::Connection::XMPP.should_receive(:new).once.with(username: 'userb@127.0.0.1/foo', password: '123', host: 'foo.bar.com', port: 200, certs: '/foo/bar', connection_timeout: 20, root_domain: 'foo.com').and_return mock_client
|
115
|
+
initialize_punchblock username: 'userb@127.0.0.1/foo', password: '123', host: 'foo.bar.com', port: 200, certs_directory: '/foo/bar', connection_timeout: 20, root_domain: 'foo.com'
|
116
116
|
end
|
117
117
|
|
118
118
|
describe "#connect" do
|
@@ -172,7 +172,7 @@ module Adhearsion
|
|
172
172
|
end
|
173
173
|
|
174
174
|
describe 'using Asterisk' do
|
175
|
-
let(:overrides) { {:username => 'test', :password => '123', :host => 'foo.bar.com', :port => 200, :certs => nil, :connection_timeout => 20, :root_domain => 'foo.com'
|
175
|
+
let(:overrides) { {:username => 'test', :password => '123', :host => 'foo.bar.com', :port => 200, :certs => nil, :connection_timeout => 20, :root_domain => 'foo.com'} }
|
176
176
|
|
177
177
|
it 'should start an Asterisk PB connection' do
|
178
178
|
Punchblock::Connection::Asterisk.should_receive(:new).once.with(overrides).and_return mock_client
|
@@ -181,7 +181,7 @@ module Adhearsion
|
|
181
181
|
end
|
182
182
|
|
183
183
|
describe 'using FreeSWITCH' do
|
184
|
-
let(:overrides) { {:username => 'test', :password => '123', :host => 'foo.bar.com', :port => 200, :certs => nil, :connection_timeout => 20, :root_domain => 'foo.com'
|
184
|
+
let(:overrides) { {:username => 'test', :password => '123', :host => 'foo.bar.com', :port => 200, :certs => nil, :connection_timeout => 20, :root_domain => 'foo.com'} }
|
185
185
|
|
186
186
|
it 'should start a FreeSWITCH PB connection' do
|
187
187
|
Punchblock::Connection::Freeswitch.should_receive(:new).once.with(overrides).and_return mock_client
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adhearsion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.0.
|
4
|
+
version: 2.4.0.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Phillips
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-08-
|
14
|
+
date: 2013-08-27 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|