Skip to content

Commit

Permalink
Piston updated connfu.
Browse files Browse the repository at this point in the history
The latest version makes it more explicit that a Stop command is sent to a Component Id.
  • Loading branch information
chrisroos committed Aug 26, 2011
1 parent 3a38b4c commit 39229e5
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion lib/incoming_call.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def stop_hold_music
send_command Connfu::Commands::Stop.new(
:call_jid => call_jid,
:client_jid => client_jid,
:ref_id => @hold_music_component_id
:component_id => @hold_music_component_id
)
end

Expand Down
4 changes: 2 additions & 2 deletions spec/models/incoming_call_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@
last_command.should == Connfu::Commands::Stop.new(
:call_jid => @call_jid,
:client_jid => @client_jid,
:ref_id => "hold-music-component-id"
:component_id => "hold-music-component-id"
)
end

Expand Down Expand Up @@ -507,7 +507,7 @@
last_command.should == Connfu::Commands::Stop.new(
:call_jid => @call_jid,
:client_jid => @client_jid,
:ref_id => "hold-music-component-id"
:component_id => "hold-music-component-id"
)
end

Expand Down
2 changes: 1 addition & 1 deletion vendor/gems/connfu/.piston.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ lock: false
repository_class: Piston::Git::Repository
format: 1
handler:
commit: 2e9ee2b457f11f8b2e8dad6fb7af00f5d437dcdf
commit: 05a15b2d7445b0c95fccbae0b72271a71ba87c2d
branch: master
4 changes: 2 additions & 2 deletions vendor/gems/connfu/examples/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
}
}
CONNFU_CONFIG['amazon'] = CONNFU_CONFIG['default'].merge(:connfu_uri => 'jid://usera:1@46.137.85.52')
CONNFU_CONFIG['odin'] = CONNFU_CONFIG['default'].merge(:connfu_uri => 'jid://usera:1@173.255.241.49')
CONNFU_CONFIG['thor'] = CONNFU_CONFIG['default'].merge(:connfu_uri => 'jid://usera:1@173.255.243.5')
CONNFU_CONFIG['odin'] = CONNFU_CONFIG['default'].merge(:connfu_uri => 'jid://usera:1@odin.openvoice2.com')
CONNFU_CONFIG['thor'] = CONNFU_CONFIG['default'].merge(:connfu_uri => 'jid://usera:1@thor.openvoice2.com')

CONNFU_ENV = ENV['CONNFU_ENV'] || 'default'

Expand Down
2 changes: 1 addition & 1 deletion vendor/gems/connfu/lib/connfu/commands/stop_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Connfu
module Commands
module StopComponent
def component_id
@params[:ref_id]
@params[:component_id]
end

def component_jid
Expand Down
4 changes: 2 additions & 2 deletions vendor/gems/connfu/lib/connfu/dsl/recording.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def record_for(max_length, options = {})
end

def stop_recording
send_command Connfu::Commands::Recording::Stop.new(:call_jid => call_jid, :client_jid => client_jid, :ref_id => @ref_id)
send_command Connfu::Commands::Recording::Stop.new(:call_jid => call_jid, :client_jid => client_jid, :component_id => @component_id)
event = wait_for(Connfu::Event::RecordingStopComplete)
recordings << event.uri
end
Expand All @@ -30,7 +30,7 @@ def send_start_recording(options = {})
command_options[:format] = options[:format] if options.has_key?(:format)
command_options[:codec] = options[:codec] if options.has_key?(:codec)
result = send_command Connfu::Commands::Recording::Start.new(command_options)
@ref_id = result.ref_id
@component_id = result.ref_id
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion vendor/gems/connfu/script/build
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ rvm use 1.9.2

echo `bundle config`

echo "Running build script as `whoami`" && mkdir -p .build && bundle install --path .build/gems && PRISM_JID=jid://usera:1@173.255.243.5 bundle exec rake --trace | tee .build/output
echo "Running build script as `whoami`" && mkdir -p .build && bundle install --path .build/gems && PRISM_JID=jid://usera:1@thor.openvoice2.com bundle exec rake --trace | tee .build/output

exit $pipestatus[1]
4 changes: 2 additions & 2 deletions vendor/gems/connfu/spec/connfu/commands/recording_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@

describe "generating XMPP iq for a Stop command" do
subject do
Connfu::Commands::Recording::Stop.new(:call_jid => 'call-jid', :client_jid => 'client-jid', :ref_id => 'abc123').to_iq
Connfu::Commands::Recording::Stop.new(:call_jid => 'call-jid', :client_jid => 'client-jid', :component_id => 'abc123').to_iq
end

it "should generate a stop record iq" do
Expand All @@ -168,7 +168,7 @@
subject.type.should eq :set
end

it "should contain the 'to' address with the ref_id in the iq" do
it "should contain the 'to' address with the component_id in the iq" do
subject.xpath("/iq").first.attributes["to"].value.should eq "call-jid/abc123"
end

Expand Down
4 changes: 2 additions & 2 deletions vendor/gems/connfu/spec/connfu/commands/stop_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

describe "generating XMPP iq for a Stop command" do
subject do
Connfu::Commands::Stop.new(:call_jid => 'call-jid', :client_jid => 'client-jid', :ref_id => 'abc123').to_iq
Connfu::Commands::Stop.new(:call_jid => 'call-jid', :client_jid => 'client-jid', :component_id => 'abc123').to_iq
end

it "should generate a stop iq" do
Expand All @@ -15,7 +15,7 @@
subject.type.should eq :set
end

it "should contain the 'to' address with the ref_id in the iq" do
it "should contain the 'to' address with the component_id in the iq" do
subject.xpath("/iq").first.attributes["to"].value.should eq "call-jid/abc123"
end

Expand Down
4 changes: 2 additions & 2 deletions vendor/gems/connfu/spec/connfu/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ class DslTest

it 'should send a stop command to connection' do
subject.stub(:wait_for).and_return(Connfu::Event::RecordingStopComplete.new)
subject.instance_eval { @ref_id = 'foo' }
Connfu.connection.should_receive(:send_command).with(Connfu::Commands::Recording::Stop.new(:client_jid => 'client-jid', :call_jid => 'call-jid', :ref_id => 'foo'))
subject.instance_eval { @component_id = 'foo' }
Connfu.connection.should_receive(:send_command).with(Connfu::Commands::Recording::Stop.new(:client_jid => 'client-jid', :call_jid => 'call-jid', :component_id => 'foo'))
subject.stop_recording
end
end
Expand Down
18 changes: 9 additions & 9 deletions vendor/gems/connfu/spec/functional/record_call_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
before :each do
@call_jid = "call-id@server.whatever"
@client_jid = "usera@127.0.0.whatever/voxeo"
@recording_ref_id = "abc123"
@component_jid = "#{@call_jid}/#{@recording_ref_id}"
@recording_component_id = "abc123"
@component_jid = "#{@call_jid}/#{@recording_component_id}"
@recording_path = "file:///tmp/recording.mp3"
end

Expand All @@ -29,16 +29,16 @@

it "should send the stop recording command with the recording ID when start recording has been sent" do
incoming :offer_presence, @call_jid, @client_jid
incoming :recording_result_iq, @call_jid, @recording_ref_id
incoming :recording_result_iq, @call_jid, @recording_component_id

last_command.should == Connfu::Commands::Recording::Stop.new(:call_jid => @call_jid, :client_jid => @client_jid, :ref_id => @recording_ref_id)
last_command.should == Connfu::Commands::Recording::Stop.new(:call_jid => @call_jid, :client_jid => @client_jid, :component_id => @recording_component_id)
end

it "should be able to access the recording URI once the recording is complete" do
dsl_instance.should_receive(:do_something).with([@recording_path])

incoming :offer_presence, @call_jid, @client_jid
incoming :recording_result_iq, @call_jid, @recording_ref_id
incoming :recording_result_iq, @call_jid, @recording_component_id
incoming :result_iq, @call_jid
incoming :recording_stop_presence, @component_jid, @recording_path
end
Expand All @@ -47,7 +47,7 @@
dsl_instance.stub(:do_something)

incoming :offer_presence, @call_jid, @client_jid
incoming :recording_result_iq, @call_jid, @recording_ref_id
incoming :recording_result_iq, @call_jid, @recording_component_id
incoming :result_iq, @call_jid
incoming :recording_stop_presence, @component_jid, @recording_path

Expand All @@ -65,7 +65,7 @@

it "should not send any commands after the hangup is detected" do
incoming :offer_presence, @call_jid, @client_jid
incoming :recording_result_iq, @call_jid, @recording_ref_id
incoming :recording_result_iq, @call_jid, @recording_component_id
incoming :recording_hangup_presence, @component_jid

last_command.should_not be_instance_of(Connfu::Commands::Say)
Expand All @@ -86,7 +86,7 @@
dsl_instance.should_receive(:do_something).with([@recording_path])

incoming :offer_presence, @call_jid, @client_jid
incoming :recording_result_iq, @call_jid, @recording_ref_id
incoming :recording_result_iq, @call_jid, @recording_component_id
incoming :recording_stop_presence, @component_jid, @recording_path
end
end
Expand All @@ -96,7 +96,7 @@
dsl_instance.should_receive(:do_something).with([@recording_path])

incoming :offer_presence, @call_jid, @client_jid
incoming :recording_result_iq, @call_jid, @recording_ref_id
incoming :recording_result_iq, @call_jid, @recording_component_id
incoming :recording_hangup_presence, @component_jid, @recording_path
end
end
Expand Down
4 changes: 2 additions & 2 deletions vendor/gems/connfu/spec/functional/say_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
answer
send_command Connfu::Commands::Say.new(:text => 'hello world', :call_jid => 'call-jid', :client_jid => 'client-jid')
dial :to => "anyone", :from => "anyone else"
send_command Connfu::Commands::Stop.new(:ref_id => 'component-id', :call_jid => 'call-jid', :client_jid => 'client-jid')
send_command Connfu::Commands::Stop.new(:component_id => 'component-id', :call_jid => 'call-jid', :client_jid => 'client-jid')
end
end

let(:stop_command) { Connfu::Commands::Stop.new(:ref_id => 'component-id', :call_jid => 'call-jid', :client_jid => 'client-jid') }
let(:stop_command) { Connfu::Commands::Stop.new(:component_id => 'component-id', :call_jid => 'call-jid', :client_jid => 'client-jid') }
let(:call_jid) { "call-id@#{PRISM_HOST}" }

it 'should send the stop command to an active say component' do
Expand Down

0 comments on commit 39229e5

Please sign in to comment.