/**********************************************
  1. Create a call and put it on hold
  2. Create 2nd call
  3. Trigger incoming call, goes to Queued
  4. Hangup 2nd call
  5. Answer Queued call
  6. Disconnect calls
**********************************************/

[StifSettings]
CheckHeapBalance= on
[EndStifSettings]

[Test]
title 8.3.1 Three calls, Connected, Hold & Queued
timeout 15000
create ccetester test
test Delay 1000

// Step 1
print Step_1

test OpenNewCall 1 0 Recipient@172.23.123.29 2 ECCECallTypePS ECCELineTypePrimary
test Dial 1 0 SubAddress Bearer
test WaitEvent 1 Dialling
test WaitEvent 1 Connecting
test WaitEvent 1 Connected

test Hold 1 0
test WaitEvents 1 Hold, 1 LocalHold

// Step 2
print Step_2

test OpenNewCall 2 0 RecipientTwo 2 ECCECallTypePS ECCELineTypePrimary
test Dial 2 0 SubAddress Bearer
test WaitEvent 2 Dialling
test WaitEvent 2 Connecting
test WaitEvent 2 Connected

// Step 3
print Step_3

// Trigger ICM
test InitIncomingCall
// Wait plugin to initialize
test Delay 1000

// Send plugin command, MT call with CallID 3 is created
// call goes to Queued state
test SendPluginRequest CreateCall 2
test WaitEvent 0 IncomingCall
test WaitEvent 3 Queued

// Step 4
print Step_4

test HangUp 2 0
test WaitEvent 2 Disconnecting
test WaitEvent 2 Idle
test Release 2 0

// Step 5
print Step_5

test Answer 3 0
test WaitEvent 3 Answering
test WaitEvent 3 Connected

// Step 6
print Step_6

test HangUp 1 0
test WaitEvent 1 Disconnecting
test WaitEvent 1 Idle
test Release 1 0

test HangUp 3 0
test WaitEvent 3 Disconnecting
test WaitEvent 3 Idle
test Release 3 0

test VerifyTest
delete test
[Endtest]
