Add accepted elswhere and declined elsewhere call status, do not display this status as missed + tester

This commit is contained in:
Benjamin Reis 2017-08-30 17:06:31 +02:00 committed by Jehan Monnier
parent 1948fbcb07
commit 1c2b5ab29c
6 changed files with 60 additions and 4 deletions

View file

@ -238,6 +238,12 @@ char * linphone_call_log_to_str(LinphoneCallLog *cl){
case LinphoneCallMissed:
status=_("missed");
break;
case LinphoneCallAcceptedElsewhere:
status=_("answered elsewhere");
break;
case LinphoneCallDeclinedElsewhere:
status=_("declined elsewhere");
break;
default:
status=_("unknown");
}

View file

@ -1864,6 +1864,32 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const
call->log->status=LinphoneCallMissed;
}
break;
case LinphoneReasonNone:
if (call->log->dir == LinphoneCallIncoming){
const LinphoneErrorInfo *ei = linphone_call_get_error_info(call);
if (ei) {
int code = linphone_error_info_get_protocol_code(ei);
if((code >= 200 && code < 300)) {
// error between 200-299 means accepted elsewhere
call->log->status=LinphoneCallAcceptedElsewhere;
break;
}
}
}
break;
case LinphoneReasonDoNotDisturb:
if (call->log->dir == LinphoneCallIncoming){
const LinphoneErrorInfo *ei = linphone_call_get_error_info(call);
if (ei) {
int code = linphone_error_info_get_protocol_code(ei);
if(code >= 600 && code < 700) {
// error between 600-699 means declined elsewhere
call->log->status=LinphoneCallDeclinedElsewhere;
break;
}
}
}
break;
default:
break;
}

View file

@ -342,6 +342,12 @@ void linphone_gtk_call_log_update(GtkWidget *w){
case LinphoneCallDeclined:
status=_("Declined");
break;
case LinphoneCallAnsweredElsewhere:
status=_("Answered elsewhere");
break;
case LinphoneCallDeclinedElsewhere:
status=_("Declined elsewhere");
break;
default:
break;
}

View file

@ -343,7 +343,9 @@ typedef enum _LinphoneCallStatus {
LinphoneCallAborted, /**< The call was aborted */
LinphoneCallMissed, /**< The call was missed (unanswered) */
LinphoneCallDeclined, /**< The call was declined, either locally or by remote end */
LinphoneCallEarlyAborted /**<The call was aborted before being advertised to the application - for protocol reasons*/
LinphoneCallEarlyAborted, /**<The call was aborted before being advertised to the application - for protocol reasons*/
LinphoneCallAcceptedElsewhere, /**<The call was answered on another device*/
LinphoneCallDeclinedElsewhere /**<The call was declined on another device*/
} LinphoneCallStatus;
/**

View file

@ -61,6 +61,16 @@ public interface LinphoneCallLog {
*/
public final static CallStatus EarlyAborted = new CallStatus(4,"Early Aborted");
/**
* The call was answered on another device
*/
public final static CallStatus AcceptedElsewhere = new CallStatus(5,"Accepted Elsewhere");
/**
* The call was declined on another device
*/
public final static CallStatus DeclinedElsewhere = new CallStatus(6,"Declined Elsewhere");
private CallStatus(int value,String stringValue) {
mValue = value;

View file

@ -1044,6 +1044,7 @@ static void terminate_call_with_error(void) {
BC_ASSERT_STRING_EQUAL(linphone_error_info_get_phrase(rei), "Call refused for security reason");
BC_ASSERT_STRING_EQUAL(linphone_error_info_get_protocol(ei), "SIP");
}
BC_ASSERT_EQUAL(linphone_call_log_get_status(linphone_call_get_call_log(call_callee)), LinphoneCallAcceptedElsewhere, int, "%d");
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallReleased,1));
@ -1094,6 +1095,7 @@ static void cancel_call_with_error(void) {
BC_ASSERT_STRING_EQUAL(linphone_error_info_get_phrase(rei), "Call has been cancelled");
BC_ASSERT_STRING_EQUAL(linphone_error_info_get_protocol(rei), "SIP");
}
BC_ASSERT_EQUAL(linphone_call_log_get_status(linphone_call_get_call_log(call_callee)), LinphoneCallDeclinedElsewhere, int, "%d");
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallReleased,1));
@ -1142,6 +1144,7 @@ static void cancel_other_device_after_accept(void) {
BC_ASSERT_STRING_EQUAL(linphone_error_info_get_phrase(rei), "Call completed elsewhere");
BC_ASSERT_STRING_EQUAL(linphone_error_info_get_protocol(rei), "SIP");
}
BC_ASSERT_EQUAL(linphone_call_log_get_status(linphone_call_get_call_log(call_callee_2)), LinphoneCallAcceptedElsewhere, int, "%d");
}
linphone_call_terminate(out_call);
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallEnd,1));
@ -1179,10 +1182,12 @@ static void cancel_other_device_after_decline(void) {
BC_ASSERT_PTR_NOT_NULL(call_callee_2);
BC_ASSERT_EQUAL(linphone_call_decline(call_callee, LinphoneReasonDeclined), 0 , int, "%d");
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallEnd,1));
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallEnd,1));
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallReleased, 1));
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr_2->lc,&callee_mgr_2->stat.number_of_LinphoneCallEnd,1));
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr_2->lc,&callee_mgr_2->stat.number_of_LinphoneCallReleased,1));
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallEnd,1));
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallReleased, 1));
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr_2->lc, &callee_mgr_2->stat.number_of_LinphoneCallEnd,1));
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr_2->lc, &callee_mgr_2->stat.number_of_LinphoneCallReleased,1));
rei = linphone_call_get_error_info(call_callee_2);
BC_ASSERT_PTR_NOT_NULL(rei);
@ -1192,6 +1197,7 @@ static void cancel_other_device_after_decline(void) {
BC_ASSERT_STRING_EQUAL(linphone_error_info_get_phrase(rei), "Busy Everywhere");
BC_ASSERT_STRING_EQUAL(linphone_error_info_get_protocol(rei), "SIP");
}
BC_ASSERT_EQUAL(linphone_call_log_get_status(linphone_call_get_call_log(call_callee_2)), LinphoneCallDeclinedElsewhere, int, "%d");
}
if (out_call) linphone_call_unref(out_call);
if (call_callee) linphone_call_unref(call_callee);