punchblock 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/CHANGELOG.md +4 -0
  2. data/lib/punchblock/command/dial.rb +1 -1
  3. data/lib/punchblock/command/join.rb +4 -4
  4. data/lib/punchblock/command/unjoin.rb +4 -4
  5. data/lib/punchblock/command_node.rb +6 -2
  6. data/lib/punchblock/component/component_node.rb +2 -2
  7. data/lib/punchblock/component/output.rb +7 -7
  8. data/lib/punchblock/component/record.rb +2 -2
  9. data/lib/punchblock/connection/xmpp.rb +18 -9
  10. data/lib/punchblock/core_ext/blather/stanza.rb +1 -1
  11. data/lib/punchblock/event/active_speaker.rb +3 -3
  12. data/lib/punchblock/event/complete.rb +2 -2
  13. data/lib/punchblock/event/joined.rb +3 -3
  14. data/lib/punchblock/event/offer.rb +1 -1
  15. data/lib/punchblock/event/unjoined.rb +3 -3
  16. data/lib/punchblock/rayo_node.rb +3 -3
  17. data/lib/punchblock/translator/asterisk.rb +5 -5
  18. data/lib/punchblock/translator/asterisk/call.rb +8 -8
  19. data/lib/punchblock/translator/asterisk/component.rb +2 -2
  20. data/lib/punchblock/version.rb +1 -1
  21. data/spec/punchblock/command/dial_spec.rb +2 -2
  22. data/spec/punchblock/command/join_spec.rb +9 -9
  23. data/spec/punchblock/command/unjoin_spec.rb +5 -5
  24. data/spec/punchblock/command_node_spec.rb +3 -3
  25. data/spec/punchblock/component/input_spec.rb +3 -3
  26. data/spec/punchblock/component/output_spec.rb +17 -17
  27. data/spec/punchblock/component/record_spec.rb +7 -7
  28. data/spec/punchblock/connection/asterisk_spec.rb +1 -1
  29. data/spec/punchblock/connection/xmpp_spec.rb +45 -16
  30. data/spec/punchblock/event/complete_spec.rb +6 -6
  31. data/spec/punchblock/event/joined_spec.rb +6 -6
  32. data/spec/punchblock/event/started_speaking_spec.rb +4 -4
  33. data/spec/punchblock/event/stopped_speaking_spec.rb +4 -4
  34. data/spec/punchblock/event/unjoined_spec.rb +6 -6
  35. data/spec/punchblock/translator/asterisk/call_spec.rb +30 -30
  36. data/spec/punchblock/translator/asterisk/component/input_spec.rb +2 -2
  37. data/spec/punchblock/translator/asterisk/component_spec.rb +1 -1
  38. data/spec/punchblock/translator/asterisk_spec.rb +2 -2
  39. data/spec/spec_helper.rb +2 -2
  40. metadata +39 -39
@@ -40,8 +40,8 @@ module Punchblock
40
40
  end
41
41
 
42
42
  def send_event(event)
43
- event.component_id = id
44
- event.call_id = call_id
43
+ event.component_id = id
44
+ event.target_call_id = call_id
45
45
  pb_logger.debug "Sending event #{event}"
46
46
  if internal
47
47
  @component_node.add_event event
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Punchblock
4
- VERSION = "0.11.0"
4
+ VERSION = "0.12.0"
5
5
  end
@@ -10,7 +10,7 @@ module Punchblock
10
10
  RayoNode.class_from_registration(:dial, 'urn:xmpp:rayo:1').should be == Dial
11
11
  end
12
12
 
13
- let(:join_params) { {:other_call_id => 'abc123'} }
13
+ let(:join_params) { {:call_id => 'abc123'} }
14
14
 
15
15
  describe "when setting options in initializer" do
16
16
  subject { Dial.new :to => 'tel:+14155551212', :from => 'tel:+13035551212', :timeout => 30000, :headers => { :x_skill => 'agent', :x_customer_id => 8877 }, :join => join_params }
@@ -57,7 +57,7 @@ module Punchblock
57
57
 
58
58
  it "should set the call ID from the ref" do
59
59
  subject.response = ref
60
- subject.call_id.should be == call_id
60
+ subject.target_call_id.should be == call_id
61
61
  end
62
62
  end
63
63
  end
@@ -11,12 +11,12 @@ module Punchblock
11
11
  end
12
12
 
13
13
  describe "when setting options in initializer" do
14
- subject { Join.new :other_call_id => 'abc123', :mixer_name => 'blah', :direction => :duplex, :media => :bridge }
14
+ subject { Join.new :call_id => 'abc123', :mixer_name => 'blah', :direction => :duplex, :media => :bridge }
15
15
 
16
- its(:other_call_id) { should be == 'abc123' }
17
- its(:mixer_name) { should be == 'blah' }
18
- its(:direction) { should be == :duplex }
19
- its(:media) { should be == :bridge }
16
+ its(:call_id) { should be == 'abc123' }
17
+ its(:mixer_name) { should be == 'blah' }
18
+ its(:direction) { should be == :duplex }
19
+ its(:media) { should be == :bridge }
20
20
  end
21
21
 
22
22
  describe "from a stanza" do
@@ -34,10 +34,10 @@ module Punchblock
34
34
 
35
35
  it { should be_instance_of Join }
36
36
 
37
- its(:other_call_id) { should be == 'abc123' }
38
- its(:mixer_name) { should be == 'blah' }
39
- its(:direction) { should be == :duplex }
40
- its(:media) { should be == :bridge }
37
+ its(:call_id) { should be == 'abc123' }
38
+ its(:mixer_name) { should be == 'blah' }
39
+ its(:direction) { should be == :duplex }
40
+ its(:media) { should be == :bridge }
41
41
  end
42
42
  end
43
43
  end
@@ -11,10 +11,10 @@ module Punchblock
11
11
  end
12
12
 
13
13
  describe "when setting options in initializer" do
14
- subject { Unjoin.new :other_call_id => 'abc123', :mixer_name => 'blah' }
14
+ subject { Unjoin.new :call_id => 'abc123', :mixer_name => 'blah' }
15
15
 
16
- its(:other_call_id) { should be == 'abc123' }
17
- its(:mixer_name) { should be == 'blah' }
16
+ its(:call_id) { should be == 'abc123' }
17
+ its(:mixer_name) { should be == 'blah' }
18
18
  end
19
19
 
20
20
  describe "from a stanza" do
@@ -30,8 +30,8 @@ module Punchblock
30
30
 
31
31
  it { should be_instance_of Unjoin }
32
32
 
33
- its(:other_call_id) { should be == 'abc123' }
34
- its(:mixer_name) { should be == 'blah' }
33
+ its(:call_id) { should be == 'abc123' }
34
+ its(:mixer_name) { should be == 'blah' }
35
35
  end
36
36
  end
37
37
  end
@@ -11,12 +11,12 @@ module Punchblock
11
11
  describe "with a call/component ID" do
12
12
  let(:call_id) { 'abc123' }
13
13
  let(:component_id) { 'abc123' }
14
- let(:args) { [{:call_id => call_id, :component_id => component_id}] }
14
+ let(:args) { [{:target_call_id => call_id, :component_id => component_id}] }
15
15
 
16
16
  subject { CommandNode.new(*args) }
17
17
 
18
- its(:call_id) { should be == call_id }
19
- its(:component_id) { should be == component_id }
18
+ its(:target_call_id) { should be == call_id }
19
+ its(:component_id) { should be == component_id }
20
20
  end
21
21
  end
22
22
 
@@ -140,7 +140,7 @@ module Punchblock
140
140
 
141
141
  before do
142
142
  command.component_id = 'abc123'
143
- command.call_id = '123abc'
143
+ command.target_call_id = '123abc'
144
144
  command.client = mock_client
145
145
  end
146
146
 
@@ -149,7 +149,7 @@ module Punchblock
149
149
 
150
150
  its(:to_xml) { should be == '<stop xmlns="urn:xmpp:rayo:1"/>' }
151
151
  its(:component_id) { should be == 'abc123' }
152
- its(:call_id) { should be == '123abc' }
152
+ its(:target_call_id) { should be == '123abc' }
153
153
  end
154
154
 
155
155
  describe '#stop!' do
@@ -160,7 +160,7 @@ module Punchblock
160
160
  end
161
161
 
162
162
  it "should send its command properly" do
163
- mock_client.expects(:execute_command).with(command.stop_action, :call_id => '123abc', :component_id => 'abc123')
163
+ mock_client.expects(:execute_command).with(command.stop_action, :target_call_id => '123abc', :component_id => 'abc123')
164
164
  command.stop!
165
165
  end
166
166
  end
@@ -104,7 +104,7 @@ module Punchblock
104
104
 
105
105
  before do
106
106
  command.component_id = 'abc123'
107
- command.call_id = '123abc'
107
+ command.target_call_id = '123abc'
108
108
  command.client = mock_client
109
109
  end
110
110
 
@@ -113,7 +113,7 @@ module Punchblock
113
113
 
114
114
  its(:to_xml) { should be == '<pause xmlns="urn:xmpp:rayo:output:1"/>' }
115
115
  its(:component_id) { should be == 'abc123' }
116
- its(:call_id) { should be == '123abc' }
116
+ its(:target_call_id) { should be == '123abc' }
117
117
  end
118
118
 
119
119
  describe '#pause!' do
@@ -124,7 +124,7 @@ module Punchblock
124
124
  end
125
125
 
126
126
  it "should send its command properly" do
127
- mock_client.expects(:execute_command).with(command.pause_action, :call_id => '123abc', :component_id => 'abc123').returns true
127
+ mock_client.expects(:execute_command).with(command.pause_action, :target_call_id => '123abc', :component_id => 'abc123').returns true
128
128
  command.expects :paused!
129
129
  command.pause!
130
130
  end
@@ -156,7 +156,7 @@ module Punchblock
156
156
 
157
157
  its(:to_xml) { should be == '<resume xmlns="urn:xmpp:rayo:output:1"/>' }
158
158
  its(:component_id) { should be == 'abc123' }
159
- its(:call_id) { should be == '123abc' }
159
+ its(:target_call_id) { should be == '123abc' }
160
160
  end
161
161
 
162
162
  describe '#resume!' do
@@ -168,7 +168,7 @@ module Punchblock
168
168
  end
169
169
 
170
170
  it "should send its command properly" do
171
- mock_client.expects(:execute_command).with(command.resume_action, :call_id => '123abc', :component_id => 'abc123').returns true
171
+ mock_client.expects(:execute_command).with(command.resume_action, :target_call_id => '123abc', :component_id => 'abc123').returns true
172
172
  command.expects :resumed!
173
173
  command.resume!
174
174
  end
@@ -201,7 +201,7 @@ module Punchblock
201
201
 
202
202
  its(:to_xml) { should be == '<stop xmlns="urn:xmpp:rayo:1"/>' }
203
203
  its(:component_id) { should be == 'abc123' }
204
- its(:call_id) { should be == '123abc' }
204
+ its(:target_call_id) { should be == '123abc' }
205
205
  end
206
206
 
207
207
  describe '#stop!' do
@@ -212,7 +212,7 @@ module Punchblock
212
212
  end
213
213
 
214
214
  it "should send its command properly" do
215
- mock_client.expects(:execute_command).with(command.stop_action, :call_id => '123abc', :component_id => 'abc123')
215
+ mock_client.expects(:execute_command).with(command.stop_action, :target_call_id => '123abc', :component_id => 'abc123')
216
216
  command.stop!
217
217
  end
218
218
  end
@@ -232,7 +232,7 @@ module Punchblock
232
232
 
233
233
  its(:to_xml) { should be == '<seek xmlns="urn:xmpp:rayo:output:1" direction="forward" amount="1500"/>' }
234
234
  its(:component_id) { should be == 'abc123' }
235
- its(:call_id) { should be == '123abc' }
235
+ its(:target_call_id) { should be == '123abc' }
236
236
  end
237
237
 
238
238
  describe '#seek!' do
@@ -245,7 +245,7 @@ module Punchblock
245
245
  it "should send its command properly" do
246
246
  seek_action = command.seek_action seek_options
247
247
  command.stubs(:seek_action).returns seek_action
248
- mock_client.expects(:execute_command).with(seek_action, :call_id => '123abc', :component_id => 'abc123').returns true
248
+ mock_client.expects(:execute_command).with(seek_action, :target_call_id => '123abc', :component_id => 'abc123').returns true
249
249
  command.expects :seeking!
250
250
  command.expects :stopped_seeking!
251
251
  command.seek! seek_options
@@ -299,7 +299,7 @@ module Punchblock
299
299
 
300
300
  its(:to_xml) { should be == '<speed-up xmlns="urn:xmpp:rayo:output:1"/>' }
301
301
  its(:component_id) { should be == 'abc123' }
302
- its(:call_id) { should be == '123abc' }
302
+ its(:target_call_id) { should be == '123abc' }
303
303
  end
304
304
 
305
305
  describe '#speed_up!' do
@@ -312,7 +312,7 @@ module Punchblock
312
312
  it "should send its command properly" do
313
313
  speed_up_action = command.speed_up_action
314
314
  command.stubs(:speed_up_action).returns speed_up_action
315
- mock_client.expects(:execute_command).with(speed_up_action, :call_id => '123abc', :component_id => 'abc123').returns true
315
+ mock_client.expects(:execute_command).with(speed_up_action, :target_call_id => '123abc', :component_id => 'abc123').returns true
316
316
  command.expects :speeding_up!
317
317
  command.expects :stopped_speeding!
318
318
  command.speed_up!
@@ -357,7 +357,7 @@ module Punchblock
357
357
 
358
358
  its(:to_xml) { should be == '<speed-down xmlns="urn:xmpp:rayo:output:1"/>' }
359
359
  its(:component_id) { should be == 'abc123' }
360
- its(:call_id) { should be == '123abc' }
360
+ its(:target_call_id) { should be == '123abc' }
361
361
  end
362
362
 
363
363
  describe '#slow_down!' do
@@ -370,7 +370,7 @@ module Punchblock
370
370
  it "should send its command properly" do
371
371
  slow_down_action = command.slow_down_action
372
372
  command.stubs(:slow_down_action).returns slow_down_action
373
- mock_client.expects(:execute_command).with(slow_down_action, :call_id => '123abc', :component_id => 'abc123').returns true
373
+ mock_client.expects(:execute_command).with(slow_down_action, :target_call_id => '123abc', :component_id => 'abc123').returns true
374
374
  command.expects :slowing_down!
375
375
  command.expects :stopped_speeding!
376
376
  command.slow_down!
@@ -432,7 +432,7 @@ module Punchblock
432
432
 
433
433
  its(:to_xml) { should be == '<volume-up xmlns="urn:xmpp:rayo:output:1"/>' }
434
434
  its(:component_id) { should be == 'abc123' }
435
- its(:call_id) { should be == '123abc' }
435
+ its(:target_call_id) { should be == '123abc' }
436
436
  end
437
437
 
438
438
  describe '#volume_up!' do
@@ -445,7 +445,7 @@ module Punchblock
445
445
  it "should send its command properly" do
446
446
  volume_up_action = command.volume_up_action
447
447
  command.stubs(:volume_up_action).returns volume_up_action
448
- mock_client.expects(:execute_command).with(volume_up_action, :call_id => '123abc', :component_id => 'abc123').returns true
448
+ mock_client.expects(:execute_command).with(volume_up_action, :target_call_id => '123abc', :component_id => 'abc123').returns true
449
449
  command.expects :voluming_up!
450
450
  command.expects :stopped_voluming!
451
451
  command.volume_up!
@@ -490,7 +490,7 @@ module Punchblock
490
490
 
491
491
  its(:to_xml) { should be == '<volume-down xmlns="urn:xmpp:rayo:output:1"/>' }
492
492
  its(:component_id) { should be == 'abc123' }
493
- its(:call_id) { should be == '123abc' }
493
+ its(:target_call_id) { should be == '123abc' }
494
494
  end
495
495
 
496
496
  describe '#volume_down!' do
@@ -503,7 +503,7 @@ module Punchblock
503
503
  it "should send its command properly" do
504
504
  volume_down_action = command.volume_down_action
505
505
  command.stubs(:volume_down_action).returns volume_down_action
506
- mock_client.expects(:execute_command).with(volume_down_action, :call_id => '123abc', :component_id => 'abc123').returns true
506
+ mock_client.expects(:execute_command).with(volume_down_action, :target_call_id => '123abc', :component_id => 'abc123').returns true
507
507
  command.expects :voluming_down!
508
508
  command.expects :stopped_voluming!
509
509
  command.volume_down!
@@ -62,7 +62,7 @@ module Punchblock
62
62
 
63
63
  before do
64
64
  command.component_id = 'abc123'
65
- command.call_id = '123abc'
65
+ command.target_call_id = '123abc'
66
66
  command.client = mock_client
67
67
  end
68
68
 
@@ -71,7 +71,7 @@ module Punchblock
71
71
 
72
72
  its(:to_xml) { should be == '<pause xmlns="urn:xmpp:rayo:record:1"/>' }
73
73
  its(:component_id) { should be == 'abc123' }
74
- its(:call_id) { should be == '123abc' }
74
+ its(:target_call_id) { should be == '123abc' }
75
75
  end
76
76
 
77
77
  describe '#pause!' do
@@ -82,7 +82,7 @@ module Punchblock
82
82
  end
83
83
 
84
84
  it "should send its command properly" do
85
- mock_client.expects(:execute_command).with(command.pause_action, :call_id => '123abc', :component_id => 'abc123').returns true
85
+ mock_client.expects(:execute_command).with(command.pause_action, :target_call_id => '123abc', :component_id => 'abc123').returns true
86
86
  command.expects :paused!
87
87
  command.pause!
88
88
  end
@@ -114,7 +114,7 @@ module Punchblock
114
114
 
115
115
  its(:to_xml) { should be == '<resume xmlns="urn:xmpp:rayo:record:1"/>' }
116
116
  its(:component_id) { should be == 'abc123' }
117
- its(:call_id) { should be == '123abc' }
117
+ its(:target_call_id) { should be == '123abc' }
118
118
  end
119
119
 
120
120
  describe '#resume!' do
@@ -126,7 +126,7 @@ module Punchblock
126
126
  end
127
127
 
128
128
  it "should send its command properly" do
129
- mock_client.expects(:execute_command).with(command.resume_action, :call_id => '123abc', :component_id => 'abc123').returns true
129
+ mock_client.expects(:execute_command).with(command.resume_action, :target_call_id => '123abc', :component_id => 'abc123').returns true
130
130
  command.expects :resumed!
131
131
  command.resume!
132
132
  end
@@ -159,7 +159,7 @@ module Punchblock
159
159
 
160
160
  its(:to_xml) { should be == '<stop xmlns="urn:xmpp:rayo:1"/>' }
161
161
  its(:component_id) { should be == 'abc123' }
162
- its(:call_id) { should be == '123abc' }
162
+ its(:target_call_id) { should be == '123abc' }
163
163
  end
164
164
 
165
165
  describe '#stop!' do
@@ -170,7 +170,7 @@ module Punchblock
170
170
  end
171
171
 
172
172
  it "should send its command properly" do
173
- mock_client.expects(:execute_command).with(command.stop_action, :call_id => '123abc', :component_id => 'abc123')
173
+ mock_client.expects(:execute_command).with(command.stop_action, :target_call_id => '123abc', :component_id => 'abc123')
174
174
  command.stop!
175
175
  end
176
176
  end
@@ -72,7 +72,7 @@ module Punchblock
72
72
  describe 'when a rayo event is received from the translator' do
73
73
  it 'should call the event handler with the event' do
74
74
  offer = Event::Offer.new
75
- offer.call_id = '9f00061'
75
+ offer.target_call_id = '9f00061'
76
76
 
77
77
  mock_event_handler.expects(:call).once.with offer
78
78
  subject.handle_event offer
@@ -21,40 +21,40 @@ module Punchblock
21
21
  let(:options) { { :username => '1@app.rayo.net' } }
22
22
 
23
23
  its(:root_domain) { should be == 'app.rayo.net' }
24
- its(:calls_domain) { should be == 'calls.app.rayo.net' }
25
- its(:mixers_domain) { should be == 'mixers.app.rayo.net' }
24
+ its(:calls_domain) { should be == 'calls.app.rayo.net' }
25
+ its(:mixers_domain) { should be == 'mixers.app.rayo.net' }
26
26
  end
27
27
 
28
28
  context "with only a rayo domain set" do
29
29
  let(:options) { { :rayo_domain => 'rayo.org' } }
30
30
 
31
31
  its(:root_domain) { should be == 'rayo.org' }
32
- its(:calls_domain) { should be == 'calls.rayo.org' }
33
- its(:mixers_domain) { should be == 'mixers.rayo.org' }
32
+ its(:calls_domain) { should be == 'calls.rayo.org' }
33
+ its(:mixers_domain) { should be == 'mixers.rayo.org' }
34
34
  end
35
35
 
36
36
  context "with only a root domain set" do
37
37
  let(:options) { { :root_domain => 'rayo.org' } }
38
38
 
39
39
  its(:root_domain) { should be == 'rayo.org' }
40
- its(:calls_domain) { should be == 'calls.rayo.org' }
41
- its(:mixers_domain) { should be == 'mixers.rayo.org' }
40
+ its(:calls_domain) { should be == 'calls.rayo.org' }
41
+ its(:mixers_domain) { should be == 'mixers.rayo.org' }
42
42
  end
43
43
 
44
44
  context "with a root domain and calls domain set" do
45
45
  let(:options) { { :root_domain => 'rayo.org', :calls_domain => 'phone_calls.rayo.org' } }
46
46
 
47
47
  its(:root_domain) { should be == 'rayo.org' }
48
- its(:calls_domain) { should be == 'phone_calls.rayo.org' }
49
- its(:mixers_domain) { should be == 'mixers.rayo.org' }
48
+ its(:calls_domain) { should be == 'phone_calls.rayo.org' }
49
+ its(:mixers_domain) { should be == 'mixers.rayo.org' }
50
50
  end
51
51
 
52
52
  context "with a root domain and mixers domain set" do
53
53
  let(:options) { { :root_domain => 'rayo.org', :mixers_domain => 'conferences.rayo.org' } }
54
54
 
55
55
  its(:root_domain) { should be == 'rayo.org' }
56
- its(:calls_domain) { should be == 'calls.rayo.org' }
57
- its(:mixers_domain) { should be == 'conferences.rayo.org' }
56
+ its(:calls_domain) { should be == 'calls.rayo.org' }
57
+ its(:mixers_domain) { should be == 'conferences.rayo.org' }
58
58
  end
59
59
  end
60
60
 
@@ -182,7 +182,7 @@ module Punchblock
182
182
  it 'should call the event handler with the event' do
183
183
  mock_event_handler.expects(:call).once.with do |event|
184
184
  event.should be_instance_of Event::Offer
185
- event.call_id.should be == '9f00061'
185
+ event.target_call_id.should be == '9f00061'
186
186
  event.domain.should be == 'call.rayo.net'
187
187
  end
188
188
  handle_presence
@@ -259,7 +259,7 @@ module Punchblock
259
259
  end
260
260
 
261
261
  context "with a call command" do
262
- let(:command) { Command::Answer.new.tap { |a| a.call_id = 'abc123' } }
262
+ let(:command) { Command::Answer.new.tap { |a| a.target_call_id = 'abc123' } }
263
263
  let(:expected_jid) { 'abc123@calls.rayo.net' }
264
264
 
265
265
  it "should use the correct JID" do
@@ -268,7 +268,7 @@ module Punchblock
268
268
  end
269
269
 
270
270
  context "with a call component" do
271
- let(:command) { Component::Output.new :call_id => 'abc123' }
271
+ let(:command) { Component::Output.new :target_call_id => 'abc123' }
272
272
  let(:expected_jid) { 'abc123@calls.rayo.net' }
273
273
 
274
274
  it "should use the correct JID" do
@@ -277,7 +277,7 @@ module Punchblock
277
277
  end
278
278
 
279
279
  context "with a call component command" do
280
- let(:command) { Component::Stop.new :call_id => 'abc123', :component_id => 'foobar' }
280
+ let(:command) { Component::Stop.new :target_call_id => 'abc123', :component_id => 'foobar' }
281
281
  let(:expected_jid) { 'abc123@calls.rayo.net/foobar' }
282
282
 
283
283
  it "should use the correct JID" do
@@ -286,7 +286,7 @@ module Punchblock
286
286
  end
287
287
 
288
288
  context "with a mixer component" do
289
- let(:command) { Component::Output.new :mixer_name => 'abc123' }
289
+ let(:command) { Component::Output.new :target_mixer_name => 'abc123' }
290
290
  let(:expected_jid) { 'abc123@mixers.rayo.net' }
291
291
 
292
292
  it "should use the correct JID" do
@@ -295,7 +295,7 @@ module Punchblock
295
295
  end
296
296
 
297
297
  context "with a mixer component command" do
298
- let(:command) { Component::Stop.new :mixer_name => 'abc123', :component_id => 'foobar' }
298
+ let(:command) { Component::Stop.new :target_mixer_name => 'abc123', :component_id => 'foobar' }
299
299
  let(:expected_jid) { 'abc123@mixers.rayo.net/foobar' }
300
300
 
301
301
  it "should use the correct JID" do
@@ -303,6 +303,35 @@ module Punchblock
303
303
  end
304
304
  end
305
305
  end
306
+
307
+ describe "receiving events from a mixer" do
308
+ context "after joining the mixer" do
309
+ before do
310
+ subject.send(:client).expects :write_with_handler
311
+ subject.write Command::Join.new(:mixer_name => 'foomixer')
312
+ end
313
+
314
+ let :active_speaker_xml do
315
+ <<-MSG
316
+ <presence to='16577@app.rayo.net/1' from='foomixer@mixers.rayo.net'>
317
+ <started-speaking xmlns="urn:xmpp:rayo:1" call-id="foocall"/>
318
+ </presence>
319
+ MSG
320
+ end
321
+
322
+ let(:active_speaker_event) { import_stanza active_speaker_xml }
323
+
324
+ it "should tag those events with a mixer name, rather than a call ID" do
325
+ mock_event_handler.expects(:call).once.with do |event|
326
+ event.should be_instance_of Event::StartedSpeaking
327
+ event.target_mixer_name.should be == 'foomixer'
328
+ event.target_call_id.should be nil
329
+ event.domain.should be == 'mixers.rayo.net'
330
+ end
331
+ connection.__send__ :handle_presence, active_speaker_event
332
+ end
333
+ end
334
+ end
306
335
  end # describe XMPP
307
336
  end # XMPP
308
337
  end # Punchblock