mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
compute call log duration since connected state instead of from call creation
This commit is contained in:
parent
6a455bc346
commit
78c11c8f6e
9 changed files with 32 additions and 13 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -125,12 +125,13 @@ struct _LinphoneCallLog{
|
|||
LinphoneAddress *from; /**<Originator of the call as a LinphoneAddress object*/
|
||||
LinphoneAddress *to; /**<Destination of the call as a LinphoneAddress object*/
|
||||
char start_date[128]; /**<Human readable string containing the start date*/
|
||||
int duration; /**<Duration of the call in seconds*/
|
||||
int duration; /**<Duration of the call starting in connected state in seconds*/
|
||||
char *refkey;
|
||||
rtp_stats_t local_stats;
|
||||
rtp_stats_t remote_stats;
|
||||
float quality;
|
||||
time_t start_date_time; /**Start date of the call in seconds as expressed in a time_t */
|
||||
time_t connected_date_time; /**Connecting date of the call in seconds as expressed in a time_t */
|
||||
char* call_id; /**unique id of a call*/
|
||||
struct _LinphoneQualityReporting reporting;
|
||||
bool_t video_enabled;
|
||||
|
|
@ -204,7 +205,6 @@ struct _LinphoneCall
|
|||
SalOp *op;
|
||||
SalOp *ping_op;
|
||||
char localip[LINPHONE_IPADDR_SIZE]; /* our best guess for local ipaddress for this call */
|
||||
time_t media_start_time; /*time at which it was accepted, media streams established*/
|
||||
LinphoneCallState state;
|
||||
LinphoneCallState prevstate;
|
||||
LinphoneCallState transfer_state; /*idle if no transfer*/
|
||||
|
|
|
|||
|
|
@ -2129,6 +2129,10 @@ static void early_media_call_with_ringing(void){
|
|||
LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_rc");
|
||||
MSList* lcs = NULL;
|
||||
LinphoneCall* marie_call;
|
||||
LinphoneCallLog *marie_call_log;
|
||||
time_t connected_time=0;
|
||||
time_t ended_time=0;
|
||||
int dummy=0;
|
||||
|
||||
lcs = ms_list_append(lcs,marie->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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,4 +38,7 @@ automatically_accept=0
|
|||
device=StaticImage: Static picture
|
||||
|
||||
[sound]
|
||||
echocancellation=0 #to not overload cpu in case of VG
|
||||
echocancellation=0 #to not overload cpu in case of VG
|
||||
|
||||
[net]
|
||||
dns_srv_enabled=0 #no srv needed in general
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
Loading…
Add table
Reference in a new issue