Commit aad3b7e3 authored by François Grisez's avatar François Grisez

Fix bad call duration computation when the call has not passed by the Connected state

parent 44b2f6ad
......@@ -2181,23 +2181,20 @@ bool_t linphone_call_has_transfer_pending(const LinphoneCall *call){
return call->refer_pending;
}
static int _linphone_call_get_duration (const LinphoneCall *call) {
return (int)(ms_time(NULL) - call->log->connected_date_time);
static int _linphone_call_compute_duration (const LinphoneCall *call) {
if (call->log->connected_date_time == 0) return 0;
else return (int)(ms_time(NULL) - call->log->connected_date_time);
}
int linphone_call_get_duration(const LinphoneCall *call){
if (call->log->connected_date_time==0) return 0;
int linphone_call_get_duration(const LinphoneCall *call) {
switch (call->state) {
case LinphoneCallEnd:
case LinphoneCallError:
case LinphoneCallReleased:
return call->log->duration;
default: break;
default:
return _linphone_call_compute_duration(call);
}
return _linphone_call_get_duration(call);
}
LinphoneCall *linphone_call_get_replaced_call(LinphoneCall *call){
......@@ -4694,7 +4691,7 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse
void linphone_call_log_completed(LinphoneCall *call){
LinphoneCore *lc=call->core;
call->log->duration=_linphone_call_get_duration(call); /*store duration since connected*/
call->log->duration= _linphone_call_compute_duration(call); /*store duration since connected*/
call->log->error_info = linphone_error_info_ref((LinphoneErrorInfo*)linphone_call_get_error_info(call));
if (call->log->status==LinphoneCallMissed){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment