Skip to content

Commit

Permalink
Merge pull request #259 from system123/bugfix/wav49-incorrect-extension
Browse files Browse the repository at this point in the history
Ensure that punchblock uses .WAV extension for wav49 format
  • Loading branch information
benlangfeld authored Oct 18, 2016
2 parents cb30075 + b4a5dcd commit 466192a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# [develop](https://github.com/adhearsion/punchblock)
* Bugfix: Return correct recording uri for wav49 format with Asterisk.
* Change: Remove support for FreeSWITCH translator on Inbound EventSocket
* Bugfix: Return the correct error when the call is down when stopping an output rather than crashing the translator ([#256](https://github.com/adhearsion/punchblock/pull/256))
* Bugfix: Handle more AMI error responses which mean the channel is not found
Expand Down
3 changes: 2 additions & 1 deletion lib/punchblock/translator/asterisk/component/record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ def filename
end

def recording
Punchblock::Component::Record::Recording.new :uri => "file://#{filename}.#{@format}"
ext = @format.gsub('wav49', 'WAV')
Punchblock::Component::Record::Recording.new :uri => "file://#{filename}.#{ext}"
end

def stop_reason
Expand Down
17 changes: 17 additions & 0 deletions spec/punchblock/translator/asterisk/component/record_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,23 @@ module Component
expect(recording.uri).to match(/.*\.mp3$/)
end
end

context "set to 'wav49'" do
let(:command_options) { { :format => 'wav49' } }
it "should execute as 'wav49'" do
expect(ami_client).to receive(:send_action).once.with('Monitor', hash_including('Format' => 'wav49'))
subject.execute
expect(original_command.response(0.1)).to be_a Ref
end

it "provides the correct filename in the recording" do
expect(ami_client).to receive(:send_action)
subject.execute
monitor_stop_event = RubyAMI::Event.new 'MonitorStop', 'Channel' => channel
mock_call.process_ami_event monitor_stop_event
expect(recording.uri).to match(/.*\.WAV$/)
end
end
end

describe 'start_beep' do
Expand Down

0 comments on commit 466192a

Please sign in to comment.