Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that punchblock uses .WAV extension for wav49 format #259

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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