|
|
|
|
@ -115,55 +115,55 @@ public void testCreateCancelCall()
|
|
|
|
|
,CallEvent.CALL_RECEIVED, callReceivedEvent.getEventID());
|
|
|
|
|
assertNotNull("CallEvent.getSource()", callAtP2);
|
|
|
|
|
|
|
|
|
|
//verify that call participants are properly created
|
|
|
|
|
assertEquals("callAtP1.getCallParticipantsCount()"
|
|
|
|
|
//verify that call peers are properly created
|
|
|
|
|
assertEquals("callAtP1.getCallPeerCount()"
|
|
|
|
|
, 1, callAtP1.getCallPeerCount());
|
|
|
|
|
assertEquals("callAtP2.getCallParticipantsCount()"
|
|
|
|
|
assertEquals("callAtP2.getCallPeerCount()"
|
|
|
|
|
, 1, callAtP2.getCallPeerCount());
|
|
|
|
|
|
|
|
|
|
CallPeer participantAtP1
|
|
|
|
|
CallPeer peerAtP1
|
|
|
|
|
= (CallPeer)callAtP1.getCallPeers().next();
|
|
|
|
|
CallPeer participantAtP2
|
|
|
|
|
CallPeer peerAtP2
|
|
|
|
|
= (CallPeer)callAtP2.getCallPeers().next();
|
|
|
|
|
|
|
|
|
|
//now add listeners to the participants and make sure they have entered
|
|
|
|
|
//now add listeners to the peers and make sure they have entered
|
|
|
|
|
//the states they were expected to.
|
|
|
|
|
//check states for call participants at both parties
|
|
|
|
|
CallParticipantStateEventCollector stateCollectorForPp1
|
|
|
|
|
= new CallParticipantStateEventCollector(
|
|
|
|
|
participantAtP1, CallPeerState.ALERTING_REMOTE_SIDE);
|
|
|
|
|
CallParticipantStateEventCollector stateCollectorForPp2
|
|
|
|
|
= new CallParticipantStateEventCollector(
|
|
|
|
|
participantAtP2, CallPeerState.INCOMING_CALL);
|
|
|
|
|
//check states for call peers at both parties
|
|
|
|
|
CallPeerStateEventCollector stateCollectorForPp1
|
|
|
|
|
= new CallPeerStateEventCollector(
|
|
|
|
|
peerAtP1, CallPeerState.ALERTING_REMOTE_SIDE);
|
|
|
|
|
CallPeerStateEventCollector stateCollectorForPp2
|
|
|
|
|
= new CallPeerStateEventCollector(
|
|
|
|
|
peerAtP2, CallPeerState.INCOMING_CALL);
|
|
|
|
|
|
|
|
|
|
stateCollectorForPp1.waitForEvent(10000, true);
|
|
|
|
|
stateCollectorForPp2.waitForEvent(10000, true);
|
|
|
|
|
|
|
|
|
|
assertSame("participantAtP1.getCall"
|
|
|
|
|
, participantAtP1.getCall(), callAtP1);
|
|
|
|
|
assertSame("participantAtP2.getCall"
|
|
|
|
|
, participantAtP2.getCall(), callAtP2);
|
|
|
|
|
assertSame("peerAtP1.getCall"
|
|
|
|
|
, peerAtP1.getCall(), callAtP1);
|
|
|
|
|
assertSame("peerAtP2.getCall"
|
|
|
|
|
, peerAtP2.getCall(), callAtP2);
|
|
|
|
|
|
|
|
|
|
//make sure that the participants are in the proper state
|
|
|
|
|
assertEquals("The participant at provider one was not in the "
|
|
|
|
|
//make sure that the peers are in the proper state
|
|
|
|
|
assertEquals("The peer at provider one was not in the "
|
|
|
|
|
+"right state."
|
|
|
|
|
, CallPeerState.ALERTING_REMOTE_SIDE
|
|
|
|
|
, participantAtP1.getState());
|
|
|
|
|
assertEquals("The participant at provider two was not in the "
|
|
|
|
|
, peerAtP1.getState());
|
|
|
|
|
assertEquals("The peer at provider two was not in the "
|
|
|
|
|
+"right state."
|
|
|
|
|
, CallPeerState.INCOMING_CALL
|
|
|
|
|
, participantAtP2.getState());
|
|
|
|
|
, peerAtP2.getState());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//test whether caller/callee info is properly distributed in case
|
|
|
|
|
//the server is said to support it.
|
|
|
|
|
if(Boolean.getBoolean("accounts.sip.PRESERVE_PARTICIPANT_INFO"))
|
|
|
|
|
if(Boolean.getBoolean("accounts.sip.PRESERVE_PEER_INFO"))
|
|
|
|
|
{
|
|
|
|
|
//check properties on the remote call participant for the party that
|
|
|
|
|
//check properties on the remote call peer for the party that
|
|
|
|
|
//initiated the call.
|
|
|
|
|
String expectedParticipant1Address
|
|
|
|
|
String expectedPeer1Address
|
|
|
|
|
= fixture.provider2.getAccountID().getAccountAddress();
|
|
|
|
|
String expectedParticipant1DisplayName
|
|
|
|
|
String expectedPeer1DisplayName
|
|
|
|
|
= System.getProperty(
|
|
|
|
|
SipProtocolProviderServiceLick.ACCOUNT_2_PREFIX
|
|
|
|
|
+ ProtocolProviderFactory.DISPLAY_NAME);
|
|
|
|
|
@ -172,20 +172,20 @@ public void testCreateCancelCall()
|
|
|
|
|
//display name or something of the kind
|
|
|
|
|
assertTrue("Provider 2 did not advertise their "
|
|
|
|
|
+ "accountID.getAccoutAddress() address."
|
|
|
|
|
, expectedParticipant1Address.indexOf(
|
|
|
|
|
participantAtP1.getAddress()) != -1
|
|
|
|
|
|| participantAtP1.getAddress().indexOf(
|
|
|
|
|
expectedParticipant1Address) != -1);
|
|
|
|
|
, expectedPeer1Address.indexOf(
|
|
|
|
|
peerAtP1.getAddress()) != -1
|
|
|
|
|
|| peerAtP1.getAddress().indexOf(
|
|
|
|
|
expectedPeer1Address) != -1);
|
|
|
|
|
assertEquals("Provider 2 did not properly advertise their "
|
|
|
|
|
+ "display name."
|
|
|
|
|
, expectedParticipant1DisplayName
|
|
|
|
|
, participantAtP1.getDisplayName());
|
|
|
|
|
, expectedPeer1DisplayName
|
|
|
|
|
, peerAtP1.getDisplayName());
|
|
|
|
|
|
|
|
|
|
//check properties on the remote call participant for the party that
|
|
|
|
|
//check properties on the remote call peer for the party that
|
|
|
|
|
//receives the call.
|
|
|
|
|
String expectedParticipant2Address
|
|
|
|
|
String expectedPeer2Address
|
|
|
|
|
= fixture.provider1.getAccountID().getAccountAddress();
|
|
|
|
|
String expectedParticipant2DisplayName
|
|
|
|
|
String expectedPeer2DisplayName
|
|
|
|
|
= System.getProperty(
|
|
|
|
|
SipProtocolProviderServiceLick.ACCOUNT_1_PREFIX
|
|
|
|
|
+ ProtocolProviderFactory.DISPLAY_NAME);
|
|
|
|
|
@ -194,23 +194,23 @@ public void testCreateCancelCall()
|
|
|
|
|
//display name or something of the kind
|
|
|
|
|
assertTrue("Provider 1 did not advertise their "
|
|
|
|
|
+ "accountID.getAccoutAddress() address."
|
|
|
|
|
, expectedParticipant2Address.indexOf(
|
|
|
|
|
participantAtP2.getAddress()) != -1
|
|
|
|
|
|| participantAtP2.getAddress().indexOf(
|
|
|
|
|
expectedParticipant2Address) != -1);
|
|
|
|
|
, expectedPeer2Address.indexOf(
|
|
|
|
|
peerAtP2.getAddress()) != -1
|
|
|
|
|
|| peerAtP2.getAddress().indexOf(
|
|
|
|
|
expectedPeer2Address) != -1);
|
|
|
|
|
assertEquals("Provider 1 did not properly advertise their "
|
|
|
|
|
+ "display name."
|
|
|
|
|
, expectedParticipant2DisplayName
|
|
|
|
|
, participantAtP2.getDisplayName());
|
|
|
|
|
, expectedPeer2DisplayName
|
|
|
|
|
, peerAtP2.getDisplayName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//we'll now try to cancel the call
|
|
|
|
|
|
|
|
|
|
//listeners monitoring state change of the participant
|
|
|
|
|
stateCollectorForPp1 = new CallParticipantStateEventCollector(
|
|
|
|
|
participantAtP1, CallPeerState.DISCONNECTED);
|
|
|
|
|
stateCollectorForPp2 = new CallParticipantStateEventCollector(
|
|
|
|
|
participantAtP2, CallPeerState.DISCONNECTED);
|
|
|
|
|
//listeners monitoring state change of the peer
|
|
|
|
|
stateCollectorForPp1 = new CallPeerStateEventCollector(
|
|
|
|
|
peerAtP1, CallPeerState.DISCONNECTED);
|
|
|
|
|
stateCollectorForPp2 = new CallPeerStateEventCollector(
|
|
|
|
|
peerAtP2, CallPeerState.DISCONNECTED);
|
|
|
|
|
|
|
|
|
|
//listeners waiting for the op set to announce the end of the call
|
|
|
|
|
call1Listener = new CallEventCollector(basicTelephonyP1);
|
|
|
|
|
@ -223,7 +223,7 @@ public void testCreateCancelCall()
|
|
|
|
|
= new CallStateEventCollector(callAtP2, CallState.CALL_ENDED);
|
|
|
|
|
|
|
|
|
|
//Now make the caller CANCEL the call.
|
|
|
|
|
basicTelephonyP1.hangupCallPeer(participantAtP1);
|
|
|
|
|
basicTelephonyP1.hangupCallPeer(peerAtP1);
|
|
|
|
|
|
|
|
|
|
//wait for everything to happen
|
|
|
|
|
call1Listener.waitForEvent(10000);
|
|
|
|
|
@ -234,11 +234,11 @@ public void testCreateCancelCall()
|
|
|
|
|
call2StateCollector.waitForEvent(10000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//make sure that the participant is disconnected
|
|
|
|
|
assertEquals("The participant at provider one was not in the "
|
|
|
|
|
//make sure that the peer is disconnected
|
|
|
|
|
assertEquals("The peer at provider one was not in the "
|
|
|
|
|
+"right state."
|
|
|
|
|
, CallPeerState.DISCONNECTED
|
|
|
|
|
, participantAtP1.getState());
|
|
|
|
|
, peerAtP1.getState());
|
|
|
|
|
|
|
|
|
|
//make sure the telephony operation set distributed an event for the end
|
|
|
|
|
//of the call
|
|
|
|
|
@ -257,11 +257,11 @@ public void testCreateCancelCall()
|
|
|
|
|
|
|
|
|
|
//same for provider 2
|
|
|
|
|
|
|
|
|
|
//make sure that the participant is disconnected
|
|
|
|
|
assertEquals("The participant at provider one was not in the "
|
|
|
|
|
//make sure that the peer is disconnected
|
|
|
|
|
assertEquals("The peer at provider one was not in the "
|
|
|
|
|
+"right state."
|
|
|
|
|
, CallPeerState.DISCONNECTED
|
|
|
|
|
, participantAtP2.getState());
|
|
|
|
|
, peerAtP2.getState());
|
|
|
|
|
|
|
|
|
|
//make sure the telephony operation set distributed an event for the end
|
|
|
|
|
//of the call
|
|
|
|
|
@ -345,55 +345,55 @@ public void testCreateRejectCall()
|
|
|
|
|
,CallEvent.CALL_RECEIVED, callReceivedEvent.getEventID());
|
|
|
|
|
assertNotNull("CallEvent.getSource()", callAtP2);
|
|
|
|
|
|
|
|
|
|
//verify that call participants are properly created
|
|
|
|
|
assertEquals("callAtP1.getCallParticipantsCount()"
|
|
|
|
|
//verify that call peers are properly created
|
|
|
|
|
assertEquals("callAtP1.getCallPeerCount()"
|
|
|
|
|
, 1, callAtP1.getCallPeerCount());
|
|
|
|
|
assertEquals("callAtP2.getCallParticipantsCount()"
|
|
|
|
|
assertEquals("callAtP2.getCallPeerCount()"
|
|
|
|
|
, 1, callAtP2.getCallPeerCount());
|
|
|
|
|
|
|
|
|
|
CallPeer participantAtP1
|
|
|
|
|
CallPeer peerAtP1
|
|
|
|
|
= (CallPeer)callAtP1.getCallPeers().next();
|
|
|
|
|
CallPeer participantAtP2
|
|
|
|
|
CallPeer peerAtP2
|
|
|
|
|
= (CallPeer)callAtP2.getCallPeers().next();
|
|
|
|
|
|
|
|
|
|
//now add listeners to the participants and make sure they have entered
|
|
|
|
|
//now add listeners to the peers and make sure they have entered
|
|
|
|
|
//the states they were expected to.
|
|
|
|
|
//check states for call participants at both parties
|
|
|
|
|
CallParticipantStateEventCollector stateCollectorForPp1
|
|
|
|
|
= new CallParticipantStateEventCollector(
|
|
|
|
|
participantAtP1, CallPeerState.ALERTING_REMOTE_SIDE);
|
|
|
|
|
CallParticipantStateEventCollector stateCollectorForPp2
|
|
|
|
|
= new CallParticipantStateEventCollector(
|
|
|
|
|
participantAtP2, CallPeerState.INCOMING_CALL);
|
|
|
|
|
//check states for call peers at both parties
|
|
|
|
|
CallPeerStateEventCollector stateCollectorForPp1
|
|
|
|
|
= new CallPeerStateEventCollector(
|
|
|
|
|
peerAtP1, CallPeerState.ALERTING_REMOTE_SIDE);
|
|
|
|
|
CallPeerStateEventCollector stateCollectorForPp2
|
|
|
|
|
= new CallPeerStateEventCollector(
|
|
|
|
|
peerAtP2, CallPeerState.INCOMING_CALL);
|
|
|
|
|
|
|
|
|
|
stateCollectorForPp1.waitForEvent(10000, true);
|
|
|
|
|
stateCollectorForPp2.waitForEvent(10000, true);
|
|
|
|
|
|
|
|
|
|
assertSame("participantAtP1.getCall"
|
|
|
|
|
, participantAtP1.getCall(), callAtP1);
|
|
|
|
|
assertSame("participantAtP2.getCall"
|
|
|
|
|
, participantAtP2.getCall(), callAtP2);
|
|
|
|
|
assertSame("peerAtP1.getCall"
|
|
|
|
|
, peerAtP1.getCall(), callAtP1);
|
|
|
|
|
assertSame("peerAtP2.getCall"
|
|
|
|
|
, peerAtP2.getCall(), callAtP2);
|
|
|
|
|
|
|
|
|
|
//make sure that the participants are in the proper state
|
|
|
|
|
assertEquals("The participant at provider one was not in the "
|
|
|
|
|
//make sure that the peers are in the proper state
|
|
|
|
|
assertEquals("The peer at provider one was not in the "
|
|
|
|
|
+"right state."
|
|
|
|
|
, CallPeerState.ALERTING_REMOTE_SIDE
|
|
|
|
|
, participantAtP1.getState());
|
|
|
|
|
assertEquals("The participant at provider two was not in the "
|
|
|
|
|
, peerAtP1.getState());
|
|
|
|
|
assertEquals("The peer at provider two was not in the "
|
|
|
|
|
+"right state."
|
|
|
|
|
, CallPeerState.INCOMING_CALL
|
|
|
|
|
, participantAtP2.getState());
|
|
|
|
|
, peerAtP2.getState());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//test whether caller/callee info is properly distributed in case
|
|
|
|
|
//the server is said to support it.
|
|
|
|
|
if(Boolean.getBoolean("accounts.sip.PRESERVE_PARTICIPANT_INFO"))
|
|
|
|
|
if(Boolean.getBoolean("accounts.sip.PRESERVE_PEER_INFO"))
|
|
|
|
|
{
|
|
|
|
|
//check properties on the remote call participant for the party that
|
|
|
|
|
//check properties on the remote call peer for the party that
|
|
|
|
|
//initiated the call.
|
|
|
|
|
String expectedParticipant1Address
|
|
|
|
|
String expectedPeer1Address
|
|
|
|
|
= fixture.provider2.getAccountID().getAccountAddress();
|
|
|
|
|
String expectedParticipant1DisplayName
|
|
|
|
|
String expectedPeer1DisplayName
|
|
|
|
|
= System.getProperty(
|
|
|
|
|
SipProtocolProviderServiceLick.ACCOUNT_2_PREFIX
|
|
|
|
|
+ ProtocolProviderFactory.DISPLAY_NAME);
|
|
|
|
|
@ -402,20 +402,20 @@ public void testCreateRejectCall()
|
|
|
|
|
//display name or something of the kind
|
|
|
|
|
assertTrue("Provider 2 did not advertise their "
|
|
|
|
|
+ "accountID.getAccoutAddress() address."
|
|
|
|
|
, expectedParticipant1Address.indexOf(
|
|
|
|
|
participantAtP1.getAddress()) != -1
|
|
|
|
|
|| participantAtP1.getAddress().indexOf(
|
|
|
|
|
expectedParticipant1Address) != -1);
|
|
|
|
|
, expectedPeer1Address.indexOf(
|
|
|
|
|
peerAtP1.getAddress()) != -1
|
|
|
|
|
|| peerAtP1.getAddress().indexOf(
|
|
|
|
|
expectedPeer1Address) != -1);
|
|
|
|
|
assertEquals("Provider 2 did not properly advertise their "
|
|
|
|
|
+ "display name."
|
|
|
|
|
, expectedParticipant1DisplayName
|
|
|
|
|
, participantAtP1.getDisplayName());
|
|
|
|
|
, expectedPeer1DisplayName
|
|
|
|
|
, peerAtP1.getDisplayName());
|
|
|
|
|
|
|
|
|
|
//check properties on the remote call participant for the party that
|
|
|
|
|
//check properties on the remote call peer for the party that
|
|
|
|
|
//receives the call.
|
|
|
|
|
String expectedParticipant2Address
|
|
|
|
|
String expectedPeer2Address
|
|
|
|
|
= fixture.provider1.getAccountID().getAccountAddress();
|
|
|
|
|
String expectedParticipant2DisplayName
|
|
|
|
|
String expectedPeer2DisplayName
|
|
|
|
|
= System.getProperty(
|
|
|
|
|
SipProtocolProviderServiceLick.ACCOUNT_1_PREFIX
|
|
|
|
|
+ ProtocolProviderFactory.DISPLAY_NAME);
|
|
|
|
|
@ -424,26 +424,26 @@ public void testCreateRejectCall()
|
|
|
|
|
//display name or something of the kind
|
|
|
|
|
assertTrue("Provider 1 did not advertise their "
|
|
|
|
|
+ "accountID.getAccoutAddress() address."
|
|
|
|
|
, expectedParticipant2Address.indexOf(
|
|
|
|
|
participantAtP2.getAddress()) != -1
|
|
|
|
|
|| participantAtP2.getAddress().indexOf(
|
|
|
|
|
expectedParticipant2Address) != -1);
|
|
|
|
|
, expectedPeer2Address.indexOf(
|
|
|
|
|
peerAtP2.getAddress()) != -1
|
|
|
|
|
|| peerAtP2.getAddress().indexOf(
|
|
|
|
|
expectedPeer2Address) != -1);
|
|
|
|
|
assertEquals("Provider 1 did not properly advertise their "
|
|
|
|
|
+ "display name."
|
|
|
|
|
, expectedParticipant2DisplayName
|
|
|
|
|
, participantAtP2.getDisplayName());
|
|
|
|
|
, expectedPeer2DisplayName
|
|
|
|
|
, peerAtP2.getDisplayName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//we'll now try to send busy tone.
|
|
|
|
|
|
|
|
|
|
//listeners monitoring state change of the participant
|
|
|
|
|
CallParticipantStateEventCollector busyStateCollectorForPp1
|
|
|
|
|
= new CallParticipantStateEventCollector(
|
|
|
|
|
participantAtP1, CallPeerState.BUSY);
|
|
|
|
|
stateCollectorForPp1 = new CallParticipantStateEventCollector(
|
|
|
|
|
participantAtP1, CallPeerState.DISCONNECTED);
|
|
|
|
|
stateCollectorForPp2 = new CallParticipantStateEventCollector(
|
|
|
|
|
participantAtP2, CallPeerState.DISCONNECTED);
|
|
|
|
|
//listeners monitoring state change of the peer
|
|
|
|
|
CallPeerStateEventCollector busyStateCollectorForPp1
|
|
|
|
|
= new CallPeerStateEventCollector(
|
|
|
|
|
peerAtP1, CallPeerState.BUSY);
|
|
|
|
|
stateCollectorForPp1 = new CallPeerStateEventCollector(
|
|
|
|
|
peerAtP1, CallPeerState.DISCONNECTED);
|
|
|
|
|
stateCollectorForPp2 = new CallPeerStateEventCollector(
|
|
|
|
|
peerAtP2, CallPeerState.DISCONNECTED);
|
|
|
|
|
|
|
|
|
|
//listeners waiting for the op set to announce the end of the call
|
|
|
|
|
call1Listener = new CallEventCollector(basicTelephonyP1);
|
|
|
|
|
@ -456,9 +456,9 @@ public void testCreateRejectCall()
|
|
|
|
|
= new CallStateEventCollector(callAtP2, CallState.CALL_ENDED);
|
|
|
|
|
|
|
|
|
|
//Now make the caller CANCEL the call.
|
|
|
|
|
basicTelephonyP2.hangupCallPeer(participantAtP2);
|
|
|
|
|
basicTelephonyP2.hangupCallPeer(peerAtP2);
|
|
|
|
|
busyStateCollectorForPp1.waitForEvent(10000);
|
|
|
|
|
basicTelephonyP1.hangupCallPeer(participantAtP1);
|
|
|
|
|
basicTelephonyP1.hangupCallPeer(peerAtP1);
|
|
|
|
|
|
|
|
|
|
//wait for everything to happen
|
|
|
|
|
call1Listener.waitForEvent(10000);
|
|
|
|
|
@ -469,11 +469,11 @@ public void testCreateRejectCall()
|
|
|
|
|
call2StateCollector.waitForEvent(10000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//make sure that the participant is disconnected
|
|
|
|
|
assertEquals("The participant at provider one was not in the "
|
|
|
|
|
//make sure that the peer is disconnected
|
|
|
|
|
assertEquals("The peer at provider one was not in the "
|
|
|
|
|
+"right state."
|
|
|
|
|
, CallPeerState.DISCONNECTED
|
|
|
|
|
, participantAtP1.getState());
|
|
|
|
|
, peerAtP1.getState());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -494,11 +494,11 @@ public void testCreateRejectCall()
|
|
|
|
|
|
|
|
|
|
//same for provider 2
|
|
|
|
|
|
|
|
|
|
//make sure that the participant is disconnected
|
|
|
|
|
assertEquals("The participant at provider one was not in the "
|
|
|
|
|
//make sure that the peer is disconnected
|
|
|
|
|
assertEquals("The peer at provider one was not in the "
|
|
|
|
|
+"right state."
|
|
|
|
|
, CallPeerState.DISCONNECTED
|
|
|
|
|
, participantAtP2.getState());
|
|
|
|
|
, peerAtP2.getState());
|
|
|
|
|
|
|
|
|
|
//make sure the telephony operation set distributed an event for the end
|
|
|
|
|
//of the call
|
|
|
|
|
@ -582,55 +582,55 @@ public void aTestCreateAnswerHangupCall()
|
|
|
|
|
,CallEvent.CALL_RECEIVED, callReceivedEvent.getEventID());
|
|
|
|
|
assertNotNull("CallEvent.getSource()", callAtP2);
|
|
|
|
|
|
|
|
|
|
//verify that call participants are properly created
|
|
|
|
|
assertEquals("callAtP1.getCallParticipantsCount()"
|
|
|
|
|
//verify that call peers are properly created
|
|
|
|
|
assertEquals("callAtP1.getCallpeersCount()"
|
|
|
|
|
, 1, callAtP1.getCallPeerCount());
|
|
|
|
|
assertEquals("callAtP2.getCallParticipantsCount()"
|
|
|
|
|
assertEquals("callAtP2.getCallpeersCount()"
|
|
|
|
|
, 1, callAtP2.getCallPeerCount());
|
|
|
|
|
|
|
|
|
|
CallPeer participantAtP1
|
|
|
|
|
CallPeer peerAtP1
|
|
|
|
|
= (CallPeer)callAtP1.getCallPeers().next();
|
|
|
|
|
CallPeer participantAtP2
|
|
|
|
|
CallPeer peerAtP2
|
|
|
|
|
= (CallPeer)callAtP2.getCallPeers().next();
|
|
|
|
|
|
|
|
|
|
//now add listeners to the participants and make sure they have entered
|
|
|
|
|
//now add listeners to the peers and make sure they have entered
|
|
|
|
|
//the states they were expected to.
|
|
|
|
|
//check states for call participants at both parties
|
|
|
|
|
CallParticipantStateEventCollector stateCollectorForPp1
|
|
|
|
|
= new CallParticipantStateEventCollector(
|
|
|
|
|
participantAtP1, CallPeerState.ALERTING_REMOTE_SIDE);
|
|
|
|
|
CallParticipantStateEventCollector stateCollectorForPp2
|
|
|
|
|
= new CallParticipantStateEventCollector(
|
|
|
|
|
participantAtP2, CallPeerState.INCOMING_CALL);
|
|
|
|
|
//check states for call peers at both parties
|
|
|
|
|
CallPeerStateEventCollector stateCollectorForPp1
|
|
|
|
|
= new CallPeerStateEventCollector(
|
|
|
|
|
peerAtP1, CallPeerState.ALERTING_REMOTE_SIDE);
|
|
|
|
|
CallPeerStateEventCollector stateCollectorForPp2
|
|
|
|
|
= new CallPeerStateEventCollector(
|
|
|
|
|
peerAtP2, CallPeerState.INCOMING_CALL);
|
|
|
|
|
|
|
|
|
|
stateCollectorForPp1.waitForEvent(10000, true);
|
|
|
|
|
stateCollectorForPp2.waitForEvent(10000, true);
|
|
|
|
|
|
|
|
|
|
assertSame("participantAtP1.getCall"
|
|
|
|
|
, participantAtP1.getCall(), callAtP1);
|
|
|
|
|
assertSame("participantAtP2.getCall"
|
|
|
|
|
, participantAtP2.getCall(), callAtP2);
|
|
|
|
|
assertSame("peerAtP1.getCall"
|
|
|
|
|
, peerAtP1.getCall(), callAtP1);
|
|
|
|
|
assertSame("peerAtP2.getCall"
|
|
|
|
|
, peerAtP2.getCall(), callAtP2);
|
|
|
|
|
|
|
|
|
|
//make sure that the participants are in the proper state
|
|
|
|
|
assertEquals("The participant at provider one was not in the "
|
|
|
|
|
//make sure that the peers are in the proper state
|
|
|
|
|
assertEquals("The peer at provider one was not in the "
|
|
|
|
|
+"right state."
|
|
|
|
|
, CallPeerState.ALERTING_REMOTE_SIDE
|
|
|
|
|
, participantAtP1.getState());
|
|
|
|
|
assertEquals("The participant at provider two was not in the "
|
|
|
|
|
, peerAtP1.getState());
|
|
|
|
|
assertEquals("The peer at provider two was not in the "
|
|
|
|
|
+"right state."
|
|
|
|
|
, CallPeerState.INCOMING_CALL
|
|
|
|
|
, participantAtP2.getState());
|
|
|
|
|
, peerAtP2.getState());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//test whether caller/callee info is properly distributed in case
|
|
|
|
|
//the server is said to support it.
|
|
|
|
|
if(Boolean.getBoolean("accounts.sip.PRESERVE_PARTICIPANT_INFO"))
|
|
|
|
|
if(Boolean.getBoolean("accounts.sip.PRESERVE_PEER_INFO"))
|
|
|
|
|
{
|
|
|
|
|
//check properties on the remote call participant for the party that
|
|
|
|
|
//check properties on the remote call peer for the party that
|
|
|
|
|
//initiated the call.
|
|
|
|
|
String expectedParticipant1Address
|
|
|
|
|
String expectedPeer1Address
|
|
|
|
|
= fixture.provider2.getAccountID().getAccountAddress();
|
|
|
|
|
String expectedParticipant1DisplayName
|
|
|
|
|
String expectedPeer1DisplayName
|
|
|
|
|
= System.getProperty(
|
|
|
|
|
SipProtocolProviderServiceLick.ACCOUNT_2_PREFIX
|
|
|
|
|
+ ProtocolProviderFactory.DISPLAY_NAME);
|
|
|
|
|
@ -639,20 +639,20 @@ public void aTestCreateAnswerHangupCall()
|
|
|
|
|
//display name or something of the kind
|
|
|
|
|
assertTrue("Provider 2 did not advertise their "
|
|
|
|
|
+ "accountID.getAccoutAddress() address."
|
|
|
|
|
, expectedParticipant1Address.indexOf(
|
|
|
|
|
participantAtP1.getAddress()) != -1
|
|
|
|
|
|| participantAtP1.getAddress().indexOf(
|
|
|
|
|
expectedParticipant1Address) != -1);
|
|
|
|
|
, expectedPeer1Address.indexOf(
|
|
|
|
|
peerAtP1.getAddress()) != -1
|
|
|
|
|
|| peerAtP1.getAddress().indexOf(
|
|
|
|
|
expectedPeer1Address) != -1);
|
|
|
|
|
assertEquals("Provider 2 did not properly advertise their "
|
|
|
|
|
+ "display name."
|
|
|
|
|
, expectedParticipant1DisplayName
|
|
|
|
|
, participantAtP1.getDisplayName());
|
|
|
|
|
, expectedPeer1DisplayName
|
|
|
|
|
, peerAtP1.getDisplayName());
|
|
|
|
|
|
|
|
|
|
//check properties on the remote call participant for the party that
|
|
|
|
|
//check properties on the remote call peer for the party that
|
|
|
|
|
//receives the call.
|
|
|
|
|
String expectedParticipant2Address
|
|
|
|
|
String expectedPeer2Address
|
|
|
|
|
= fixture.provider1.getAccountID().getAccountAddress();
|
|
|
|
|
String expectedParticipant2DisplayName
|
|
|
|
|
String expectedPeer2DisplayName
|
|
|
|
|
= System.getProperty(
|
|
|
|
|
SipProtocolProviderServiceLick.ACCOUNT_1_PREFIX
|
|
|
|
|
+ ProtocolProviderFactory.DISPLAY_NAME);
|
|
|
|
|
@ -661,85 +661,85 @@ public void aTestCreateAnswerHangupCall()
|
|
|
|
|
//display name or something of the kind
|
|
|
|
|
assertTrue("Provider 1 did not advertise their "
|
|
|
|
|
+ "accountID.getAccoutAddress() address."
|
|
|
|
|
, expectedParticipant2Address.indexOf(
|
|
|
|
|
participantAtP2.getAddress()) != -1
|
|
|
|
|
|| participantAtP2.getAddress().indexOf(
|
|
|
|
|
expectedParticipant2Address) != -1);
|
|
|
|
|
, expectedPeer2Address.indexOf(
|
|
|
|
|
peerAtP2.getAddress()) != -1
|
|
|
|
|
|| peerAtP2.getAddress().indexOf(
|
|
|
|
|
expectedPeer2Address) != -1);
|
|
|
|
|
assertEquals("Provider 1 did not properly advertise their "
|
|
|
|
|
+ "display name."
|
|
|
|
|
, expectedParticipant2DisplayName
|
|
|
|
|
, participantAtP2.getDisplayName());
|
|
|
|
|
, expectedPeer2DisplayName
|
|
|
|
|
, peerAtP2.getDisplayName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//add listeners to the participants and make sure enter
|
|
|
|
|
//add listeners to the peers and make sure enter
|
|
|
|
|
//a connected state after we answer
|
|
|
|
|
stateCollectorForPp1
|
|
|
|
|
= new CallParticipantStateEventCollector(
|
|
|
|
|
participantAtP1, CallPeerState.CONNECTED);
|
|
|
|
|
= new CallPeerStateEventCollector(
|
|
|
|
|
peerAtP1, CallPeerState.CONNECTED);
|
|
|
|
|
stateCollectorForPp2
|
|
|
|
|
= new CallParticipantStateEventCollector(
|
|
|
|
|
participantAtP2, CallPeerState.CONNECTED);
|
|
|
|
|
= new CallPeerStateEventCollector(
|
|
|
|
|
peerAtP2, CallPeerState.CONNECTED);
|
|
|
|
|
|
|
|
|
|
//we will now anser the call and verify that both parties change states
|
|
|
|
|
//accordingly.
|
|
|
|
|
basicTelephonyP2.answerCallPeer(participantAtP2);
|
|
|
|
|
basicTelephonyP2.answerCallPeer(peerAtP2);
|
|
|
|
|
|
|
|
|
|
stateCollectorForPp1.waitForEvent(10000);
|
|
|
|
|
stateCollectorForPp2.waitForEvent(10000);
|
|
|
|
|
|
|
|
|
|
//make sure that the participants are in the proper state
|
|
|
|
|
assertEquals("The participant at provider one was not in the "
|
|
|
|
|
//make sure that the peers are in the proper state
|
|
|
|
|
assertEquals("The peer at provider one was not in the "
|
|
|
|
|
+"right state."
|
|
|
|
|
, CallPeerState.CONNECTED
|
|
|
|
|
, participantAtP1.getState());
|
|
|
|
|
assertEquals("The participant at provider two was not in the "
|
|
|
|
|
, peerAtP1.getState());
|
|
|
|
|
assertEquals("The peer at provider two was not in the "
|
|
|
|
|
+"right state."
|
|
|
|
|
, CallPeerState.CONNECTED
|
|
|
|
|
, participantAtP2.getState());
|
|
|
|
|
, peerAtP2.getState());
|
|
|
|
|
|
|
|
|
|
//make sure that events have been distributed when states were changed.
|
|
|
|
|
assertEquals("No event was dispatched when a call participant changed "
|
|
|
|
|
assertEquals("No event was dispatched when a call peer changed "
|
|
|
|
|
+"its state."
|
|
|
|
|
, 1
|
|
|
|
|
, stateCollectorForPp1.collectedEvents.size());
|
|
|
|
|
assertEquals("No event was dispatched when a call participant changed "
|
|
|
|
|
assertEquals("No event was dispatched when a call peer changed "
|
|
|
|
|
+"its state."
|
|
|
|
|
, 1
|
|
|
|
|
, stateCollectorForPp2.collectedEvents.size());
|
|
|
|
|
|
|
|
|
|
//add listeners to the participants and make sure they have entered
|
|
|
|
|
//add listeners to the peers and make sure they have entered
|
|
|
|
|
//the states they are expected to.
|
|
|
|
|
stateCollectorForPp1
|
|
|
|
|
= new CallParticipantStateEventCollector(
|
|
|
|
|
participantAtP1, CallPeerState.DISCONNECTED);
|
|
|
|
|
= new CallPeerStateEventCollector(
|
|
|
|
|
peerAtP1, CallPeerState.DISCONNECTED);
|
|
|
|
|
stateCollectorForPp2
|
|
|
|
|
= new CallParticipantStateEventCollector(
|
|
|
|
|
participantAtP2, CallPeerState.DISCONNECTED);
|
|
|
|
|
= new CallPeerStateEventCollector(
|
|
|
|
|
peerAtP2, CallPeerState.DISCONNECTED);
|
|
|
|
|
|
|
|
|
|
//we will now end the call and verify that both parties change states
|
|
|
|
|
//accordingly.
|
|
|
|
|
basicTelephonyP2.hangupCallPeer(participantAtP2);
|
|
|
|
|
basicTelephonyP2.hangupCallPeer(peerAtP2);
|
|
|
|
|
|
|
|
|
|
stateCollectorForPp1.waitForEvent(10000);
|
|
|
|
|
stateCollectorForPp2.waitForEvent(10000);
|
|
|
|
|
|
|
|
|
|
//make sure that the participants are in the proper state
|
|
|
|
|
assertEquals("The participant at provider one was not in the "
|
|
|
|
|
//make sure that the peers are in the proper state
|
|
|
|
|
assertEquals("The peer at provider one was not in the "
|
|
|
|
|
+"right state."
|
|
|
|
|
, CallPeerState.DISCONNECTED
|
|
|
|
|
, participantAtP1.getState());
|
|
|
|
|
assertEquals("The participant at provider two was not in the "
|
|
|
|
|
, peerAtP1.getState());
|
|
|
|
|
assertEquals("The peer at provider two was not in the "
|
|
|
|
|
+"right state."
|
|
|
|
|
, CallPeerState.DISCONNECTED
|
|
|
|
|
, participantAtP2.getState());
|
|
|
|
|
, peerAtP2.getState());
|
|
|
|
|
|
|
|
|
|
//make sure that the corresponding events were delivered.
|
|
|
|
|
assertEquals("a provider did not distribute an event when a call "
|
|
|
|
|
+"participant changed states."
|
|
|
|
|
+"peer changed states."
|
|
|
|
|
, 1
|
|
|
|
|
, stateCollectorForPp1.collectedEvents.size());
|
|
|
|
|
assertEquals("a provider did not distribute an event when a call "
|
|
|
|
|
+"participant changed states."
|
|
|
|
|
+"peer changed states."
|
|
|
|
|
, 1
|
|
|
|
|
, stateCollectorForPp2.collectedEvents.size());
|
|
|
|
|
|
|
|
|
|
@ -853,30 +853,30 @@ public void callEnded(CallEvent event)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Allows tests to wait for and collect events issued upon call participant
|
|
|
|
|
* Allows tests to wait for and collect events issued upon call peer
|
|
|
|
|
* status changes.
|
|
|
|
|
*/
|
|
|
|
|
public class CallParticipantStateEventCollector
|
|
|
|
|
public class CallPeerStateEventCollector
|
|
|
|
|
extends CallPeerAdapter
|
|
|
|
|
{
|
|
|
|
|
public ArrayList collectedEvents = new ArrayList();
|
|
|
|
|
private CallPeer listenedCallParticipant = null;
|
|
|
|
|
private CallPeer listenedCallPeer = null;
|
|
|
|
|
public CallPeerState awaitedState = null;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates an instance of this collector and adds it as a listener
|
|
|
|
|
* to <tt>callParticipant</tt>.
|
|
|
|
|
* @param callParticipant the CallParticipant that we will be listening
|
|
|
|
|
* to <tt>callPeer</tt>.
|
|
|
|
|
* @param callPeer the CallPeer that we will be listening
|
|
|
|
|
* to.
|
|
|
|
|
* @param awaitedState the state that we will be waiting for inside
|
|
|
|
|
* this collector.
|
|
|
|
|
*/
|
|
|
|
|
public CallParticipantStateEventCollector(
|
|
|
|
|
CallPeer callParticipant,
|
|
|
|
|
public CallPeerStateEventCollector(
|
|
|
|
|
CallPeer callPeer,
|
|
|
|
|
CallPeerState awaitedState)
|
|
|
|
|
{
|
|
|
|
|
this.listenedCallParticipant = callParticipant;
|
|
|
|
|
this.listenedCallParticipant.addCallPeerListener(this);
|
|
|
|
|
this.listenedCallPeer = callPeer;
|
|
|
|
|
this.listenedCallPeer.addCallPeerListener(this);
|
|
|
|
|
this.awaitedState = awaitedState;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -920,23 +920,23 @@ public void waitForEvent(long waitFor)
|
|
|
|
|
* @param waitFor the number of miliseconds that we should be waiting
|
|
|
|
|
* for an event before simply bailing out.
|
|
|
|
|
* @param exitIfAlreadyInState specifies whether the method is to return
|
|
|
|
|
* if the call participant is already in such a state even if no event
|
|
|
|
|
* if the call peer is already in such a state even if no event
|
|
|
|
|
* has been received for the sate change.
|
|
|
|
|
*/
|
|
|
|
|
public void waitForEvent(long waitFor, boolean exitIfAlreadyInState)
|
|
|
|
|
{
|
|
|
|
|
logger.trace("Waiting for a CallParticipantEvent with newState="
|
|
|
|
|
+ awaitedState + " for participant "
|
|
|
|
|
+ this.listenedCallParticipant);
|
|
|
|
|
logger.trace("Waiting for a CallPeerEvent with newState="
|
|
|
|
|
+ awaitedState + " for peer "
|
|
|
|
|
+ this.listenedCallPeer);
|
|
|
|
|
synchronized (this)
|
|
|
|
|
{
|
|
|
|
|
if(exitIfAlreadyInState
|
|
|
|
|
&& listenedCallParticipant.getState().equals(awaitedState))
|
|
|
|
|
&& listenedCallPeer.getState().equals(awaitedState))
|
|
|
|
|
{
|
|
|
|
|
logger.trace("Src participant is already in the awaited "
|
|
|
|
|
logger.trace("Src peer is already in the awaited "
|
|
|
|
|
+ "state."
|
|
|
|
|
+ collectedEvents);
|
|
|
|
|
listenedCallParticipant.removeCallPeerListener(this);
|
|
|
|
|
listenedCallPeer.removeCallPeerListener(this);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(collectedEvents.size() > 0)
|
|
|
|
|
@ -949,7 +949,7 @@ public void waitForEvent(long waitFor, boolean exitIfAlreadyInState)
|
|
|
|
|
{
|
|
|
|
|
logger.trace("Event already received. " +
|
|
|
|
|
collectedEvents);
|
|
|
|
|
listenedCallParticipant
|
|
|
|
|
listenedCallPeer
|
|
|
|
|
.removeCallPeerListener(this);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@ -964,7 +964,7 @@ public void waitForEvent(long waitFor, boolean exitIfAlreadyInState)
|
|
|
|
|
logger.trace("No CallParticpantStateEvent received for "
|
|
|
|
|
+ waitFor + "ms.");
|
|
|
|
|
|
|
|
|
|
listenedCallParticipant
|
|
|
|
|
listenedCallPeer
|
|
|
|
|
.removeCallPeerListener(this);
|
|
|
|
|
}
|
|
|
|
|
catch (InterruptedException ex)
|
|
|
|
|
|