diff --git a/coreapi/call_log.c b/coreapi/call_log.c index d1e59578f..7ce488096 100644 --- a/coreapi/call_log.c +++ b/coreapi/call_log.c @@ -281,6 +281,7 @@ LinphoneCallLog * linphone_call_log_new(LinphoneCallDir dir, LinphoneAddress *fr cl->reporting.reports[LINPHONE_CALL_STATS_AUDIO]=linphone_reporting_new(); cl->reporting.reports[LINPHONE_CALL_STATS_VIDEO]=linphone_reporting_new(); + cl->connected_date_time=0; return cl; } diff --git a/coreapi/call_log.h b/coreapi/call_log.h index d274037d2..6a3ec8dab 100644 --- a/coreapi/call_log.h +++ b/coreapi/call_log.h @@ -79,7 +79,7 @@ LINPHONE_PUBLIC const char * linphone_call_log_get_call_id(const LinphoneCallLog LINPHONE_PUBLIC LinphoneCallDir linphone_call_log_get_dir(LinphoneCallLog *cl); /** - * Get the duration of the call. + * Get the duration of the call since connected. * @param[in] cl LinphoneCallLog object * @return The duration of the call in seconds. **/ diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 152f35e2c..7608c47ba 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -564,7 +564,6 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from, ms_message("New LinphoneCall [%p] initialized (LinphoneCore version: %s)",call,linphone_core_get_version()); call->state=LinphoneCallIdle; call->transfer_state = LinphoneCallIdle; - call->media_start_time=0; call->log=linphone_call_log_new(call->dir, from, to); call->camera_enabled=TRUE; call->current_params = linphone_call_params_new(); @@ -972,7 +971,7 @@ void linphone_call_set_state_base(LinphoneCall *call, LinphoneCallState cstate, } if (cstate == LinphoneCallConnected) { call->log->status=LinphoneCallSuccess; - call->media_start_time=time(NULL); + call->log->connected_date_time=time(NULL); } if (!silently) @@ -1284,8 +1283,8 @@ bool_t linphone_call_has_transfer_pending(const LinphoneCall *call){ * Returns call's duration in seconds. **/ int linphone_call_get_duration(const LinphoneCall *call){ - if (call->media_start_time==0) return 0; - return time(NULL)-call->media_start_time; + if (call->log->connected_date_time==0) return 0; + return time(NULL)-call->log->connected_date_time; } /** @@ -2952,7 +2951,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=time(NULL)-call->log->start_date_time; + call->log->duration=linphone_call_get_duration(call); /*store duration since connected*/ if (call->log->status==LinphoneCallMissed){ char *info; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 40723820a..69152647f 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2452,8 +2452,8 @@ void linphone_core_iterate(LinphoneCore *lc){ } } if ( (lc->sip_conf.in_call_timeout > 0) - && (call->media_start_time != 0) - && ((curtime - call->media_start_time) > lc->sip_conf.in_call_timeout)) + && (call->log->connected_date_time != 0) + && ((curtime - call->log->connected_date_time) > lc->sip_conf.in_call_timeout)) { ms_message("in call timeout (%i)",lc->sip_conf.in_call_timeout); linphone_core_terminate_call(lc,call); diff --git a/coreapi/private.h b/coreapi/private.h index f23859ddd..7cef61242 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -125,12 +125,13 @@ struct _LinphoneCallLog{ LinphoneAddress *from; /**lc); lcs = ms_list_append(lcs,pauline->lc); @@ -2142,6 +2146,7 @@ static void early_media_call_with_ringing(void){ linphone_core_set_play_file(pauline->lc,hellopath); marie_call = linphone_core_invite_address(marie->lc, pauline->identity); + marie_call_log = linphone_call_get_call_log(marie_call); CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingReceived,1,3000)); CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingRinging,1,1000)); @@ -2159,20 +2164,25 @@ static void early_media_call_with_ringing(void){ linphone_core_accept_call(pauline->lc, linphone_core_get_current_call(pauline->lc)); + CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallConnected, 1,1000)); + connected_time=time(NULL); CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,1000)); CU_ASSERT_EQUAL(marie_call, linphone_core_get_current_call(marie->lc)); liblinphone_tester_check_rtcp(marie, pauline); + /*just to have a call duration !=0*/ + wait_for_list(lcs,&dummy,1,2000); linphone_core_terminate_all_calls(pauline->lc); CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); - - + ended_time=time(NULL); + CU_ASSERT_TRUE (abs (linphone_call_log_get_duration(marie_call_log) - (ended_time - connected_time)) <1 ); ms_list_free(lcs); } + linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } diff --git a/tester/rcfiles/laure_rc b/tester/rcfiles/laure_rc index 54a682401..7f4d099f5 100644 --- a/tester/rcfiles/laure_rc +++ b/tester/rcfiles/laure_rc @@ -38,4 +38,7 @@ automatically_accept=0 device=StaticImage: Static picture [sound] -echocancellation=0 #to not overload cpu in case of VG \ No newline at end of file +echocancellation=0 #to not overload cpu in case of VG + +[net] +dns_srv_enabled=0 #no srv needed in general \ No newline at end of file diff --git a/tester/rcfiles/marie_rc b/tester/rcfiles/marie_rc index f4f9aa793..a1721c22a 100644 --- a/tester/rcfiles/marie_rc +++ b/tester/rcfiles/marie_rc @@ -48,3 +48,6 @@ device=StaticImage: Static picture [sound] echocancellation=0 #to not overload cpu in case of VG + +[net] +dns_srv_enabled=0 #no srv needed in general diff --git a/tester/rcfiles/pauline_rc b/tester/rcfiles/pauline_rc index 09669b72c..7322fd99a 100644 --- a/tester/rcfiles/pauline_rc +++ b/tester/rcfiles/pauline_rc @@ -45,3 +45,6 @@ device=StaticImage: Static picture [sound] echocancellation=0 #to not overload cpu in case of VG + +[net] +dns_srv_enabled=0 #no srv needed in general \ No newline at end of file