spec/punchblock/translator/freeswitch/call_spec.rb in punchblock-1.5.3 vs spec/punchblock/translator/freeswitch/call_spec.rb in punchblock-1.6.0

- old
+ new

@@ -288,9 +288,20 @@ stream.expects(:bgapi).once.with "originate {return_ring_ready=true,origination_uuid=#{subject.id},origination_caller_id_number='#{from}',originate_timeout=10}#{to} &park()" subject.dial dial_command end end + context 'with headers specified' do + let :dial_command_options do + { :headers => {'X-foo' => 'bar', 'X-doo' => 'dah'} } + end + + it 'includes the headers in the originate command' do + stream.expects(:bgapi).once.with "originate {return_ring_ready=true,origination_uuid=#{subject.id},origination_caller_id_number='#{from}',sip_h_X-foo='bar',sip_h_X-doo='dah'}#{to} &park()" + subject.dial dial_command + end + end + it 'sends the call ID as a response to the Dial' do subject.dial dial_command dial_command.response dial_command.target_call_id.should be == subject.id end