From 4b97a94da2a77b81283365ecb680595400df6e8c Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Tue, 21 Feb 2017 13:34:56 +0100 Subject: [PATCH] fix(src/components/sip-addresses/SipAddressesModel): use correct call timestamp --- .../src/components/sip-addresses/SipAddressesModel.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/linphone-desktop/src/components/sip-addresses/SipAddressesModel.cpp b/linphone-desktop/src/components/sip-addresses/SipAddressesModel.cpp index e4a1d5814..94205c0a8 100644 --- a/linphone-desktop/src/components/sip-addresses/SipAddressesModel.cpp +++ b/linphone-desktop/src/components/sip-addresses/SipAddressesModel.cpp @@ -338,7 +338,11 @@ void SipAddressesModel::initSipAddresses () { QVariantMap map; map["sipAddress"] = sip_address; - map["timestamp"] = QDateTime::fromMSecsSinceEpoch((call_log->getStartDate() + call_log->getDuration()) * 1000); + + // The duration can be wrong if status is not success. + map["timestamp"] = call_log->getStatus() == linphone::CallStatus::CallStatusSuccess + ? QDateTime::fromMSecsSinceEpoch((call_log->getStartDate() + call_log->getDuration()) * 1000) + : QDateTime::fromMSecsSinceEpoch(call_log->getStartDate() * 1000); auto it = m_sip_addresses.find(sip_address); if (it == m_sip_addresses.end() || map["timestamp"] > (*it)["timestamp"])