Commit 1c2b5ab2 authored by Benjamin REIS's avatar Benjamin REIS Committed by jehan

Add accepted elswhere and declined elsewhere call status, do not display this...

Add accepted elswhere and declined elsewhere call status, do not display this status as missed + tester
parent 1948fbcb
......@@ -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");
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
/**
......
......@@ -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;
......
......@@ -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);
......
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