Skip to content
Open
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
2 changes: 1 addition & 1 deletion lib/adhearsion/translator/asterisk/call.rb
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def execute_command(command)
end

#
# @return [Hash] AGI result
# @return [Hash, nil] AGI result, or nil if it is detected that the call is hung up.
#
# @raises RubyAMI::Error, ChannelGoneError
def execute_agi_command(command, *params)
Expand Down
19 changes: 19 additions & 0 deletions spec/adhearsion/translator/asterisk/call_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2064,6 +2064,25 @@ def grxml_doc(mode = :dtmf)
expect(fut.value).to eq({code: 200, result: 123, data: 'timeout'})
end
end

context 'of type Hangup' do
let :ami_event do
RubyAMI::Event.new 'Hangup',
'Uniqueid' => "1320842458.8",
'Calleridnum' => "5678",
'Calleridname' => "Jane Smith",
'Cause' => '16',
'Cause-txt' => 'Normal Clearing',
'Channel' => "SIP/1234-00000000"
end

it 'should return nil' do
fut = Celluloid::Future.new { subject.execute_agi_command 'EXEC ANSWER' }
sleep 0.25
subject.process_ami_event ami_event
expect(fut.value).to be_nil
end
end
end

describe 'when receiving an Asterisk 13 AsyncAGIExec event' do
Expand Down