/***************************************************
   1. Create MT CS call
   2. Trigger ICM to load PS plugin
   3. Create 2nd (MT PS) call (Queued)
   4. Answer call
      Expected: Call [1] is automatically put on Hold
   5. Hang up 2nd call
   6. Hang up 1st call
/***************************************************/

[StifSettings]
CheckHeapBalance= on
[EndStifSettings]

[Test]
title 8.1.8 Two calls, MT/CS and MT/PS
timeout 10000
create ccetester test
test Delay 1000

// Step 1
print Step_1

// Plugin 1 = PS plugin (default if not given)
// Plugin 2 = CS plugin

test SendPluginRequest 2 CreateCall 1
test WaitEvent 0 IncomingCall
test WaitEvent 1 Ringing
// Answer call
test Answer 1 0
test WaitEvent 1 Answering
test WaitEvent 1 Connected

// Step 2
print Step_2

test InitIncomingCall
//Wait plugin to initialize:
test Delay 1000

// Step 3
print Step_3

test SendPluginRequest CreateCall 2
test WaitEvent 0 IncomingCall
test WaitEvent 2 Queued

// Step 4
print Step_4

test Answer 2 0

// Autohold
test WaitEvents 1 Hold, 2 Answering, 2 Connected, 1 LocalHold

// Step 5
print Step_5

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

// Step 6
print Step_6

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

test VerifyTest
delete test
[Endtest]
