diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index decbdedfdcb650d42d9b78a322d42e010e31acb6..89a3c8bb1b62a2ac703abcc3d42568c649efdb64 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -8741,6 +8741,14 @@ void linphone_core_set_media_encryption_mandatory(LinphoneCore *lc, bool_t m) { linphone_config_set_int(lc->config, "sip", "media_encryption_mandatory", (int)m); } +bool_t linphone_core_security_alert_enabled(const LinphoneCore *core) { + return !!linphone_config_get_int(core->config, "misc", "security_alert", 1); +} + +void linphone_core_enable_security_alert(LinphoneCore *core, bool_t enable) { + linphone_config_get_int(core->config, "misc", "security_alert", enable); +} + bool_t linphone_core_zero_rtp_port_for_stream_inactive_enabled(const LinphoneCore *lc) { return (bool_t) !!linphone_config_get_int(lc->config, "sip", "zero_rtp_port_for_stream_inactive", 0); } diff --git a/coreapi/private_functions.h b/coreapi/private_functions.h index 8a0f4afe234561f60c578e4c9fdec7598c5ed5e7..65bd7130483a1b13a9fdfb5923e4b86459e4b5e7 100644 --- a/coreapi/private_functions.h +++ b/coreapi/private_functions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2022 Belledonne Communications SARL. + * Copyright (c) 2010-2025 Belledonne Communications SARL. * * This file is part of Liblinphone * (see https://gitlab.linphone.org/BC/public/liblinphone). @@ -793,6 +793,21 @@ MsZrtpCryptoTypesCount linphone_core_get_zrtp_auth_suites(LinphoneCore *lc, MsZrtpCryptoTypesCount linphone_core_get_zrtp_sas_suites(LinphoneCore *lc, MSZrtpSasType sasTypes[MS_MAX_ZRTP_CRYPTO_TYPES]); +/** + * Tells whether the security alert feature is enabled for this #LinphoneCore object. + * By default, the security alert is enabled. + * @param core The #LinphoneCore object. @notnil + * @return TRUE if the security alert feature is enabled. + */ +bool_t linphone_core_security_alert_enabled(const LinphoneCore *core); + +/** + * Enables the security alert feature. + * @param core The #LinphoneCore object @notnil + * @param enable A boolean value telling whether to enable or disable the security alert feature. + */ +void linphone_core_enable_security_alert(LinphoneCore *core, bool_t enable); + LinphoneImEncryptionEngineCbs *linphone_im_encryption_engine_cbs_new(void); LinphoneRange *linphone_range_new(void); diff --git a/src/conference/session/tone-manager.cpp b/src/conference/session/tone-manager.cpp index 271d3251a332a2a8b0f974b83adf8d8a953768bc..d4a095afca9f2561d99da414ffa64ff6df73215a 100644 --- a/src/conference/session/tone-manager.cpp +++ b/src/conference/session/tone-manager.cpp @@ -753,6 +753,7 @@ void ToneManager::notifyState(const std::shared_ptr<CallSession> &callSession, C } void ToneManager::notifySecurityAlert(BCTBX_UNUSED(const std::shared_ptr<CallSession> &session)) { + if (!linphone_core_security_alert_enabled(getCore().getCCore())) return; notifyToneIndication(LinphoneReasonSasCheckRequired); if (mSecurityAlertTimer) stopSecurityAlert(); mSecurityAlertTimer = getCore().createTimer( @@ -764,6 +765,7 @@ void ToneManager::notifySecurityAlert(BCTBX_UNUSED(const std::shared_ptr<CallSes } void ToneManager::stopSecurityAlert() { + if (!linphone_core_security_alert_enabled(getCore().getCCore())) return; stopTone(); if (mSecurityAlertTimer) { getCore().destroyTimer(mSecurityAlertTimer);