aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/impl/callhistory
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2010-10-01 08:05:24 +0000
committerDamian Minkov <damencho@jitsi.org>2010-10-01 08:05:24 +0000
commit92a82069beb70e34de0d1cc6f72aac57c4a9a229 (patch)
treedaca7dc486868bf792fc8b654a7622fb076243e7 /src/net/java/sip/communicator/impl/callhistory
parenta0b0beb7f5e739f11a234536222dadc2afa86064 (diff)
downloadjitsi-92a82069beb70e34de0d1cc6f72aac57c4a9a229.zip
jitsi-92a82069beb70e34de0d1cc6f72aac57c4a9a229.tar.gz
jitsi-92a82069beb70e34de0d1cc6f72aac57c4a9a229.tar.bz2
Save end reason code for calls if any, and don't show call history records which are answered elsewhere as missed.
Diffstat (limited to 'src/net/java/sip/communicator/impl/callhistory')
-rw-r--r--src/net/java/sip/communicator/impl/callhistory/CallHistoryServiceImpl.java18
-rw-r--r--src/net/java/sip/communicator/impl/callhistory/CallHistorySourceContact.java8
-rw-r--r--src/net/java/sip/communicator/impl/callhistory/CallRecordImpl.java9
3 files changed, 32 insertions, 3 deletions
diff --git a/src/net/java/sip/communicator/impl/callhistory/CallHistoryServiceImpl.java b/src/net/java/sip/communicator/impl/callhistory/CallHistoryServiceImpl.java
index 972c9fe..430b5da 100644
--- a/src/net/java/sip/communicator/impl/callhistory/CallHistoryServiceImpl.java
+++ b/src/net/java/sip/communicator/impl/callhistory/CallHistoryServiceImpl.java
@@ -44,7 +44,7 @@ public class CallHistoryServiceImpl
private static String[] STRUCTURE_NAMES =
new String[] { "accountUID", "callStart", "callEnd", "dir",
"callParticipantIDs", "callParticipantStart",
- "callParticipantEnd", "callParticipantStates" };
+ "callParticipantEnd", "callParticipantStates", "callEndReason" };
private static HistoryRecordStructure recordStructure =
new HistoryRecordStructure(STRUCTURE_NAMES);
@@ -400,6 +400,8 @@ public class CallHistoryServiceImpl
callPeerEnd = getCSVs(value);
else if(propName.equals(STRUCTURE_NAMES[7]))
callPeerStates = getStates(value);
+ else if(propName.equals(STRUCTURE_NAMES[8]))
+ result.setEndReason(Integer.parseInt(value));
}
final int callPeerCount = callPeerIDs == null ? 0 : callPeerIDs.size();
@@ -623,7 +625,8 @@ public class CallHistoryServiceImpl
callPeerIDs.toString(),
callPeerStartTime.toString(),
callPeerEndTime.toString(),
- callPeerStates.toString()},
+ callPeerStates.toString(),
+ String.valueOf(callRecord.getEndReason())},
new Date()); // this date is when the history
// record is written
}
@@ -1122,7 +1125,18 @@ public class CallHistoryServiceImpl
if (evt.getNewValue().equals(CallState.CALL_ENDED))
{
if(evt.getOldValue().equals(CallState.CALL_INITIALIZATION))
+ {
callRecord.setEndTime(callRecord.getStartTime());
+
+ // if call was answered elsewhere, add its reason
+ // so we can distinguish it from missed
+ if(evt.getCause() != null
+ && evt.getCause().getReasonCode() ==
+ CallPeerChangeEvent.NORMAL_CALL_CLEARING)
+ {
+ callRecord.setEndReason(evt.getCause().getReasonCode());
+ }
+ }
else
callRecord.setEndTime(new Date());
diff --git a/src/net/java/sip/communicator/impl/callhistory/CallHistorySourceContact.java b/src/net/java/sip/communicator/impl/callhistory/CallHistorySourceContact.java
index a6fd088..88c9db5 100644
--- a/src/net/java/sip/communicator/impl/callhistory/CallHistorySourceContact.java
+++ b/src/net/java/sip/communicator/impl/callhistory/CallHistorySourceContact.java
@@ -11,6 +11,7 @@ import java.util.*;
import net.java.sip.communicator.service.callhistory.*;
import net.java.sip.communicator.service.contactsource.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
/**
@@ -213,7 +214,12 @@ public class CallHistorySourceContact implements SourceContact
{
if (callRecord.getDirection().equals(CallRecord.IN))
{
- if (callRecord.getStartTime().equals(callRecord.getEndTime()))
+ // if the call record has reason for normal call clearing
+ // means it was answered somewhere else and we don't
+ // mark it as missed
+ if (callRecord.getStartTime().equals(callRecord.getEndTime())
+ && (callRecord.getEndReason()
+ != CallPeerChangeEvent.NORMAL_CALL_CLEARING))
return missedCallIcon;
else
return incomingIcon;
diff --git a/src/net/java/sip/communicator/impl/callhistory/CallRecordImpl.java b/src/net/java/sip/communicator/impl/callhistory/CallRecordImpl.java
index bda0907..ef2998d 100644
--- a/src/net/java/sip/communicator/impl/callhistory/CallRecordImpl.java
+++ b/src/net/java/sip/communicator/impl/callhistory/CallRecordImpl.java
@@ -105,4 +105,13 @@ public class CallRecordImpl
{
this.protocolProvider = pps;
}
+
+ /**
+ * This is the end reason of the call if any.
+ * @param endReason the reason code.
+ */
+ public void setEndReason(int endReason)
+ {
+ this.endReason = endReason;
+ }
}