/**********************************************************
	1. Create conference of 2 calls
	2. Go one-to-one with call 1
	3. Swap
	4. Disconnect calls
***********************************************************/

[StifSettings]
CheckHeapBalance= on
[EndStifSettings]

[Test]
title 9.10.2 Conference Call, Go Private 2
timeout 15000
create ccetester test
test Delay 1000

// Step 1
print Step_1

test OpenNewCall 1 0 Conf_A@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

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

test AddToConference 1 0
test WaitEvent ConferenceCallAdded 1
test AddToConference 2 0
// Plugin sets call to match conference state (connected)
test WaitEvents ConferenceCallAdded 2, ConferenceActive, 1 Connected

// Step 2
print Step_2

test GoOneToOne 1 0
// Conference ends and the last call is put on Hold
test WaitEvents ConferenceCallRemoved 1, ConferenceCallRemoved 2, 2 Hold, ConferenceIdle

// Step 3
print Step_3

test Swap 1 0
test WaitEvents 1 Hold, 2 Connected, 2 LocalResume, 1 LocalHold
// Should plugin send hold/resume events with Swap?

// Step 4
print Step_4

test HangUp 1 0

// CS Swap not completed, so it is cancelled
test WaitEvent 1 ErrorOccurred -3

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

test HangUp 2 0


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

test VerifyTest
delete test
[Endtest]
