/*******************************************************
   1. Create empty conference from plug-in
   2. Try to create new conference from plug-in
      Expected:
      - Conference already exist, no events
   3. Make a new call and put on Hold
   4. Make a second call
   5. Add calls to conference
      - Conference becomes active
      - Call is set to Connected (match conference)
   6. Make 3rd call
      - Conference is put to Hold
   7. Add 3rd call to conference
      - First the call added is put on Hold (match conference)
      - Conference becomes active
      - Calls in conference are set to Connected
   8. Remove 2nd call from conference
   9. Hang up conference
      - Calls 1 and 2 are removed from conference and disconnected
*******************************************************/

[StifSettings]
CheckHeapBalance= on
[EndStifSettings]

[Test]
title 9.13.4 PS Conference Call, add and remove calls
timeout 10000
create ccetester test
test Delay 1000

print Step_1

// Trigger ICM (to load PS plug-in)
test InitIncomingCall
test Delay 1000

test SendPluginRequest 1 CreateConferenceCall
test WaitEvent ConferenceCallCreated

print Step_2

test SendPluginRequest 1 CreateConferenceCall
test Delay 500

print Step_3

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

print Step_4

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

print Step_5

test AddToConference 1 0
test WaitEvent ConferenceCallAdded 1 // event 10
test AddToConference 2 0
test WaitEvents ConferenceCallAdded 2, ConferenceActive, 1 Connected

print Step_6

test OpenNewCall 3 0 callThree 2 ECCECallTypePS ECCELineTypePrimary
test Dial 3 0 SubAddress Bearer
test WaitEvents ConferenceHold, 1 Hold, 2 Hold, ConferenceCallSwapped, 3 Dialling, 3 Connecting, 3 Connected

print Step_7

test AddToConference 3 0
test WaitEvents ConferenceCallAdded 3, 3 Hold, ConferenceActive, ConferenceCallSwapped, 1 Connected, 2 Connected, 3 Connected

print Step_8

test RemoveFromConference 2 0
test WaitEvents ConferenceCallRemoved 2, 2 Disconnecting, 2 Idle
test Release 2 0

print Step_9

test HangupConference 0
test WaitEvents ConferenceCallRemoved 1, ConferenceCallRemoved 3, ConferenceIdle, 1 Disconnecting, 1 Idle, 3 Disconnecting, 3 Idle
test ReleaseConference 0

test VerifyTest
delete test
[Endtest]
