adhearsion 2.6.4 → 3.0.0.beta1
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/.travis.yml +6 -9
- data/CHANGELOG.md +22 -7
- data/Gemfile +2 -0
- data/README.markdown +4 -5
- data/Rakefile +1 -2
- data/adhearsion.gemspec +19 -8
- data/features/cli_create.feature +19 -3
- data/features/step_definitions/cli_steps.rb +0 -11
- data/features/support/env.rb +3 -4
- data/lib/adhearsion.rb +48 -27
- data/lib/adhearsion/call.rb +34 -50
- data/lib/adhearsion/call_controller.rb +6 -12
- data/lib/adhearsion/call_controller/dial.rb +15 -53
- data/lib/adhearsion/call_controller/input.rb +39 -162
- data/lib/adhearsion/call_controller/input/ask_grammar_builder.rb +44 -0
- data/lib/adhearsion/call_controller/input/menu_builder.rb +136 -0
- data/lib/adhearsion/call_controller/input/prompt_builder.rb +78 -0
- data/lib/adhearsion/call_controller/input/result.rb +46 -0
- data/lib/adhearsion/call_controller/output.rb +48 -67
- data/lib/adhearsion/call_controller/output/abstract_player.rb +3 -3
- data/lib/adhearsion/call_controller/output/async_player.rb +3 -3
- data/lib/adhearsion/call_controller/output/player.rb +1 -1
- data/lib/adhearsion/call_controller/record.rb +23 -8
- data/lib/adhearsion/calls.rb +1 -1
- data/lib/adhearsion/cli_commands/ahn_command.rb +2 -65
- data/lib/adhearsion/cli_commands/thor_errors.rb +0 -6
- data/lib/adhearsion/configuration.rb +91 -39
- data/lib/adhearsion/core_ext/blather/stanza.rb +41 -0
- data/lib/adhearsion/core_ext/blather/stanza/presence.rb +13 -0
- data/lib/adhearsion/error.rb +5 -0
- data/lib/adhearsion/event.rb +21 -0
- data/lib/adhearsion/event/active_speaker.rb +11 -0
- data/lib/adhearsion/event/answered.rb +11 -0
- data/lib/adhearsion/event/asterisk.rb +10 -0
- data/lib/adhearsion/event/asterisk/ami.rb +34 -0
- data/lib/adhearsion/event/complete.rb +75 -0
- data/lib/adhearsion/event/dtmf.rb +11 -0
- data/lib/adhearsion/event/end.rb +22 -0
- data/lib/adhearsion/event/input_timers_started.rb +9 -0
- data/lib/adhearsion/event/joined.rb +17 -0
- data/lib/adhearsion/event/offer.rb +14 -0
- data/lib/adhearsion/event/ringing.rb +11 -0
- data/lib/adhearsion/event/started_speaking.rb +13 -0
- data/lib/adhearsion/event/stopped_speaking.rb +13 -0
- data/lib/adhearsion/event/unjoined.rb +17 -0
- data/lib/adhearsion/events.rb +47 -66
- data/lib/adhearsion/foundation.rb +0 -1
- data/lib/adhearsion/foundation/object.rb +0 -5
- data/lib/adhearsion/generators/app/app_generator.rb +4 -1
- data/lib/adhearsion/generators/app/templates/Gemfile.erb +2 -10
- data/lib/adhearsion/generators/app/templates/adhearsion.erb +9 -9
- data/lib/adhearsion/generators/app/templates/config.ru +7 -0
- data/lib/adhearsion/generators/app/templates/en.yml +4 -0
- data/lib/adhearsion/generators/app/templates/events.erb +2 -2
- data/lib/adhearsion/generators/app/templates/hello_world.wav +0 -0
- data/lib/adhearsion/generators/app/templates/simon_game.rb +2 -1
- data/lib/adhearsion/generators/app/templates/simon_game_spec.rb +2 -2
- data/lib/adhearsion/has_headers.rb +34 -0
- data/lib/adhearsion/http_server.rb +37 -0
- data/lib/adhearsion/initializer.rb +19 -153
- data/lib/adhearsion/logging.rb +6 -25
- data/lib/adhearsion/outbound_call.rb +5 -5
- data/lib/adhearsion/plugin.rb +1 -0
- data/lib/adhearsion/protocol_error.rb +26 -0
- data/lib/adhearsion/rayo.rb +30 -0
- data/lib/adhearsion/rayo/client.rb +62 -0
- data/lib/adhearsion/rayo/client/component_registry.rb +33 -0
- data/lib/adhearsion/rayo/command.rb +21 -0
- data/lib/adhearsion/rayo/command/accept.rb +16 -0
- data/lib/adhearsion/rayo/command/answer.rb +16 -0
- data/lib/adhearsion/rayo/command/dial.rb +57 -0
- data/lib/adhearsion/rayo/command/hangup.rb +16 -0
- data/lib/adhearsion/rayo/command/join.rb +43 -0
- data/lib/adhearsion/rayo/command/mute.rb +13 -0
- data/lib/adhearsion/rayo/command/redirect.rb +23 -0
- data/lib/adhearsion/rayo/command/reject.rb +40 -0
- data/lib/adhearsion/rayo/command/unjoin.rb +24 -0
- data/lib/adhearsion/rayo/command/unmute.rb +13 -0
- data/lib/adhearsion/rayo/command_node.rb +47 -0
- data/lib/adhearsion/rayo/component.rb +21 -0
- data/lib/adhearsion/rayo/component/asterisk.rb +13 -0
- data/lib/adhearsion/rayo/component/asterisk/agi.rb +14 -0
- data/lib/adhearsion/rayo/component/asterisk/agi/command.rb +46 -0
- data/lib/adhearsion/rayo/component/asterisk/ami.rb +14 -0
- data/lib/adhearsion/rayo/component/asterisk/ami/action.rb +61 -0
- data/lib/adhearsion/rayo/component/component_node.rb +90 -0
- data/lib/adhearsion/rayo/component/input.rb +186 -0
- data/lib/adhearsion/rayo/component/output.rb +471 -0
- data/lib/adhearsion/rayo/component/prompt.rb +53 -0
- data/lib/adhearsion/rayo/component/receive_fax.rb +26 -0
- data/lib/adhearsion/rayo/component/record.rb +165 -0
- data/lib/adhearsion/rayo/component/send_fax.rb +64 -0
- data/lib/adhearsion/rayo/component/stop.rb +11 -0
- data/lib/adhearsion/rayo/connection.rb +12 -0
- data/lib/adhearsion/rayo/connection/asterisk.rb +74 -0
- data/lib/adhearsion/rayo/connection/connected.rb +22 -0
- data/lib/adhearsion/rayo/connection/generic_connection.rb +22 -0
- data/lib/adhearsion/rayo/connection/xmpp.rb +198 -0
- data/lib/adhearsion/rayo/disconnected_error.rb +22 -0
- data/lib/adhearsion/{punchblock_plugin → rayo}/initializer.rb +19 -19
- data/lib/adhearsion/rayo/rayo_node.rb +127 -0
- data/lib/adhearsion/rayo/ref.rb +57 -0
- data/lib/adhearsion/statistics.rb +1 -1
- data/lib/adhearsion/tasks.rb +1 -2
- data/lib/adhearsion/tasks/configuration.rb +1 -1
- data/lib/adhearsion/tasks/environment.rb +0 -2
- data/lib/adhearsion/tasks/i18n.rb +49 -0
- data/lib/adhearsion/translator.rb +11 -0
- data/lib/adhearsion/translator/asterisk.rb +234 -0
- data/lib/adhearsion/translator/asterisk/agi_app.rb +17 -0
- data/lib/adhearsion/translator/asterisk/agi_command.rb +45 -0
- data/lib/adhearsion/translator/asterisk/ami_error_converter.rb +20 -0
- data/lib/adhearsion/translator/asterisk/call.rb +416 -0
- data/lib/adhearsion/translator/asterisk/channel.rb +43 -0
- data/lib/adhearsion/translator/asterisk/component.rb +88 -0
- data/lib/adhearsion/translator/asterisk/component/asterisk.rb +15 -0
- data/lib/adhearsion/translator/asterisk/component/asterisk/agi_command.rb +42 -0
- data/lib/adhearsion/translator/asterisk/component/asterisk/ami_action.rb +68 -0
- data/lib/adhearsion/translator/asterisk/component/composed_prompt.rb +76 -0
- data/lib/adhearsion/translator/asterisk/component/dtmf_recognizer.rb +137 -0
- data/lib/adhearsion/translator/asterisk/component/input.rb +34 -0
- data/lib/adhearsion/translator/asterisk/component/input_component.rb +90 -0
- data/lib/adhearsion/translator/asterisk/component/mrcp_native_prompt.rb +71 -0
- data/lib/adhearsion/translator/asterisk/component/mrcp_prompt.rb +55 -0
- data/lib/adhearsion/translator/asterisk/component/mrcp_recog_prompt.rb +165 -0
- data/lib/adhearsion/translator/asterisk/component/output.rb +233 -0
- data/lib/adhearsion/translator/asterisk/component/record.rb +101 -0
- data/lib/adhearsion/translator/asterisk/component/stop_by_redirect.rb +30 -0
- data/lib/adhearsion/translator/asterisk/unimrcp_app.rb +28 -0
- data/lib/adhearsion/uri_list.rb +21 -0
- data/lib/adhearsion/version.rb +1 -1
- data/spec/adhearsion/call_controller/dial_spec.rb +79 -1420
- data/spec/adhearsion/call_controller/input_spec.rb +1141 -237
- data/spec/adhearsion/call_controller/output/async_player_spec.rb +10 -10
- data/spec/adhearsion/call_controller/output/player_spec.rb +8 -8
- data/spec/adhearsion/call_controller/output_spec.rb +162 -215
- data/spec/adhearsion/call_controller/record_spec.rb +15 -16
- data/spec/adhearsion/call_controller_spec.rb +23 -40
- data/spec/adhearsion/call_spec.rb +123 -129
- data/spec/adhearsion/calls_spec.rb +3 -3
- data/spec/adhearsion/configuration_spec.rb +94 -108
- data/spec/adhearsion/event/answered_spec.rb +50 -0
- data/spec/adhearsion/event/asterisk/Find Results +402 -0
- data/spec/adhearsion/event/asterisk/ami_spec.rb +81 -0
- data/spec/adhearsion/event/complete_spec.rb +176 -0
- data/spec/adhearsion/event/dtmf_spec.rb +35 -0
- data/spec/adhearsion/event/end_spec.rb +85 -0
- data/spec/adhearsion/event/input_timers_started_spec.rb +19 -0
- data/spec/adhearsion/event/joined_spec.rb +53 -0
- data/spec/adhearsion/event/offer_spec.rb +106 -0
- data/spec/adhearsion/event/ringing_spec.rb +50 -0
- data/spec/adhearsion/event/started_speaking_spec.rb +37 -0
- data/spec/adhearsion/event/stopped_speaking_spec.rb +37 -0
- data/spec/adhearsion/event/unjoined_spec.rb +48 -0
- data/spec/adhearsion/event/untitled +0 -0
- data/spec/adhearsion/events_spec.rb +19 -45
- data/spec/adhearsion/initializer_spec.rb +12 -184
- data/spec/adhearsion/logging_spec.rb +5 -20
- data/spec/adhearsion/outbound_call_spec.rb +13 -13
- data/spec/adhearsion/plugin_spec.rb +3 -4
- data/spec/adhearsion/protocol_error_spec.rb +91 -0
- data/spec/adhearsion/rayo/client/component_registry_spec.rb +26 -0
- data/spec/adhearsion/rayo/client_spec.rb +134 -0
- data/spec/adhearsion/rayo/command/accept_spec.rb +63 -0
- data/spec/adhearsion/rayo/command/answer_spec.rb +73 -0
- data/spec/adhearsion/rayo/command/dial_spec.rb +156 -0
- data/spec/adhearsion/rayo/command/hangup_spec.rb +63 -0
- data/spec/adhearsion/rayo/command/join_spec.rb +158 -0
- data/spec/adhearsion/rayo/command/mute_spec.rb +32 -0
- data/spec/adhearsion/rayo/command/redirect_spec.rb +89 -0
- data/spec/adhearsion/rayo/command/reject_spec.rb +117 -0
- data/spec/adhearsion/rayo/command/unjoin_spec.rb +82 -0
- data/spec/adhearsion/rayo/command/unmute_spec.rb +32 -0
- data/spec/adhearsion/rayo/command_node_spec.rb +101 -0
- data/spec/adhearsion/rayo/component/asterisk/agi/command_spec.rb +111 -0
- data/spec/adhearsion/rayo/component/asterisk/ami/action_spec.rb +173 -0
- data/spec/adhearsion/rayo/component/component_node_spec.rb +110 -0
- data/spec/adhearsion/rayo/component/input_spec.rb +715 -0
- data/spec/adhearsion/rayo/component/output_spec.rb +1030 -0
- data/spec/adhearsion/rayo/component/prompt_spec.rb +171 -0
- data/spec/adhearsion/rayo/component/receive_fax_spec.rb +136 -0
- data/spec/adhearsion/rayo/component/record_spec.rb +497 -0
- data/spec/adhearsion/rayo/component/send_fax_spec.rb +144 -0
- data/spec/adhearsion/rayo/connection/asterisk_spec.rb +118 -0
- data/spec/adhearsion/rayo/connection/xmpp_spec.rb +449 -0
- data/spec/adhearsion/rayo/initializer_spec.rb +353 -0
- data/spec/adhearsion/rayo/ref_spec.rb +168 -0
- data/spec/adhearsion/rayo_spec.rb +7 -0
- data/spec/adhearsion/router/route_spec.rb +1 -1
- data/spec/adhearsion/statistics_spec.rb +2 -5
- data/spec/adhearsion/translator/asterisk/call_spec.rb +2047 -0
- data/spec/adhearsion/translator/asterisk/component/asterisk/agi_command_spec.rb +256 -0
- data/spec/adhearsion/translator/asterisk/component/asterisk/ami_action_spec.rb +151 -0
- data/spec/adhearsion/translator/asterisk/component/composed_prompt_spec.rb +257 -0
- data/spec/adhearsion/translator/asterisk/component/input_spec.rb +571 -0
- data/spec/adhearsion/translator/asterisk/component/mrcp_native_prompt_spec.rb +774 -0
- data/spec/adhearsion/translator/asterisk/component/mrcp_prompt_spec.rb +1244 -0
- data/spec/adhearsion/translator/asterisk/component/output_spec.rb +1850 -0
- data/spec/adhearsion/translator/asterisk/component/record_spec.rb +426 -0
- data/spec/adhearsion/translator/asterisk/component/stop_by_redirect_spec.rb +62 -0
- data/spec/adhearsion/translator/asterisk/component_spec.rb +83 -0
- data/spec/adhearsion/translator/asterisk_spec.rb +685 -0
- data/spec/adhearsion/uri_list_spec.rb +88 -0
- data/spec/adhearsion_spec.rb +89 -14
- data/spec/fixtures/locale/en.yml +13 -0
- data/spec/fixtures/locale/it.yml +13 -0
- data/spec/spec_helper.rb +18 -5
- data/spec/support/call_controller_test_helpers.rb +3 -2
- data/spec/support/initializer_stubs.rb +3 -1
- data/spec/support/punchblock_examples.rb +65 -0
- data/spec/support/punchblock_mocks.rb +12 -0
- metadata +412 -70
- data/features/cli_daemon.feature +0 -20
- data/features/cli_restart.feature +0 -52
- data/features/cli_stop.feature +0 -50
- data/lib/adhearsion/call_controller/menu_dsl.rb +0 -21
- data/lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb +0 -26
- data/lib/adhearsion/call_controller/menu_dsl/calculated_match.rb +0 -43
- data/lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb +0 -45
- data/lib/adhearsion/call_controller/menu_dsl/fixnum_match_calculator.rb +0 -11
- data/lib/adhearsion/call_controller/menu_dsl/match_calculator.rb +0 -40
- data/lib/adhearsion/call_controller/menu_dsl/menu.rb +0 -207
- data/lib/adhearsion/call_controller/menu_dsl/menu_builder.rb +0 -92
- data/lib/adhearsion/call_controller/menu_dsl/range_match_calculator.rb +0 -60
- data/lib/adhearsion/call_controller/menu_dsl/string_match_calculator.rb +0 -25
- data/lib/adhearsion/call_controller/utility.rb +0 -77
- data/lib/adhearsion/foundation/custom_daemonizer.rb +0 -52
- data/lib/adhearsion/punchblock_plugin.rb +0 -63
- data/scripts/cloc-1.64.pl +0 -10483
- data/spec/adhearsion/call_controller/menu_dsl/array_match_calculator_spec.rb +0 -76
- data/spec/adhearsion/call_controller/menu_dsl/calculated_match_collection_spec.rb +0 -60
- data/spec/adhearsion/call_controller/menu_dsl/calculated_match_spec.rb +0 -61
- data/spec/adhearsion/call_controller/menu_dsl/fixnum_match_calculator_spec.rb +0 -39
- data/spec/adhearsion/call_controller/menu_dsl/match_calculator_spec.rb +0 -17
- data/spec/adhearsion/call_controller/menu_dsl/menu_builder_spec.rb +0 -165
- data/spec/adhearsion/call_controller/menu_dsl/menu_spec.rb +0 -420
- data/spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb +0 -32
- data/spec/adhearsion/call_controller/menu_dsl/string_match_calculator_spec.rb +0 -40
- data/spec/adhearsion/call_controller/utility_spec.rb +0 -90
- data/spec/adhearsion/punchblock_plugin/initializer_spec.rb +0 -356
- data/spec/adhearsion/punchblock_plugin_spec.rb +0 -59
|
@@ -12,7 +12,7 @@ module Adhearsion
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def new_offer(call_id = nil, headers = {})
|
|
15
|
-
|
|
15
|
+
Adhearsion::Event::Offer.new domain: 'example.com', transport: 'xmpp', :target_call_id => call_id || random_call_id, :headers => headers
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
it 'can add a call to the collection' do
|
|
@@ -155,8 +155,8 @@ module Adhearsion
|
|
|
155
155
|
|
|
156
156
|
it "is sends a hangup command for the call" do
|
|
157
157
|
call_id = call.id
|
|
158
|
-
allow(
|
|
159
|
-
expect(
|
|
158
|
+
allow(Adhearsion).to receive_messages :client => double('Client')
|
|
159
|
+
expect(Adhearsion.client).to receive(:execute_command).once.with(Adhearsion::Rayo::Command::Hangup.new, :async => true, :call_id => call_id)
|
|
160
160
|
|
|
161
161
|
subject << call
|
|
162
162
|
|
|
@@ -10,31 +10,31 @@ describe Adhearsion::Configuration do
|
|
|
10
10
|
Adhearsion::Configuration.new
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
it "should have an empty configuration for the
|
|
14
|
-
expect(subject).to respond_to :
|
|
13
|
+
it "should have an empty configuration for the core" do
|
|
14
|
+
expect(subject).to respond_to :core
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
it "should have a
|
|
18
|
-
expect(subject.
|
|
17
|
+
it "should have a core configuration object" do
|
|
18
|
+
expect(subject.core).to be_instance_of Loquacious::Configuration
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
it "should initialize root to nil" do
|
|
22
|
-
expect(subject.
|
|
22
|
+
expect(subject.core.root).to be_nil
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
it "should initialize logging to level info" do
|
|
26
|
-
expect(subject.
|
|
26
|
+
expect(subject.core.logging.level).to eq(:info)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
it "should allow to update a config value" do
|
|
30
|
-
expect(subject.
|
|
31
|
-
subject.
|
|
32
|
-
expect(subject.
|
|
30
|
+
expect(subject.core.logging.level).to eq(:info)
|
|
31
|
+
subject.core.logging.level = :error
|
|
32
|
+
expect(subject.core.logging.level).to eq(:error)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
it "should allow to create new config values" do
|
|
36
|
-
subject.
|
|
37
|
-
expect(subject.
|
|
36
|
+
subject.core.bar = "foo"
|
|
37
|
+
expect(subject.core.bar).to eq("foo")
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
@@ -42,31 +42,26 @@ describe Adhearsion::Configuration do
|
|
|
42
42
|
subject do
|
|
43
43
|
Adhearsion::Configuration.new do
|
|
44
44
|
root "foo", :desc => "Adhearsion application root folder"
|
|
45
|
-
environment :development, :desc => "Active environment. Supported values: development, production, staging, test"
|
|
46
45
|
end
|
|
47
46
|
end
|
|
48
47
|
|
|
49
48
|
it "should return the root value" do
|
|
50
|
-
expect(subject.
|
|
49
|
+
expect(subject.core.root).to eq("foo")
|
|
51
50
|
end
|
|
52
51
|
|
|
53
|
-
it "should return the
|
|
54
|
-
expect(
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
it "should return a description for the platform configuration" do
|
|
58
|
-
expect(Adhearsion.config.description(:platform)).to be_instance_of String
|
|
52
|
+
it "should return a description for the core configuration" do
|
|
53
|
+
expect(Adhearsion.config.description(:core)).to be_instance_of String
|
|
59
54
|
end
|
|
60
55
|
|
|
61
56
|
it "should allow to update a config value" do
|
|
62
|
-
expect(subject.
|
|
63
|
-
subject.
|
|
64
|
-
expect(subject.
|
|
57
|
+
expect(subject.core.root).to eq("foo")
|
|
58
|
+
subject.core.root = "bar"
|
|
59
|
+
expect(subject.core.root).to eq("bar")
|
|
65
60
|
end
|
|
66
61
|
|
|
67
62
|
it "should allow to create new config values" do
|
|
68
|
-
subject.
|
|
69
|
-
expect(subject.
|
|
63
|
+
subject.core.bar = "bazz"
|
|
64
|
+
expect(subject.core.bar).to eq("bazz")
|
|
70
65
|
end
|
|
71
66
|
end
|
|
72
67
|
|
|
@@ -78,64 +73,61 @@ describe Adhearsion::Configuration do
|
|
|
78
73
|
end
|
|
79
74
|
end
|
|
80
75
|
|
|
81
|
-
describe "when accessing the
|
|
76
|
+
describe "when accessing the core configuration" do
|
|
82
77
|
after do
|
|
83
78
|
Adhearsion.config = nil
|
|
84
79
|
end
|
|
85
80
|
|
|
86
|
-
subject{ Adhearsion.config[:
|
|
81
|
+
subject{ Adhearsion.config[:core] }
|
|
87
82
|
|
|
88
|
-
it "should return the valid
|
|
83
|
+
it "should return the valid core configuration object" do
|
|
89
84
|
expect(subject).to be_instance_of ::Loquacious::Configuration
|
|
90
85
|
end
|
|
91
86
|
|
|
92
|
-
it "should allow to retrieve any
|
|
93
|
-
expect(subject.
|
|
87
|
+
it "should allow to retrieve any core configuration value" do
|
|
88
|
+
expect(subject.type).to eq(:xmpp)
|
|
94
89
|
end
|
|
95
90
|
|
|
96
91
|
describe "if configuration has a named environment" do
|
|
92
|
+
let(:env) { :development }
|
|
97
93
|
|
|
98
|
-
|
|
99
|
-
Adhearsion::Configuration.new
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
let :env_values do
|
|
103
|
-
config_obj.valid_environments.inject({}) do |hash, k|
|
|
104
|
-
hash[k] = hash.keys.length
|
|
105
|
-
hash
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
let :config_object do
|
|
110
|
-
config_obj do
|
|
94
|
+
subject do
|
|
95
|
+
Adhearsion::Configuration.new env do
|
|
111
96
|
my_level(-1, :desc => "An index to check the environment value is being retrieved")
|
|
112
97
|
end
|
|
113
98
|
end
|
|
114
99
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
env.
|
|
100
|
+
before do
|
|
101
|
+
subject.production do |env|
|
|
102
|
+
env.core.my_level = 0
|
|
118
103
|
end
|
|
119
|
-
|
|
120
|
-
env.
|
|
104
|
+
subject.development do |env|
|
|
105
|
+
env.core.my_level = 1
|
|
121
106
|
end
|
|
122
|
-
|
|
123
|
-
env.
|
|
107
|
+
subject.staging do |env|
|
|
108
|
+
env.core.my_level = 2
|
|
124
109
|
end
|
|
125
|
-
|
|
126
|
-
env.
|
|
110
|
+
subject.test do |env|
|
|
111
|
+
env.core.my_level = 3
|
|
127
112
|
end
|
|
128
|
-
config_object
|
|
129
113
|
end
|
|
130
114
|
|
|
131
115
|
it "should return by default the development value" do
|
|
132
|
-
expect(subject.
|
|
116
|
+
expect(subject.core.my_level).to eq(1)
|
|
133
117
|
end
|
|
134
118
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
119
|
+
{
|
|
120
|
+
production: 0,
|
|
121
|
+
development: 1,
|
|
122
|
+
staging: 2,
|
|
123
|
+
test: 3,
|
|
124
|
+
}.each do |env, value|
|
|
125
|
+
describe "in #{env} environment" do
|
|
126
|
+
let(:env) { env }
|
|
127
|
+
|
|
128
|
+
it "should return the #{env} value" do
|
|
129
|
+
expect(subject.core.my_level).to eq(value)
|
|
130
|
+
end
|
|
139
131
|
end
|
|
140
132
|
end
|
|
141
133
|
end
|
|
@@ -143,35 +135,21 @@ describe Adhearsion::Configuration do
|
|
|
143
135
|
|
|
144
136
|
describe "while defining the environment" do
|
|
145
137
|
|
|
146
|
-
|
|
147
|
-
ENV['AHN_ENV'] = nil
|
|
138
|
+
before do
|
|
148
139
|
Adhearsion.config = nil
|
|
149
140
|
end
|
|
150
141
|
|
|
151
|
-
|
|
152
|
-
|
|
142
|
+
after do
|
|
143
|
+
Adhearsion.environment = nil
|
|
144
|
+
Adhearsion.config = nil
|
|
153
145
|
end
|
|
154
146
|
|
|
155
147
|
[:development, :production, :staging, :test].each do |env|
|
|
156
|
-
it "should respond to #{env
|
|
148
|
+
it "should respond to #{env}" do
|
|
157
149
|
expect(Adhearsion.config).to respond_to(env)
|
|
158
150
|
end
|
|
159
151
|
end
|
|
160
152
|
|
|
161
|
-
context "when the ENV value is valid" do
|
|
162
|
-
[:production, :staging, :test].each do |env|
|
|
163
|
-
it "should override the environment value with #{env.to_s} when set in ENV value" do
|
|
164
|
-
ENV['AHN_ENV'] = env.to_s
|
|
165
|
-
expect(Adhearsion.config.platform.environment).to eq(env)
|
|
166
|
-
end
|
|
167
|
-
end
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
it "should not override the default environment with the ENV value if valid" do
|
|
171
|
-
ENV['AHN_ENV'] = "invalid_value"
|
|
172
|
-
expect(Adhearsion.config.platform.environment).to eq(:development)
|
|
173
|
-
end
|
|
174
|
-
|
|
175
153
|
it "should allow to add a new environment" do
|
|
176
154
|
expect(Adhearsion.config.valid_environment?(:another_environment)).to eq(false)
|
|
177
155
|
Adhearsion.environments << :another_environment
|
|
@@ -187,17 +165,16 @@ describe Adhearsion::Configuration do
|
|
|
187
165
|
|
|
188
166
|
subject { Adhearsion.config }
|
|
189
167
|
|
|
190
|
-
it "should retrieve a string with the
|
|
191
|
-
desc = subject.description :
|
|
168
|
+
it "should retrieve a string with the core configuration" do
|
|
169
|
+
desc = subject.description :core, :show_values => false
|
|
192
170
|
expect(desc.length).to be > 0
|
|
193
|
-
expect(desc).to match(/^.*environment.*$/)
|
|
194
171
|
expect(desc).to match(/^.*root.*$/)
|
|
195
172
|
end
|
|
196
173
|
|
|
197
|
-
it "should retrieve a string with the
|
|
198
|
-
desc = subject.description :
|
|
174
|
+
it "should retrieve a string with the core configuration and values" do
|
|
175
|
+
desc = subject.description :core
|
|
199
176
|
expect(desc.length).to be > 0
|
|
200
|
-
expect(desc).to match(/^.*
|
|
177
|
+
expect(desc).to match(/^.*type.*:xmpp.*$/)
|
|
201
178
|
expect(desc).to match(/^.*root.*$/)
|
|
202
179
|
end
|
|
203
180
|
|
|
@@ -236,33 +213,44 @@ describe Adhearsion::Configuration do
|
|
|
236
213
|
end
|
|
237
214
|
|
|
238
215
|
context "when config has named environments" do
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
c.development do |env|
|
|
245
|
-
env.my_plugin.name = "development"
|
|
246
|
-
end
|
|
247
|
-
c.staging do |env|
|
|
248
|
-
env.my_plugin.name = "staging"
|
|
249
|
-
end
|
|
250
|
-
c.test do |env|
|
|
251
|
-
env.my_plugin.name = "test"
|
|
252
|
-
end
|
|
216
|
+
let(:env) { :development }
|
|
217
|
+
|
|
218
|
+
let(:config) do
|
|
219
|
+
Adhearsion::Configuration.new env do
|
|
220
|
+
my_level(-1, :desc => "An index to check the environment value is being retrieved")
|
|
253
221
|
end
|
|
254
|
-
Adhearsion.config[:my_plugin]
|
|
255
222
|
end
|
|
256
223
|
|
|
257
|
-
|
|
258
|
-
|
|
224
|
+
before do
|
|
225
|
+
config.production do |env|
|
|
226
|
+
env.my_plugin.name = "production"
|
|
227
|
+
end
|
|
228
|
+
config.development do |env|
|
|
229
|
+
env.my_plugin.name = "development"
|
|
230
|
+
end
|
|
231
|
+
config.staging do |env|
|
|
232
|
+
env.my_plugin.name = "staging"
|
|
233
|
+
end
|
|
234
|
+
config.test do |env|
|
|
235
|
+
env.my_plugin.name = "test"
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
subject do
|
|
240
|
+
config.my_plugin
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
it "should return by default the development value" do
|
|
259
244
|
expect(subject.name).to eq("development")
|
|
260
245
|
end
|
|
261
246
|
|
|
262
|
-
[:
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
247
|
+
[:production, :development, :staging, :test].each do |env, value|
|
|
248
|
+
describe "in #{env} environment" do
|
|
249
|
+
let(:env) { env }
|
|
250
|
+
|
|
251
|
+
it "should return the #{env} value" do
|
|
252
|
+
expect(subject.name).to eq(env.to_s)
|
|
253
|
+
end
|
|
266
254
|
end
|
|
267
255
|
end
|
|
268
256
|
end
|
|
@@ -284,21 +272,19 @@ describe Adhearsion::Configuration do
|
|
|
284
272
|
expect(desc).to match(/^.*host.*$/)
|
|
285
273
|
end
|
|
286
274
|
|
|
287
|
-
it "should retrieve both
|
|
275
|
+
it "should retrieve both core and plugin configuration" do
|
|
288
276
|
desc = subject.description :all
|
|
289
277
|
expect(desc.length).to be > 0
|
|
290
|
-
expect(desc).to match(/^.*environment.*:development.*$/)
|
|
291
278
|
expect(desc).to match(/^.*root.*$/)
|
|
292
279
|
expect(desc).to match(/^.*name.*user.*$/)
|
|
293
280
|
expect(desc).to match(/^.*password.*password.*$/)
|
|
294
281
|
expect(desc).to match(/^.*host.*localhost.*$/)
|
|
295
282
|
end
|
|
296
283
|
|
|
297
|
-
it "should retrieve both
|
|
284
|
+
it "should retrieve both core and plugin configuration with no values" do
|
|
298
285
|
desc = subject.description :all, :show_values => false
|
|
299
286
|
expect(desc.length).to be > 0
|
|
300
|
-
expect(desc).to match(/^.*Configuration for
|
|
301
|
-
expect(desc).to match(/^.*environment.*$/)
|
|
287
|
+
expect(desc).to match(/^.*Configuration for core.*$/)
|
|
302
288
|
expect(desc).to match(/^.*root.*$/)
|
|
303
289
|
expect(desc).to match(/^.*Configuration for my_plugin.*$/)
|
|
304
290
|
expect(desc).to match(/^.*name.*$/)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe Adhearsion::Event::Answered do
|
|
6
|
+
it 'registers itself' do
|
|
7
|
+
expect(Adhearsion::Rayo::RayoNode.class_from_registration(:answered, 'urn:xmpp:rayo:1')).to eq(described_class)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe "from a stanza" do
|
|
11
|
+
let :stanza do
|
|
12
|
+
<<-MESSAGE
|
|
13
|
+
<answered xmlns='urn:xmpp:rayo:1'>
|
|
14
|
+
<!-- Signaling (e.g. SIP) Headers -->
|
|
15
|
+
<header name="X-skill" value="agent" />
|
|
16
|
+
<header name="X-customer-id" value="8877" />
|
|
17
|
+
</answered>
|
|
18
|
+
MESSAGE
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
subject { Adhearsion::Rayo::RayoNode.from_xml parse_stanza(stanza).root, '9f00061', '1' }
|
|
22
|
+
|
|
23
|
+
it { is_expected.to be_instance_of described_class }
|
|
24
|
+
|
|
25
|
+
it_should_behave_like 'event'
|
|
26
|
+
|
|
27
|
+
describe '#headers' do
|
|
28
|
+
subject { super().headers }
|
|
29
|
+
it { is_expected.to eq({ 'X-skill' => 'agent', 'X-customer-id' => '8877' }) }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
context "with no headers provided" do
|
|
33
|
+
let(:stanza) { '<answered xmlns="urn:xmpp:rayo:1"/>' }
|
|
34
|
+
|
|
35
|
+
describe '#headers' do
|
|
36
|
+
subject { super().headers }
|
|
37
|
+
it { is_expected.to eq({}) }
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
describe "when setting options in initializer" do
|
|
43
|
+
subject { described_class.new headers: { 'X-skill' => 'agent', 'X-customer-id' => '8877' } }
|
|
44
|
+
|
|
45
|
+
describe '#headers' do
|
|
46
|
+
subject { super().headers }
|
|
47
|
+
it { is_expected.to eq({ 'X-skill' => 'agent', 'X-customer-id' => '8877' }) }
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
Searching 326 files for "< Adhearsion::Event" (case sensitive)
|
|
2
|
+
|
|
3
|
+
/Users/ben/code/adhearsion/lib/adhearsion/event/asterisk/ami.rb:
|
|
4
|
+
4 class Event
|
|
5
|
+
5 module Asterisk
|
|
6
|
+
6: class AMI < Adhearsion::Event
|
|
7
|
+
7 register :event, :ami
|
|
8
|
+
8
|
|
9
|
+
|
|
10
|
+
/Users/ben/code/adhearsion/spec/adhearsion/call_controller_spec.rb:
|
|
11
|
+
440 end
|
|
12
|
+
441 expect(latch.wait(1)).to be false
|
|
13
|
+
442: subject.call << Adhearsion::Event::Joined.new(call_uri: 'call1')
|
|
14
|
+
443 expect(latch.wait(1)).to be false
|
|
15
|
+
444: subject.call << Adhearsion::Event::Unjoined.new(call_uri: 'call1')
|
|
16
|
+
445 expect(latch.wait(1)).to be true
|
|
17
|
+
446 end
|
|
18
|
+
...
|
|
19
|
+
456 end
|
|
20
|
+
457 expect(latch.wait(1)).to be false
|
|
21
|
+
458: subject.call << Adhearsion::Event::Joined.new(:mixer_name => 'foobar')
|
|
22
|
+
459 expect(latch.wait(1)).to be false
|
|
23
|
+
460: subject.call << Adhearsion::Event::Unjoined.new(:mixer_name => 'foobar')
|
|
24
|
+
461 expect(latch.wait(1)).to be true
|
|
25
|
+
462 end
|
|
26
|
+
...
|
|
27
|
+
473 end
|
|
28
|
+
474 expect(latch.wait(1)).to be false
|
|
29
|
+
475: subject.call << Adhearsion::Event::Joined.new(call_uri: 'call1')
|
|
30
|
+
476 expect(latch.wait(1)).to be true
|
|
31
|
+
477 end
|
|
32
|
+
...
|
|
33
|
+
487 end
|
|
34
|
+
488 expect(latch.wait(1)).to be false
|
|
35
|
+
489: subject.call << Adhearsion::Event::Joined.new(:mixer_name => 'foobar')
|
|
36
|
+
490 expect(latch.wait(1)).to be true
|
|
37
|
+
491 end
|
|
38
|
+
|
|
39
|
+
/Users/ben/code/adhearsion/spec/adhearsion/call_spec.rb:
|
|
40
|
+
1126 expect(result[:joined_condition].wait(0.5)).to be_falsey
|
|
41
|
+
1127
|
|
42
|
+
1128: subject << Adhearsion::Event::Joined.new(call_uri: uri)
|
|
43
|
+
1129 expect(result[:joined_condition].wait(0.5)).to be_truthy
|
|
44
|
+
1130 end
|
|
45
|
+
....
|
|
46
|
+
1136 expect(result[:unjoined_condition].wait(0.5)).to be_falsey
|
|
47
|
+
1137
|
|
48
|
+
1138: subject << Adhearsion::Event::Joined.new(call_uri: uri)
|
|
49
|
+
1139 expect(result[:unjoined_condition].wait(0.5)).to be_falsey
|
|
50
|
+
1140
|
|
51
|
+
1141: subject << Adhearsion::Event::Unjoined.new(call_uri: uri)
|
|
52
|
+
1142 expect(result[:unjoined_condition].wait(0.5)).to be_truthy
|
|
53
|
+
1143 end
|
|
54
|
+
....
|
|
55
|
+
1150 expect(result[:unjoined_condition].wait(0.5)).to be_falsey
|
|
56
|
+
1151
|
|
57
|
+
1152: subject << Adhearsion::Event::End.new
|
|
58
|
+
1153 expect(result[:joined_condition].wait(0.5)).to be_truthy
|
|
59
|
+
1154 expect(result[:unjoined_condition].wait(0.5)).to be_truthy
|
|
60
|
+
....
|
|
61
|
+
1159 result = subject.join target, :media => :bridge, :direction => :recv
|
|
62
|
+
1160
|
|
63
|
+
1161: subject << Adhearsion::Event::Joined.new(call_uri: uri)
|
|
64
|
+
1162: subject << Adhearsion::Event::Unjoined.new(call_uri: uri)
|
|
65
|
+
1163
|
|
66
|
+
1164: subject << Adhearsion::Event::End.new
|
|
67
|
+
1165 end
|
|
68
|
+
1166
|
|
69
|
+
....
|
|
70
|
+
1169 result = subject.join target, :media => :bridge, :direction => :recv
|
|
71
|
+
1170
|
|
72
|
+
1171: subject << Adhearsion::Event::Joined.new(call_uri: uri)
|
|
73
|
+
1172: subject << Adhearsion::Event::Joined.new(call_uri: uri)
|
|
74
|
+
1173
|
|
75
|
+
1174 expect(subject).to be_alive
|
|
76
|
+
....
|
|
77
|
+
1207 expect(result[:joined_condition].wait(0.5)).to be_falsey
|
|
78
|
+
1208
|
|
79
|
+
1209: subject << Adhearsion::Event::Joined.new(call_uri: uri)
|
|
80
|
+
1210 expect(result[:joined_condition].wait(0.5)).to be_truthy
|
|
81
|
+
1211 end
|
|
82
|
+
....
|
|
83
|
+
1217 expect(result[:unjoined_condition].wait(0.5)).to be_falsey
|
|
84
|
+
1218
|
|
85
|
+
1219: subject << Adhearsion::Event::Joined.new(call_uri: uri)
|
|
86
|
+
1220 expect(result[:unjoined_condition].wait(0.5)).to be_falsey
|
|
87
|
+
1221
|
|
88
|
+
1222: subject << Adhearsion::Event::Unjoined.new(call_uri: uri)
|
|
89
|
+
1223 expect(result[:unjoined_condition].wait(0.5)).to be_truthy
|
|
90
|
+
1224 end
|
|
91
|
+
....
|
|
92
|
+
1231 expect(result[:unjoined_condition].wait(0.5)).to be_falsey
|
|
93
|
+
1232
|
|
94
|
+
1233: subject << Adhearsion::Event::End.new
|
|
95
|
+
1234 expect(result[:joined_condition].wait(0.5)).to be_truthy
|
|
96
|
+
1235 expect(result[:unjoined_condition].wait(0.5)).to be_truthy
|
|
97
|
+
....
|
|
98
|
+
1240 result = subject.join target, :media => :bridge, :direction => :recv
|
|
99
|
+
1241
|
|
100
|
+
1242: subject << Adhearsion::Event::Joined.new(call_uri: uri)
|
|
101
|
+
1243: subject << Adhearsion::Event::Unjoined.new(call_uri: uri)
|
|
102
|
+
1244
|
|
103
|
+
1245: subject << Adhearsion::Event::End.new
|
|
104
|
+
1246 end
|
|
105
|
+
1247
|
|
106
|
+
....
|
|
107
|
+
1250 result = subject.join target, :media => :bridge, :direction => :recv
|
|
108
|
+
1251
|
|
109
|
+
1252: subject << Adhearsion::Event::Joined.new(call_uri: uri)
|
|
110
|
+
1253: subject << Adhearsion::Event::Joined.new(call_uri: uri)
|
|
111
|
+
1254
|
|
112
|
+
1255 expect(subject).to be_alive
|
|
113
|
+
....
|
|
114
|
+
1289 expect(result[:joined_condition].wait(0.5)).to be_falsey
|
|
115
|
+
1290
|
|
116
|
+
1291: subject << Adhearsion::Event::Joined.new(call_uri: uri)
|
|
117
|
+
1292 expect(result[:joined_condition].wait(0.5)).to be_truthy
|
|
118
|
+
1293 end
|
|
119
|
+
....
|
|
120
|
+
1299 expect(result[:unjoined_condition].wait(0.5)).to be_falsey
|
|
121
|
+
1300
|
|
122
|
+
1301: subject << Adhearsion::Event::Joined.new(call_uri: uri)
|
|
123
|
+
1302 expect(result[:unjoined_condition].wait(0.5)).to be_falsey
|
|
124
|
+
1303
|
|
125
|
+
1304: subject << Adhearsion::Event::Unjoined.new(call_uri: uri)
|
|
126
|
+
1305 expect(result[:unjoined_condition].wait(0.5)).to be_truthy
|
|
127
|
+
1306 end
|
|
128
|
+
....
|
|
129
|
+
1313 expect(result[:unjoined_condition].wait(0.5)).to be_falsey
|
|
130
|
+
1314
|
|
131
|
+
1315: subject << Adhearsion::Event::End.new
|
|
132
|
+
1316 expect(result[:joined_condition].wait(0.5)).to be_truthy
|
|
133
|
+
1317 expect(result[:unjoined_condition].wait(0.5)).to be_truthy
|
|
134
|
+
....
|
|
135
|
+
1322 result = subject.join target.merge({:media => :bridge, :direction => :recv})
|
|
136
|
+
1323
|
|
137
|
+
1324: subject << Adhearsion::Event::Joined.new(call_uri: uri)
|
|
138
|
+
1325: subject << Adhearsion::Event::Unjoined.new(call_uri: uri)
|
|
139
|
+
1326
|
|
140
|
+
1327: subject << Adhearsion::Event::End.new
|
|
141
|
+
1328 end
|
|
142
|
+
1329
|
|
143
|
+
....
|
|
144
|
+
1332 result = subject.join target.merge({:media => :bridge, :direction => :recv})
|
|
145
|
+
1333
|
|
146
|
+
1334: subject << Adhearsion::Event::Joined.new(call_uri: uri)
|
|
147
|
+
1335: subject << Adhearsion::Event::Joined.new(call_uri: uri)
|
|
148
|
+
1336
|
|
149
|
+
1337 expect(subject).to be_alive
|
|
150
|
+
....
|
|
151
|
+
1370 expect(result[:joined_condition].wait(0.5)).to be_falsey
|
|
152
|
+
1371
|
|
153
|
+
1372: subject << Adhearsion::Event::Joined.new(mixer_name: mixer_name)
|
|
154
|
+
1373 expect(result[:joined_condition].wait(0.5)).to be_truthy
|
|
155
|
+
1374 end
|
|
156
|
+
....
|
|
157
|
+
1380 expect(result[:unjoined_condition].wait(0.5)).to be_falsey
|
|
158
|
+
1381
|
|
159
|
+
1382: subject << Adhearsion::Event::Joined.new(mixer_name: mixer_name)
|
|
160
|
+
1383 expect(result[:unjoined_condition].wait(0.5)).to be_falsey
|
|
161
|
+
1384
|
|
162
|
+
1385: subject << Adhearsion::Event::Unjoined.new(mixer_name: mixer_name)
|
|
163
|
+
1386 expect(result[:unjoined_condition].wait(0.5)).to be_truthy
|
|
164
|
+
1387 end
|
|
165
|
+
....
|
|
166
|
+
1394 expect(result[:unjoined_condition].wait(0.5)).to be_falsey
|
|
167
|
+
1395
|
|
168
|
+
1396: subject << Adhearsion::Event::End.new
|
|
169
|
+
1397 expect(result[:joined_condition].wait(0.5)).to be_truthy
|
|
170
|
+
1398 expect(result[:unjoined_condition].wait(0.5)).to be_truthy
|
|
171
|
+
....
|
|
172
|
+
1403 result = subject.join target.merge({:media => :bridge, :direction => :recv})
|
|
173
|
+
1404
|
|
174
|
+
1405: subject << Adhearsion::Event::Joined.new(mixer_name: mixer_name)
|
|
175
|
+
1406: subject << Adhearsion::Event::Unjoined.new(mixer_name: mixer_name)
|
|
176
|
+
1407
|
|
177
|
+
1408: subject << Adhearsion::Event::End.new
|
|
178
|
+
1409 end
|
|
179
|
+
1410
|
|
180
|
+
....
|
|
181
|
+
1413 result = subject.join target.merge({:media => :bridge, :direction => :recv})
|
|
182
|
+
1414
|
|
183
|
+
1415: subject << Adhearsion::Event::Joined.new(mixer_name: mixer_name)
|
|
184
|
+
1416: subject << Adhearsion::Event::Joined.new(mixer_name: mixer_name)
|
|
185
|
+
1417
|
|
186
|
+
1418 expect(subject).to be_alive
|
|
187
|
+
|
|
188
|
+
/Users/ben/code/adhearsion/spec/adhearsion/outbound_call_spec.rb:
|
|
189
|
+
68 expect(Adhearsion.router).to receive(:handle).once.with(mock_call)
|
|
190
|
+
69
|
|
191
|
+
70: OutboundCall.originate(to) << Adhearsion::Event::Answered.new
|
|
192
|
+
71 end
|
|
193
|
+
72
|
|
194
|
+
..
|
|
195
|
+
78 expect(mock_call).to receive(:execute_controller).once.with kind_of(controller), kind_of(Proc)
|
|
196
|
+
79 call = OutboundCall.originate to, :controller => controller
|
|
197
|
+
80: call << Adhearsion::Event::Answered.new
|
|
198
|
+
81 end
|
|
199
|
+
82
|
|
200
|
+
..
|
|
201
|
+
86
|
|
202
|
+
87 call = OutboundCall.originate to, :controller => controller
|
|
203
|
+
88: call << Adhearsion::Event::Answered.new
|
|
204
|
+
89 sleep 0.5
|
|
205
|
+
90 end
|
|
206
|
+
..
|
|
207
|
+
96 expect(mock_call).to receive(:execute_controller).with(expected_controller, kind_of(Proc)).once
|
|
208
|
+
97 call = OutboundCall.originate to, :controller => controller, :controller_metadata => {:foo => 'bar'}
|
|
209
|
+
98: call << Adhearsion::Event::Answered.new
|
|
210
|
+
99 end
|
|
211
|
+
100 end
|
|
212
|
+
...
|
|
213
|
+
111 :foobar
|
|
214
|
+
112 end
|
|
215
|
+
113: call << Adhearsion::Event::Answered.new
|
|
216
|
+
114 end
|
|
217
|
+
115 end
|
|
218
|
+
|
|
219
|
+
/Users/ben/code/adhearsion/spec/adhearsion/call_controller/dial_spec.rb:
|
|
220
|
+
267 expect(call).to receive(:answer).once
|
|
221
|
+
268 expect(other_mock_call).to receive(:join).once.with(call, {}) do
|
|
222
|
+
269: call << Adhearsion::Event::Joined.new(call_uri: other_mock_call.id)
|
|
223
|
+
270: other_mock_call << Adhearsion::Event::Joined.new(call_uri: call.id)
|
|
224
|
+
271 end
|
|
225
|
+
272
|
|
226
|
+
...
|
|
227
|
+
291 expect(call).to receive(:answer).once
|
|
228
|
+
292 expect(other_mock_call).to receive(:join).once.with(call, {}) do
|
|
229
|
+
293: call << Adhearsion::Event::Joined.new(call_uri: other_mock_call.id)
|
|
230
|
+
294: other_mock_call << Adhearsion::Event::Joined.new(call_uri: call.id)
|
|
231
|
+
295 end
|
|
232
|
+
296 allow(other_mock_call).to receive_messages hangup: true
|
|
233
|
+
...
|
|
234
|
+
307 base_time = Time.local(2008, 9, 1, 12, 0, 37)
|
|
235
|
+
308 Timecop.freeze base_time
|
|
236
|
+
309: other_mock_call << Adhearsion::Event::Unjoined.new(call_uri: call.id)
|
|
237
|
+
310 other_mock_call << mock_end
|
|
238
|
+
311
|
|
239
|
+
...
|
|
240
|
+
325 expect(call).to receive(:answer).once
|
|
241
|
+
326 expect(other_mock_call).to receive(:join).once.with(call, media: :direct) do
|
|
242
|
+
327: call << Adhearsion::Event::Joined.new(call_uri: other_mock_call.id)
|
|
243
|
+
328: other_mock_call << Adhearsion::Event::Joined.new(call_uri: call.id)
|
|
244
|
+
329 end
|
|
245
|
+
330 allow(other_mock_call).to receive_messages hangup: true
|
|
246
|
+
...
|
|
247
|
+
336 other_mock_call << mock_answered
|
|
248
|
+
337
|
|
249
|
+
338: other_mock_call << Adhearsion::Event::Unjoined.new(call_uri: call.id)
|
|
250
|
+
339 other_mock_call << mock_end
|
|
251
|
+
340
|
|
252
|
+
...
|
|
253
|
+
352 expect(call).to receive(:answer).once
|
|
254
|
+
353 expect(other_mock_call).to receive(:join).once.with(join_target, join_options) do
|
|
255
|
+
354: call << Adhearsion::Event::Joined.new(call_uri: other_mock_call.id)
|
|
256
|
+
355: other_mock_call << Adhearsion::Event::Joined.new(call_uri: call.id)
|
|
257
|
+
356 end
|
|
258
|
+
357 allow(other_mock_call).to receive(:unjoin) do
|
|
259
|
+
358: call << Adhearsion::Event::Unjoined.new(call_uri: other_mock_call.id)
|
|
260
|
+
359: other_mock_call << Adhearsion::Event::Unjoined.new(call_uri: call.id)
|
|
261
|
+
360 end
|
|
262
|
+
361 end
|
|
263
|
+
...
|
|
264
|
+
363 it "should unjoin the calls" do
|
|
265
|
+
364 expect(other_mock_call).to receive(:unjoin).once.ordered.with(call) do
|
|
266
|
+
365: call << Adhearsion::Event::Unjoined.new(call_uri: other_mock_call.id)
|
|
267
|
+
366: other_mock_call << Adhearsion::Event::Unjoined.new(call_uri: call.id)
|
|
268
|
+
367 end
|
|
269
|
+
368
|
|
270
|
+
...
|
|
271
|
+
504 it "should rejoin the calls" do
|
|
272
|
+
505 expect(other_mock_call).to receive(:unjoin).once.ordered.with(call) do
|
|
273
|
+
506: call << Adhearsion::Event::Unjoined.new(call_uri: other_mock_call.id)
|
|
274
|
+
507: other_mock_call << Adhearsion::Event::Unjoined.new(call_uri: call.id)
|
|
275
|
+
508 end
|
|
276
|
+
509
|
|
277
|
+
...
|
|
278
|
+
523
|
|
279
|
+
524 expect(other_mock_call).to receive(:join).once.ordered.with(call, {}) do
|
|
280
|
+
525: call << Adhearsion::Event::Joined.new(call_uri: other_mock_call.id)
|
|
281
|
+
526: other_mock_call << Adhearsion::Event::Joined.new(call_uri: call.id)
|
|
282
|
+
527 end
|
|
283
|
+
528 dial.rejoin
|
|
284
|
+
...
|
|
285
|
+
550
|
|
286
|
+
551 expect(other_mock_call).to receive(:join).once.ordered.with(call, media: :direct) do
|
|
287
|
+
552: call << Adhearsion::Event::Joined.new(call_uri: other_mock_call.id)
|
|
288
|
+
553: other_mock_call << Adhearsion::Event::Joined.new(call_uri: call.id)
|
|
289
|
+
554 end
|
|
290
|
+
555 dial.rejoin
|
|
291
|
+
...
|
|
292
|
+
569
|
|
293
|
+
570 expect(other_mock_call).to receive(:join).once.ordered.with(call, media: :direct) do
|
|
294
|
+
571: call << Adhearsion::Event::Joined.new(call_uri: other_mock_call.id)
|
|
295
|
+
572: other_mock_call << Adhearsion::Event::Joined.new(call_uri: call.id)
|
|
296
|
+
573 end
|
|
297
|
+
574 dial.rejoin nil, media: :direct
|
|
298
|
+
...
|
|
299
|
+
584 expect(other_mock_call).to receive(:unjoin).once.ordered.with(join_target)
|
|
300
|
+
585 expect(call).to receive(:unjoin).once.ordered.with(join_target) do
|
|
301
|
+
586: call << Adhearsion::Event::Unjoined.new(join_target)
|
|
302
|
+
587: other_mock_call << Adhearsion::Event::Unjoined.new(join_target)
|
|
303
|
+
588 end
|
|
304
|
+
589
|
|
305
|
+
...
|
|
306
|
+
620 it "should join all calls to the mixer" do
|
|
307
|
+
621 expect(other_mock_call).to receive(:unjoin).once.ordered.with(call) do
|
|
308
|
+
622: call << Adhearsion::Event::Unjoined.new(call_uri: other_mock_call.id)
|
|
309
|
+
623: other_mock_call << Adhearsion::Event::Unjoined.new(call_uri: call.id)
|
|
310
|
+
624 end
|
|
311
|
+
625
|
|
312
|
+
...
|
|
313
|
+
652 it "#split should then unjoin calls from the mixer" do
|
|
314
|
+
653 expect(other_mock_call).to receive(:unjoin).once.ordered.with(call) do
|
|
315
|
+
654: call << Adhearsion::Event::Unjoined.new(call_uri: other_mock_call.id)
|
|
316
|
+
655: other_mock_call << Adhearsion::Event::Unjoined.new(call_uri: call.id)
|
|
317
|
+
656 end
|
|
318
|
+
657
|
|
319
|
+
...
|
|
320
|
+
675
|
|
321
|
+
676 expect(other_mock_call).to receive(:unjoin).once.ordered.with(mixer_name: mixer) do
|
|
322
|
+
677: other_mock_call << Adhearsion::Event::Unjoined.new(mixer_name: mixer)
|
|
323
|
+
678 end
|
|
324
|
+
679 expect(call).to receive(:unjoin).once.ordered.with(mixer_name: mixer) do
|
|
325
|
+
680: call << Adhearsion::Event::Unjoined.new(mixer_name: mixer)
|
|
326
|
+
681 end
|
|
327
|
+
682 dial.split
|
|
328
|
+
...
|
|
329
|
+
718 it "should split calls, rejoin to a mixer, and rejoin other calls to mixer" do
|
|
330
|
+
719 expect(other_mock_call).to receive(:unjoin).once.ordered.with(call) do
|
|
331
|
+
720: call << Adhearsion::Event::Unjoined.new(call_uri: other_mock_call.id)
|
|
332
|
+
721: other_mock_call << Adhearsion::Event::Unjoined.new(call_uri: call.id)
|
|
333
|
+
722 end
|
|
334
|
+
723 expect(second_other_mock_call).to receive(:unjoin).once.ordered.with(second_root_call) do
|
|
335
|
+
724: second_root_call << Adhearsion::Event::Unjoined.new(call_uri: second_other_mock_call.id)
|
|
336
|
+
725: second_other_mock_call << Adhearsion::Event::Unjoined.new(call_uri: second_root_call.id)
|
|
337
|
+
726 end
|
|
338
|
+
727
|
|
339
|
+
...
|
|
340
|
+
857 [call, second_root_call, second_other_mock_call].each do |call|
|
|
341
|
+
858 expect(call).to receive(:unjoin).once.with(mixer_name: mixer) do
|
|
342
|
+
859: call << Adhearsion::Event::Unjoined.new(mixer_name: mixer)
|
|
343
|
+
860 end
|
|
344
|
+
861 end
|
|
345
|
+
...
|
|
346
|
+
865 [call, other_mock_call, second_root_call, second_other_mock_call].each do |call|
|
|
347
|
+
866 expect(call).to receive(:join).once.with({mixer_name: mixer}, {}) do
|
|
348
|
+
867: call << Adhearsion::Event::Joined.new(mixer_name: mixer)
|
|
349
|
+
868 end
|
|
350
|
+
869 end
|
|
351
|
+
...
|
|
352
|
+
965 [call, second_root_call, second_other_mock_call].each do |call|
|
|
353
|
+
966 expect(call).to receive(:unjoin).once.with(mixer_name: mixer) do
|
|
354
|
+
967: call << Adhearsion::Event::Unjoined.new(mixer_name: mixer)
|
|
355
|
+
968 end
|
|
356
|
+
969 end
|
|
357
|
+
...
|
|
358
|
+
978 [call, second_root_call, second_other_mock_call].each do |call|
|
|
359
|
+
979 expect(call).to receive(:join).once.with({mixer_name: mixer}, {}) do
|
|
360
|
+
980: call << Adhearsion::Event::Joined.new(mixer_name: mixer)
|
|
361
|
+
981 end
|
|
362
|
+
982 end
|
|
363
|
+
...
|
|
364
|
+
1095
|
|
365
|
+
1096 other_mock_call << mock_answered
|
|
366
|
+
1097: other_mock_call << Adhearsion::Event::Unjoined.new(call_uri: call.id)
|
|
367
|
+
1098
|
|
368
|
+
1099 expect(latch.wait(2)).to be_truthy
|
|
369
|
+
....
|
|
370
|
+
1354 expect(call).to receive(:answer).once
|
|
371
|
+
1355 expect(other_mock_call).to receive(:join).once.with(call, {}) do
|
|
372
|
+
1356: call << Adhearsion::Event::Joined.new(call_uri: other_mock_call.id)
|
|
373
|
+
1357: other_mock_call << Adhearsion::Event::Joined.new(call_uri: call.id)
|
|
374
|
+
1358 end
|
|
375
|
+
1359
|
|
376
|
+
....
|
|
377
|
+
1369 base_time = Time.local(2008, 9, 1, 12, 0, 42)
|
|
378
|
+
1370 Timecop.freeze base_time
|
|
379
|
+
1371: other_mock_call << Adhearsion::Event::Unjoined.new(call_uri: call.id)
|
|
380
|
+
1372
|
|
381
|
+
1373 expect(latch.wait(2)).to be_truthy
|
|
382
|
+
....
|
|
383
|
+
1444 expect(other_mock_call).to receive(:dial).once.with(to, from: nil)
|
|
384
|
+
1445 expect(other_mock_call).to receive(:join).once.with(call, {}) do
|
|
385
|
+
1446: call << Adhearsion::Event::Joined.new(call_uri: other_mock_call.id)
|
|
386
|
+
1447: other_mock_call << Adhearsion::Event::Joined.new(call_uri: call.id)
|
|
387
|
+
1448 end
|
|
388
|
+
1449 expect(other_mock_call).to receive(:hangup).once do
|
|
389
|
+
|
|
390
|
+
92 matches across 5 files
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
Searching 326 files for " < Adhearsion::Event" (case sensitive)
|
|
394
|
+
|
|
395
|
+
/Users/ben/code/adhearsion/lib/adhearsion/event/asterisk/ami.rb:
|
|
396
|
+
4 class Event
|
|
397
|
+
5 module Asterisk
|
|
398
|
+
6: class AMI < Adhearsion::Event
|
|
399
|
+
7 register :event, :ami
|
|
400
|
+
8
|
|
401
|
+
|
|
402
|
+
1 match in 1 file
|