spec/punchblock/translator/asterisk/call_spec.rb in punchblock-2.1.0 vs spec/punchblock/translator/asterisk/call_spec.rb in punchblock-2.1.1
- old
+ new
@@ -180,12 +180,13 @@
it 'sends an Originate AMI action' do
expected_action = Punchblock::Component::Asterisk::AMI::Action.new(:name => 'Originate',
:params => {
:async => true,
- :application => 'AGI',
- :data => 'agi:async',
+ :context => REDIRECT_CONTEXT,
+ :exten => REDIRECT_EXTENSION,
+ :priority => REDIRECT_PRIORITY,
:channel => 'SIP/1234',
:callerid => 'sip:foo@bar.com',
:variable => "punchblock_call_id=#{subject.id}"
}).tap { |a| a.request! }
@@ -198,12 +199,13 @@
it 'sends an Originate AMI action with only the channel' do
expected_action = Punchblock::Component::Asterisk::AMI::Action.new(:name => 'Originate',
:params => {
:async => true,
- :application => 'AGI',
- :data => 'agi:async',
+ :context => REDIRECT_CONTEXT,
+ :exten => REDIRECT_EXTENSION,
+ :priority => REDIRECT_PRIORITY,
:channel => 'SIP/5678',
:callerid => 'sip:foo@bar.com',
:variable => "punchblock_call_id=#{subject.id}"
}).tap { |a| a.request! }
@@ -219,12 +221,13 @@
it 'includes the timeout in the Originate AMI action' do
expected_action = Punchblock::Component::Asterisk::AMI::Action.new(:name => 'Originate',
:params => {
:async => true,
- :application => 'AGI',
- :data => 'agi:async',
+ :context => REDIRECT_CONTEXT,
+ :exten => REDIRECT_EXTENSION,
+ :priority => REDIRECT_PRIORITY,
:channel => 'SIP/1234',
:callerid => 'sip:foo@bar.com',
:variable => "punchblock_call_id=#{subject.id}",
:timeout => 10000
}).tap { |a| a.request! }
@@ -241,12 +244,13 @@
it 'includes the headers in the Originate AMI action' do
expected_action = Punchblock::Component::Asterisk::AMI::Action.new(:name => 'Originate',
:params => {
:async => true,
- :application => 'AGI',
- :data => 'agi:async',
+ :context => REDIRECT_CONTEXT,
+ :exten => REDIRECT_EXTENSION,
+ :priority => REDIRECT_PRIORITY,
:channel => 'SIP/1234',
:callerid => 'sip:foo@bar.com',
:variable => "punchblock_call_id=#{subject.id},SIPADDHEADER51=\"X-foo: bar\",SIPADDHEADER52=\"X-doo: dah\""
}).tap { |a| a.request! }
@@ -1036,10 +1040,10 @@
end
before { translator.should_receive(:call_with_id).with(other_call_id).and_return(other_call) }
it "executes the proper dialplan Bridge application" do
- subject.wrapped_object.should_receive(:execute_agi_command).with('EXEC Bridge', other_channel).and_return code: 200
+ subject.wrapped_object.should_receive(:execute_agi_command).with('EXEC Bridge', "#{other_channel},F(#{REDIRECT_CONTEXT},#{REDIRECT_EXTENSION},#{REDIRECT_PRIORITY})").and_return code: 200
subject.execute_command command
end
context "when the AMI command raises an error" do
let(:message) { 'Some error' }