diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index 641884964..9c2fd6cc0 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -605,7 +605,7 @@ static void set_tls_properties(Sal *ctx){ if (!ctx->tls_verify) verify_exceptions=BELLE_SIP_TLS_LISTENING_POINT_BADCERT_ANY_REASON; else if (!ctx->tls_verify_cn) verify_exceptions=BELLE_SIP_TLS_LISTENING_POINT_BADCERT_CN_MISMATCH; - if (ctx->root_ca) belle_sip_tls_listening_point_set_root_ca(tlp,ctx->root_ca); + belle_sip_tls_listening_point_set_root_ca(tlp,ctx->root_ca); /*root_ca might be NULL */ belle_sip_tls_listening_point_set_verify_exceptions(tlp,verify_exceptions); } } diff --git a/coreapi/bellesip_sal/sal_impl.h b/coreapi/bellesip_sal/sal_impl.h index ef4db521d..80ba748c2 100644 --- a/coreapi/bellesip_sal/sal_impl.h +++ b/coreapi/bellesip_sal/sal_impl.h @@ -90,6 +90,7 @@ struct SalOp{ belle_sip_refresher_t* refresher; int ref; SalOpType_t type; + bool_t privacy_enabled; }; @@ -144,4 +145,6 @@ bool_t sal_op_get_body(SalOp *op, belle_sip_message_t *msg, SalBody *salbody); SalReason sal_reason_to_sip_code(SalReason r); +void sal_op_enable_privacy(SalOp* op,bool_t enable); +bool_t sal_op_privacy_enabled(const SalOp* op); #endif /* SAL_IMPL_H_ */ diff --git a/coreapi/bellesip_sal/sal_op_impl.c b/coreapi/bellesip_sal/sal_op_impl.c index ea8dd9c34..41572caa9 100644 --- a/coreapi/bellesip_sal/sal_op_impl.c +++ b/coreapi/bellesip_sal/sal_op_impl.c @@ -484,3 +484,9 @@ bool_t sal_op_get_body(SalOp *op, belle_sip_message_t *msg, SalBody *salbody){ memset(salbody,0,sizeof(salbody)); return FALSE; } +void sal_op_enable_privacy(SalOp* op,bool_t enable) { + op->privacy_enabled=enable; +} + bool_t sal_op_privacy_enabled(const SalOp* op) { + return op->privacy_enabled; +} diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 5ddf0bbdf..55dca4762 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1141,6 +1141,13 @@ void _linphone_call_params_copy(LinphoneCallParams *ncp, const LinphoneCallParam if (cp->custom_headers) ncp->custom_headers=sal_custom_header_clone(cp->custom_headers); } +void linphone_call_params_enable_privacy(LinphoneCallParams *params, bool_t enable) { + params->privacy_enabled=enable; +} +bool_t linphone_call_params_privacy_enabled(const LinphoneCallParams *params) { + return params->privacy_enabled; +} + /** * Copy existing LinphoneCallParams to a new LinphoneCallParams object. **/ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index b148e1f3e..c6915a32c 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -280,6 +280,20 @@ LINPHONE_PUBLIC void linphone_call_params_set_record_file(LinphoneCallParams *cp LINPHONE_PUBLIC const char *linphone_call_params_get_record_file(const LinphoneCallParams *cp); LINPHONE_PUBLIC void linphone_call_params_add_custom_header(LinphoneCallParams *params, const char *header_name, const char *header_value); LINPHONE_PUBLIC const char *linphone_call_params_get_custom_header(const LinphoneCallParams *params, const char *header_name); +/** + * @ingroup call_control + * indicates if from must be replaced by anonymous value as described by rfc3325. + * @param params to be modified + * @param enable TRUE to enable privacy + * */ +LINPHONE_PUBLIC void linphone_call_params_enable_privacy(LinphoneCallParams *params, bool_t enable); +/** + * @ingroup call_control + * indicates if from must be replaced by anonymous value as described by rfc3325. + * @param params object + * @return TRUE if privacy enabled + * */ +LINPHONE_PUBLIC bool_t linphone_call_params_privacy_enabled(const LinphoneCallParams *params); struct _LinphoneInfoMessage; diff --git a/coreapi/private.h b/coreapi/private.h index a93bcec47..7af6b302d 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -91,6 +91,7 @@ struct _LinphoneCallParams{ bool_t in_conference; /*in conference mode */ bool_t pad; bool_t low_bandwidth; + bool_t privacy_enabled; }; struct _LinphoneCallLog{ diff --git a/tester/call_tester.c b/tester/call_tester.c index 32f43d9f4..f67b70d0a 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -608,6 +608,44 @@ static void call_with_video_added(void) { #endif +static void call_with_privacy(void) { + LinphoneCoreManager* marie = linphone_core_manager_new(liblinphone_tester_file_prefix, "marie_rc"); + LinphoneCoreManager* pauline = linphone_core_manager_new(liblinphone_tester_file_prefix, "pauline_rc"); + LinphoneCall *c1,*c2; + LinphoneCallParams *params; + + params=linphone_core_create_default_call_parameters(pauline->lc); + linphone_call_params_enable_privacy(params,TRUE); + + CU_ASSERT_TRUE(call_with_params(pauline,marie,params)); + linphone_call_params_destroy(params); + + c1=linphone_core_get_current_call(pauline->lc); + c2=linphone_core_get_current_call(marie->lc); + + CU_ASSERT_PTR_NOT_NULL(c1); + CU_ASSERT_PTR_NOT_NULL(c2); + + /*make sure local identity is unchanged*/ + CU_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_log_get_from(linphone_call_get_call_log(c1)),pauline->identity)); + + /*make sure remote identity is hidden*/ + CU_ASSERT_FALSE(linphone_address_weak_equal(linphone_call_get_remote_address(c2),pauline->identity)); + + CU_ASSERT_TRUE(linphone_call_params_privacy_enabled(linphone_call_get_current_params(c2))); + + /*just to sleep*/ + linphone_core_terminate_all_calls(pauline->lc); + CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + + linphone_core_manager_destroy(marie); + linphone_core_manager_destroy(pauline); +} + + + + static void simple_conference(void) { LinphoneCoreManager* marie = linphone_core_manager_new(liblinphone_tester_file_prefix, "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new(liblinphone_tester_file_prefix, "pauline_rc"); @@ -919,6 +957,7 @@ test_t call_tests[] = { #else { "SRTP ice call", srtp_ice_call }, #endif + { "Call with privacy", call_with_privacy }, { "Simple conference", simple_conference }, { "Simple call transfer", simple_call_transfer }, { "Call transfer existing call outgoing call", call_transfer_existing_call_outgoing_call },