Skip to content

Commit

Permalink
Fix SayDigits compat for Asterisk dialplan app
Browse files Browse the repository at this point in the history
  • Loading branch information
bklang committed Aug 12, 2011
1 parent 3a3d0f7 commit 33e1ac9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/tropo-agitate.rb
Expand Up @@ -651,6 +651,9 @@ def say(prompt, voice = nil)
def saydigits(options={})
check_state

# Compatibility with Asterisk dialplan app
options = {:args => [options]} unless options.is_a? Hash

ssml = "<speak><say-as interpret-as='vxml:digits'>#{options[:args][0]}</say-as></speak>"
@current_call.say ssml, :voice => @tropo_voice
AGI_SUCCESS_PREFIX + "0\n"
Expand Down
7 changes: 7 additions & 0 deletions spec/tropo-agitate_spec.rb
Expand Up @@ -779,6 +779,13 @@
command.should == "200 result=0\n"
end
end

describe 'SayDigits' do
it 'should work' do
flexmock($currentCall).should_receive(:say).once.with("<speak><say-as interpret-as='vxml:digits'>12345</say-as></speak>", {:voice=>"kate"})
@tropo_agitate.execute_command('EXEC saydigits 12345').should == "200 result=0\n"
end
end
end

describe 'Tropo-specific dialplan application' do
Expand Down

0 comments on commit 33e1ac9

Please sign in to comment.