Properly setting end times corresponding the evnts in the call process

cusax-fix
Damian Minkov 20 years ago
parent 36d6c35f98
commit 1def5b5636

@ -787,15 +787,13 @@ public void outgoingCallCreated(CallEvent event)
*/
public void callEnded(CallEvent event)
{
Date endTime = new Date();
CallRecordImpl callRecord = findCallRecord(event.getSourceCall());
// no such call
if (callRecord == null)
return;
callRecord.setEndTime(endTime);
callRecord.setEndTime(new Date());
writeCall(callRecord, null, null);
@ -828,6 +826,9 @@ public void participantStateChanged(CallParticipantChangeEvent evt)
if(participantRecord == null)
return;
if(evt.getNewValue().equals(CallParticipantState.CONNECTED))
participantRecord.setStartTime(new Date());
participantRecord.
setState((CallParticipantState)evt.getNewValue());
@ -848,10 +849,11 @@ public void participantTransportAddressChanged(
CallParticipantChangeEvent evt){}
});
Date startDate = new Date();
CallParticipantRecordImpl newRec = new CallParticipantRecordImpl(
callParticipant.getAddress(),
new Date(),
null);
startDate,
startDate);
callRecord.getParticipantRecords().add(newRec);
}
@ -876,7 +878,11 @@ private void handleParticipantRemoved(CallParticipant callParticipant,
if(!callParticipant.getState().equals(CallParticipantState.DISCONNECTED))
cpRecord.setState(callParticipant.getState());
cpRecord.setEndTime(new Date());
if(cpRecord.getState().equals(CallParticipantState.CONNECTED))
{
cpRecord.setEndTime(new Date());
}
}
/**

@ -4,8 +4,7 @@
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.impl.protocol.sip.CallParticipantSipImpl;
import net.java.sip.communicator.util.Logger;
import net.java.sip.communicator.util.*;
/**
* @author Damian Minkov

@ -6,11 +6,11 @@
*/
package net.java.sip.communicator.impl.protocol.mock;
import java.net.*;
import java.util.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.CallParticipantChangeEvent;
import java.net.InetSocketAddress;
import net.java.sip.communicator.service.protocol.event.*;
/**
*

@ -276,14 +276,14 @@ public void readRecords()
public void checkRecordCompleteness()
{
Vector participantAddresses = new Vector();
participantAddresses.add("some_address");
participantAddresses.add("some_new_address");
logger.info("---=== checkRecordCompleteness ===---");
String[] partAddresses =
new String[]{"some_address", "some_new_address"};
try
{
Call newCall =
mockBTelphonyOpSet.placeCall((String)participantAddresses.get(0));
mockBTelphonyOpSet.placeCall(partAddresses[0]);
Vector v = new Vector();
@ -298,7 +298,7 @@ public void checkRecordCompleteness()
CallParticipant newParticipant =
mockBTelphonyOpSet.addNewCallParticipant(newCall,
(String)participantAddresses.get(1));
partAddresses[1]);
mockBTelphonyOpSet.hangupCallParticipant(newParticipant);
@ -328,9 +328,9 @@ public void checkRecordCompleteness()
callRecord.getParticipantRecords().size(), 2);
CallParticipantRecord callP1 =
callRecord.findParticipantRecord((String)participantAddresses.get(0));
callRecord.findParticipantRecord(partAddresses[0]);
CallParticipantRecord callP2 =
callRecord.findParticipantRecord((String)participantAddresses.get(1));
callRecord.findParticipantRecord(partAddresses[1]);
assertTrue("Second participant added after first one",
callP2.getStartTime().after(callP1.getStartTime()));

Loading…
Cancel
Save