diff --git a/coreapi/call_log.c b/coreapi/call_log.c index d0f67d781..47e689b1a 100644 --- a/coreapi/call_log.c +++ b/coreapi/call_log.c @@ -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"); } diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index c455c68e2..72cea8e21 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -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; } diff --git a/gtk/calllogs.c b/gtk/calllogs.c index 5f5384d45..9ee24eba8 100644 --- a/gtk/calllogs.c +++ b/gtk/calllogs.c @@ -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; } diff --git a/include/linphone/types.h b/include/linphone/types.h index 177e4c003..67a72eafa 100644 --- a/include/linphone/types.h +++ b/include/linphone/types.h @@ -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 /**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);