From 3a43603e627ba9c12d9c734c0cc4a4e7fc9a57ee Mon Sep 17 00:00:00 2001 From: Andrea Gianarda <andrea.gianarda@belledonne-communications.com> Date: Wed, 16 Aug 2023 14:34:46 +0200 Subject: [PATCH] Conference Factory URI: Set it as Address in account parameters and core in order to easily take advantage of address comparison, parameter management and compliance with RFC3261 Conference: Allow applications to directly mute licrophone and get input device volume through the conference object. This will ensure that whatever type of confenrece is and regardless if the device is hosting or being a participant, the application will have only one interface to use and the SDK will work under the hood. Deprecated methods: Delete linphone_core_mute_mic and linphone_core_is_mic_muted Add LINPHONE_DEPRECATED to deprecated Account parameter methods Tester: Pass conference factory uri to ClientConference constructor instead of focus identity Memory leaks: Free data of list returned by linphone_friend_get_phone_numbers --- coreapi/conference.cpp | 69 +++++++++++++ coreapi/conference.h | 18 ++-- coreapi/friend.c | 8 +- coreapi/linphoneconference.c | 20 ++-- coreapi/linphonecore.c | 22 ++--- coreapi/local_conference.cpp | 19 ---- coreapi/local_conference.h | 2 - coreapi/proxy.c | 2 +- coreapi/remote_conference.cpp | 19 ---- coreapi/remote_conference.h | 2 - include/linphone/api/c-account-params.h | 65 ++++++++---- include/linphone/api/c-call.h | 6 ++ include/linphone/conference.h | 29 +++++- include/linphone/core.h | 22 ++--- src/account/account-params.cpp | 71 ++++++++++---- src/account/account-params.h | 12 ++- src/account/account.cpp | 36 ++++--- src/account/account.h | 2 +- src/c-wrapper/api/c-account-params.cpp | 15 ++- src/call/call.cpp | 3 - src/chat/chat-room/client-group-chat-room-p.h | 2 +- src/chat/chat-room/client-group-chat-room.cpp | 6 +- .../remote-conference-list-event-handler.cpp | 30 +++--- src/conference/session/audio-mixer.cpp | 13 ++- src/core/core-call.cpp | 8 +- src/core/core-chat-room.cpp | 35 ++++--- src/core/core.cpp | 31 +++--- src/core/core.h | 16 +-- tester/audio_video_conference_tester.c | 10 +- tester/local_chat_imdn_tester.cpp | 18 ++-- tester/local_chat_tester.cpp | 98 +++++++++---------- tester/local_conference_edition_tester.cpp | 26 ++--- tester/local_conference_tester_functions.cpp | 90 ++++++++--------- tester/local_conference_tester_functions.h | 10 +- tester/local_ephemeral_chat_tester.cpp | 20 ++-- tester/local_ice_conference_tester.cpp | 6 +- tester/local_inpromptu_conference_tester.cpp | 40 ++++---- tester/local_scheduled_conference_tester.cpp | 48 ++++----- tester/local_secure_chat_tester.cpp | 8 +- tester/vcard_tester.c | 10 +- 40 files changed, 561 insertions(+), 406 deletions(-) diff --git a/coreapi/conference.cpp b/coreapi/conference.cpp index 94c4ce8998..d113399dd6 100644 --- a/coreapi/conference.cpp +++ b/coreapi/conference.cpp @@ -170,6 +170,75 @@ shared_ptr<AudioDevice> Conference::getOutputAudioDevice() const { return nullptr; } +int Conference::stopRecording() { + AudioControlInterface *aci = getAudioControlInterface(); + if (aci) { + aci->stopRecording(); + } else { + lError() << "LocalConference::stopRecording(): no audio mixer."; + return -1; + } + return 0; +} + +bool Conference::isRecording() const { + AudioControlInterface *aci = getAudioControlInterface(); + if (aci) { + return aci->isRecording(); + } + return false; +} + +bool Conference::getMicrophoneMuted() const { + AudioControlInterface *aci = getAudioControlInterface(); + if (aci) { + return !aci->micEnabled(); + } + lError() << "Unable to get status of microphone because the audio control interface of conference " + << *getConferenceAddress() << " cannot be found"; + return false; +} + +void Conference::setMicrophoneMuted(bool muted) { + AudioControlInterface *aci = getAudioControlInterface(); + if (aci) { + aci->enableMic(!muted); + for (const auto &participant : participants) { + for (const auto &device : participant->getDevices()) { + // If the core is holding a conference (conference server or client holding the conference because it + // has scheduled a conference without having a conference server set), every participant device has a + // media session associated to. In such a scenario all calls are muted one by one. + auto deviceSession = device->getSession(); + if (deviceSession) { + auto op = deviceSession->getPrivate()->getOp(); + shared_ptr<Call> call = op ? getCore()->getCallByCallId(op->getCallId()) : nullptr; + if (call) { + call->setMicrophoneMuted(muted); + } + } + } + } + bool coreMicrophoneEnabled = !!linphone_core_mic_enabled(getCore()->getCCore()); + notifyLocalMutedDevices(muted || !coreMicrophoneEnabled); + } else { + const auto conferenceAddressStr = + (getConferenceAddress() ? getConferenceAddress()->toString() : std::string("<address-not-defined>")); + lError() << "Unable to " << std::string(muted ? "disable" : "enable") + << " microphone because the audio control interface of conference " << conferenceAddressStr + << " cannot be found"; + } +} + +float Conference::getRecordVolume() const { + AudioControlInterface *aci = getAudioControlInterface(); + if (aci) { + return aci->getRecordVolume(); + } + lError() << "Unable to get record volume because the audio control interface of conference " + << *getConferenceAddress() << " cannot be found"; + return 0.0; +} + void Conference::setConferenceAddress(const std::shared_ptr<Address> &conferenceAddress) { if ((getState() == ConferenceInterface::State::Instantiated) || (getState() == ConferenceInterface::State::CreationPending)) { diff --git a/coreapi/conference.h b/coreapi/conference.h index f03047c86a..437f00f5b9 100644 --- a/coreapi/conference.h +++ b/coreapi/conference.h @@ -152,11 +152,6 @@ public: bool isConferenceEnded() const; bool isConferenceStarted() const; - void setInputAudioDevice(const std::shared_ptr<AudioDevice> &audioDevice); - void setOutputAudioDevice(const std::shared_ptr<AudioDevice> &audioDevice); - std::shared_ptr<AudioDevice> getInputAudioDevice() const; - std::shared_ptr<AudioDevice> getOutputAudioDevice() const; - virtual AudioControlInterface *getAudioControlInterface() const = 0; virtual VideoControlInterface *getVideoControlInterface() const = 0; virtual AudioStream *getAudioStream() = 0; /* Used by the tone manager, revisit.*/ @@ -165,9 +160,18 @@ public: return getParticipantCount() + (isIn() ? 1 : 0); } + void setInputAudioDevice(const std::shared_ptr<AudioDevice> &audioDevice); + void setOutputAudioDevice(const std::shared_ptr<AudioDevice> &audioDevice); + std::shared_ptr<AudioDevice> getInputAudioDevice() const; + std::shared_ptr<AudioDevice> getOutputAudioDevice() const; + virtual int startRecording(const char *path) = 0; - virtual int stopRecording() = 0; - virtual bool isRecording() const = 0; + int stopRecording(); + bool isRecording() const; + + bool getMicrophoneMuted() const; + void setMicrophoneMuted(bool muted); + float getRecordVolume() const; void setState(LinphonePrivate::ConferenceInterface::State state) override; void setStateChangedCallback(LinphoneConferenceStateChangedCb cb, void *userData) { diff --git a/coreapi/friend.c b/coreapi/friend.c index a7631bab5c..1b73b77893 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -2193,7 +2193,7 @@ int linphone_friend_get_capabilities(const LinphoneFriend *lf) { if (!presence) continue; capabilities |= linphone_presence_model_get_capabilities(presence); } - bctbx_list_free(phones); + bctbx_list_free_with_data(phones, bctbx_free); return capabilities; } @@ -2226,7 +2226,7 @@ bool_t linphone_friend_has_capability_with_version(const LinphoneFriend *lf, if (!presence) continue; if (linphone_presence_model_has_capability_with_version(presence, capability, version)) result = TRUE; } - bctbx_list_free(phones); + bctbx_list_free_with_data(phones, bctbx_free); return result; } @@ -2255,7 +2255,7 @@ bool_t linphone_friend_has_capability_with_version_or_more(const LinphoneFriend if (!presence) continue; if (linphone_presence_model_has_capability_with_version_or_more(presence, capability, version)) result = TRUE; } - bctbx_list_free(phones); + bctbx_list_free_with_data(phones, bctbx_free); return result; } @@ -2284,7 +2284,7 @@ float linphone_friend_get_capability_version(const LinphoneFriend *lf, const Lin float presence_version = linphone_presence_model_get_capability_version(presence, capability); if (presence_version > version) version = presence_version; } - bctbx_list_free(phones); + bctbx_list_free_with_data(phones, bctbx_free); return version; } diff --git a/coreapi/linphoneconference.c b/coreapi/linphoneconference.c index e5035b04ad..24b977b9f1 100644 --- a/coreapi/linphoneconference.c +++ b/coreapi/linphoneconference.c @@ -257,27 +257,19 @@ int linphone_conference_get_participant_device_volume(LinphoneConference *confer ->getParticipantDeviceVolume(ParticipantDevice::toCpp(device)->getSharedFromThis()); } -int linphone_conference_mute_microphone(LinphoneConference *conference, bool_t val) { +float linphone_conference_get_input_volume(const LinphoneConference *conference) { LinphonePrivate::MediaConference::ConferenceLogContextualizer logContextualizer(conference); - MediaConference::Conference::toCpp(conference)->notifyLocalMutedDevices(val); - AudioControlInterface *aci = MediaConference::Conference::toCpp(conference)->getAudioControlInterface(); - if (!aci) return -1; - aci->enableMic(!val); - return 0; + return MediaConference::Conference::toCpp(conference)->getRecordVolume(); } -bool_t linphone_conference_microphone_is_muted(const LinphoneConference *conference) { +bool_t linphone_conference_get_microphone_muted(const LinphoneConference *conference) { LinphonePrivate::MediaConference::ConferenceLogContextualizer logContextualizer(conference); - AudioControlInterface *aci = MediaConference::Conference::toCpp(conference)->getAudioControlInterface(); - if (!aci) return FALSE; - return aci->micEnabled() ? FALSE : TRUE; + return MediaConference::Conference::toCpp(conference)->getMicrophoneMuted(); } -float linphone_conference_get_input_volume(const LinphoneConference *conference) { +void linphone_conference_set_microphone_muted(LinphoneConference *conference, bool_t muted) { LinphonePrivate::MediaConference::ConferenceLogContextualizer logContextualizer(conference); - AudioControlInterface *aci = MediaConference::Conference::toCpp(conference)->getAudioControlInterface(); - if (!aci) return 0.0; - return aci->getRecordVolume(); + MediaConference::Conference::toCpp(conference)->setMicrophoneMuted(!!muted); } int linphone_conference_get_participant_count(const LinphoneConference *conference) { diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 04a85224c6..753b8c9809 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -6138,14 +6138,6 @@ bool_t linphone_core_echo_limiter_enabled(const LinphoneCore *lc) { return lc->sound_conf.ea; } -void linphone_core_mute_mic(LinphoneCore *lc, bool_t val) { - linphone_core_enable_mic(lc, !val); -} - -bool_t linphone_core_is_mic_muted(LinphoneCore *lc) { - return !linphone_core_mic_enabled(lc); -} - void linphone_core_enable_mic(LinphoneCore *lc, bool_t enable) { CoreLogContextualizer logContextualizer(lc); LinphoneCall *call; @@ -6157,14 +6149,19 @@ void linphone_core_enable_mic(LinphoneCore *lc, bool_t enable) { lc->sound_conf.mic_enabled = enable; /* this is a global switch read everywhere the microphone is used. */ /* apply to conference and calls */ if (linphone_core_is_in_conference(lc)) { - linphone_conference_mute_microphone(lc->conf_ctx, linphone_conference_microphone_is_muted(lc->conf_ctx)); + linphone_conference_set_microphone_muted(lc->conf_ctx, linphone_conference_get_microphone_muted(lc->conf_ctx)); } list = linphone_core_get_calls(lc); for (elem = list; elem != NULL; elem = elem->next) { call = (LinphoneCall *)elem->data; /* re-apply the same setting; we don't modify the call's switch. However the setter will * take action on the stream in order to take into account the core's new switch state.*/ - linphone_call_set_microphone_muted(call, linphone_call_get_microphone_muted(call)); + LinphoneConference *conference = linphone_call_get_conference(call); + if (conference) { + linphone_conference_set_microphone_muted(conference, linphone_conference_get_microphone_muted(conference)); + } else { + linphone_call_set_microphone_muted(call, linphone_call_get_microphone_muted(call)); + } } } @@ -9328,9 +9325,8 @@ LinphoneConference *linphone_core_create_conference_with_params(LinphoneCore *lc if (strcasecmp(conf_method_name, "remote") == 0) { LinphoneAccount *account = linphone_core_get_default_account(lc); if (account) { - const char *uri = linphone_account_params_get_conference_factory_uri( - linphone_account_get_params(linphone_core_get_default_account(lc))); - factory_uri = linphone_address_new(uri); + factory_uri = linphone_address_clone(linphone_account_params_get_conference_factory_address( + linphone_account_get_params(linphone_core_get_default_account(lc)))); char *factory_uri_str = factory_uri ? linphone_address_as_string(factory_uri) : NULL; lInfo() << "Creating remote conference with factory address from default account : " << std::string(factory_uri_str); diff --git a/coreapi/local_conference.cpp b/coreapi/local_conference.cpp index bb9a08b346..6d6ba533f0 100644 --- a/coreapi/local_conference.cpp +++ b/coreapi/local_conference.cpp @@ -1889,25 +1889,6 @@ int LocalConference::startRecording(const char *path) { return 0; } -int LocalConference::stopRecording() { - AudioControlInterface *aci = getAudioControlInterface(); - if (aci) { - aci->stopRecording(); - } else { - lError() << "LocalConference::stopRecording(): no audio mixer."; - return -1; - } - return 0; -} - -bool LocalConference::isRecording() const { - AudioControlInterface *aci = getAudioControlInterface(); - if (aci) { - return aci->isRecording(); - } - return false; -} - bool LocalConference::isIn() const { return mIsIn; } diff --git a/coreapi/local_conference.h b/coreapi/local_conference.h index 5985c90617..2ffe107058 100644 --- a/coreapi/local_conference.h +++ b/coreapi/local_conference.h @@ -75,8 +75,6 @@ public: virtual bool isIn() const override; virtual int startRecording(const char *path) override; - virtual int stopRecording() override; - virtual bool isRecording() const override; virtual void setLocalParticipantStreamCapability(const LinphoneMediaDirection &direction, const LinphoneStreamType type) override; diff --git a/coreapi/proxy.c b/coreapi/proxy.c index f5acc0d842..79eaf4c5cb 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -885,7 +885,7 @@ void linphone_core_remove_account(LinphoneCore *core, LinphoneAccount *account) // Update the associated linphone specs on the core LinphoneAccountParams *params = linphone_account_params_clone(linphone_account_get_params(account)); - linphone_account_params_set_conference_factory_uri(params, NULL); + linphone_account_params_set_conference_factory_address(params, NULL); linphone_account_set_params(account, params); linphone_account_params_unref(params); } diff --git a/coreapi/remote_conference.cpp b/coreapi/remote_conference.cpp index 09d5f72f21..f5e747176e 100644 --- a/coreapi/remote_conference.cpp +++ b/coreapi/remote_conference.cpp @@ -226,25 +226,6 @@ int RemoteConference::startRecording(const char *path) { return 0; } -int RemoteConference::stopRecording() { - auto session = static_pointer_cast<MediaSession>(getMainSession()); - if (session) { - session->stopRecording(); - } else { - lError() << "RemoteConference::stopRecording(): no audio session."; - return -1; - } - return 0; -} - -bool RemoteConference::isRecording() const { - auto session = static_pointer_cast<MediaSession>(getMainSession()); - if (session) { - return session->isRecording(); - } - return false; -} - void RemoteConference::notifyStateChanged(LinphonePrivate::ConferenceInterface::State state) { // Call callbacks before calling listeners because listeners may change state linphone_core_notify_conference_state_changed(getCore()->getCCore(), toC(), (LinphoneConferenceState)getState()); diff --git a/coreapi/remote_conference.h b/coreapi/remote_conference.h index 2f594d26c7..b3d508a0fe 100644 --- a/coreapi/remote_conference.h +++ b/coreapi/remote_conference.h @@ -82,8 +82,6 @@ public: virtual const std::shared_ptr<Address> getOrganizer() const override; virtual int startRecording(const char *path) override; - virtual int stopRecording() override; - virtual bool isRecording() const override; virtual void setLocalParticipantStreamCapability(const LinphoneMediaDirection &direction, const LinphoneStreamType type) override; diff --git a/include/linphone/api/c-account-params.h b/include/linphone/api/c-account-params.h index 195c83938d..9956be6fe5 100644 --- a/include/linphone/api/c-account-params.h +++ b/include/linphone/api/c-account-params.h @@ -110,8 +110,8 @@ LINPHONE_PUBLIC LinphoneStatus linphone_account_params_set_server_address(Linpho * @return 0 if successful, -1 otherwise. * @deprecated 01/03/2021 Use #linphone_account_params_set_server_address() instead. **/ -LINPHONE_PUBLIC LinphoneStatus linphone_account_params_set_server_addr(LinphoneAccountParams *params, - const char *server_address); +LINPHONE_DEPRECATED LINPHONE_PUBLIC LinphoneStatus +linphone_account_params_set_server_addr(LinphoneAccountParams *params, const char *server_address); /** * Sets the user identity as a SIP address. @@ -153,7 +153,8 @@ LINPHONE_PUBLIC void linphone_account_params_set_expires(LinphoneAccountParams * * @param enable If TRUE, registration will be engaged. * @deprecated 16/12/2021 Use linphone_account_params_enable_register() instead. */ -LINPHONE_PUBLIC void linphone_account_params_set_register_enabled(LinphoneAccountParams *params, bool_t enable); +LINPHONE_DEPRECATED LINPHONE_PUBLIC void linphone_account_params_set_register_enabled(LinphoneAccountParams *params, + bool_t enable); /** * Indicates either or not, REGISTRATION must be issued for this #LinphoneAccountParams. @@ -168,7 +169,8 @@ LINPHONE_PUBLIC void linphone_account_params_enable_register(LinphoneAccountPara * @param enable If TRUE, publish will be engaged. * @deprecated 16/12/2021 Use linphone_account_params_enable_publish() instead. */ -LINPHONE_PUBLIC void linphone_account_params_set_publish_enabled(LinphoneAccountParams *params, bool_t enable); +LINPHONE_DEPRECATED LINPHONE_PUBLIC void linphone_account_params_set_publish_enabled(LinphoneAccountParams *params, + bool_t enable); /** * Indicates either or not, PUBLISH must be issued for this #LinphoneAccountParams. @@ -198,7 +200,8 @@ LINPHONE_PUBLIC int linphone_account_params_get_publish_expires(const LinphoneAc * @param enable TRUE to replace + by the international prefix, FALSE otherwise. * @deprecated 16/12/2021 Use linphone_account_params_enable_dial_escape_plus() instead. **/ -LINPHONE_PUBLIC void linphone_account_params_set_dial_escape_plus_enabled(LinphoneAccountParams *params, bool_t enable); +LINPHONE_DEPRECATED LINPHONE_PUBLIC void +linphone_account_params_set_dial_escape_plus_enabled(LinphoneAccountParams *params, bool_t enable); /** * Set whether liblinphone should replace "+" by international calling prefix in dialed numbers (passed to @@ -232,8 +235,8 @@ linphone_account_params_set_use_international_prefix_for_calls_and_chats(Linphon * @param enable TRUE to store quality statistics and send them to the collector, FALSE to disable it. * @deprecated 16/12/2021 Use linphone_account_params_enable_quality_reporting() instead. */ -LINPHONE_PUBLIC void linphone_account_params_set_quality_reporting_enabled(LinphoneAccountParams *params, - bool_t enable); +LINPHONE_DEPRECATED LINPHONE_PUBLIC void +linphone_account_params_set_quality_reporting_enabled(LinphoneAccountParams *params, bool_t enable); /** * Indicates whether quality statistics during call should be stored and sent to a collector according to RFC 6035. @@ -248,7 +251,8 @@ LINPHONE_PUBLIC void linphone_account_params_enable_quality_reporting(LinphoneAc * @return TRUE if quality repotring is enabled, FALSE otherwise. * @deprecated 16/12/2021 Use linphone_account_params_quality_reporting_enabled() instead. */ -LINPHONE_PUBLIC bool_t linphone_account_params_get_quality_reporting_enabled(const LinphoneAccountParams *params); +LINPHONE_DEPRECATED LINPHONE_PUBLIC bool_t +linphone_account_params_get_quality_reporting_enabled(const LinphoneAccountParams *params); /** * Indicates whether quality statistics during call should be stored and sent to a collector according to RFC 6035. @@ -340,7 +344,8 @@ linphone_account_params_get_identity_address(const LinphoneAccountParams *params * @return The SIP identity that belongs to this account params. @maybenil * @deprecated 01/03/2021 Use linphone_account_params_get_identity_address() instead. **/ -LINPHONE_PUBLIC const char *linphone_account_params_get_identity(const LinphoneAccountParams *params); +LINPHONE_DEPRECATED LINPHONE_PUBLIC const char * +linphone_account_params_get_identity(const LinphoneAccountParams *params); /** * Tell if the PUBLISH is enabled. @@ -348,7 +353,8 @@ LINPHONE_PUBLIC const char *linphone_account_params_get_identity(const LinphoneA * @return TRUE if PUBLISH request is enabled for this proxy. * @deprecated 16/12/2021 Use linphone_account_params_publish_enabled() instead. **/ -LINPHONE_PUBLIC bool_t linphone_account_params_get_publish_enabled(const LinphoneAccountParams *params); +LINPHONE_DEPRECATED LINPHONE_PUBLIC bool_t +linphone_account_params_get_publish_enabled(const LinphoneAccountParams *params); /** * Tell if the PUBLISH is enabled. @@ -370,7 +376,8 @@ LINPHONE_PUBLIC const LinphoneAddress *linphone_account_params_get_server_addres * @return The proxy's SIP address. @maybenil * @deprecated 01/03/2021 Use linphone_account_params_get_server_address() instead. **/ -LINPHONE_PUBLIC const char *linphone_account_params_get_server_addr(const LinphoneAccountParams *params); +LINPHONE_DEPRECATED LINPHONE_PUBLIC const char * +linphone_account_params_get_server_addr(const LinphoneAccountParams *params); /** * Get the account params expires. @@ -385,7 +392,8 @@ LINPHONE_PUBLIC int linphone_account_params_get_expires(const LinphoneAccountPar * @return TRUE if registration to the proxy is enabled. * @deprecated 16/12/2021 Use linphone_account_params_register_enabled() instead. **/ -LINPHONE_PUBLIC bool_t linphone_account_params_get_register_enabled(const LinphoneAccountParams *params); +LINPHONE_DEPRECATED LINPHONE_PUBLIC bool_t +linphone_account_params_get_register_enabled(const LinphoneAccountParams *params); /** * Returns whether the account params is enabled or not. @@ -441,7 +449,8 @@ LINPHONE_PUBLIC const char *linphone_account_params_get_contact_uri_parameters(c * @return Whether liblinphone should replace "+" by "00" in dialed numbers (passed to #linphone_core_invite()). * @deprecated 16/12/2021 Use linphone_account_params_dial_escape_plus_enabled() instead. **/ -LINPHONE_PUBLIC bool_t linphone_account_params_get_dial_escape_plus_enabled(const LinphoneAccountParams *params); +LINPHONE_DEPRECATED LINPHONE_PUBLIC bool_t +linphone_account_params_get_dial_escape_plus_enabled(const LinphoneAccountParams *params); /** * Return whether or not the + should be replaced by 00. @@ -591,8 +600,19 @@ LINPHONE_PUBLIC void linphone_account_params_set_nat_policy(LinphoneAccountParam * Set the conference factory uri. * @param params The #LinphoneAccountParams object @notnil * @param uri The uri of the conference factory. @maybenil + * @deprecated 16/08/2023 Use linphone_account_params_set_conference_factory_address() instead. */ -LINPHONE_PUBLIC void linphone_account_params_set_conference_factory_uri(LinphoneAccountParams *params, const char *uri); +LINPHONE_DEPRECATED LINPHONE_PUBLIC void +linphone_account_params_set_conference_factory_uri(LinphoneAccountParams *params, const char *uri); + +/** + * Set the conference factory uri. + * @param params The #LinphoneAccountParams object @notnil + * @param address The #LinphoneAddress to set. @maybenil + * @param uri The uri of the conference factory as a #LinphoneAddress. @maybenil + */ +LINPHONE_PUBLIC void linphone_account_params_set_conference_factory_address(LinphoneAccountParams *params, + const LinphoneAddress *address); /** * Set the audio video conference factory uri. @@ -609,7 +629,8 @@ LINPHONE_PUBLIC void linphone_account_params_set_audio_video_conference_factory_ * @param enable TRUE to enable, FALSE otherwise. * @deprecated 16/12/2021 Use linphone_account_params_enable_outbound_proxy() instead. */ -LINPHONE_PUBLIC void linphone_account_params_set_outbound_proxy_enabled(LinphoneAccountParams *params, bool_t enable); +LINPHONE_DEPRECATED LINPHONE_PUBLIC void +linphone_account_params_set_outbound_proxy_enabled(LinphoneAccountParams *params, bool_t enable); /** * If enabled, the proxy will be used as the only route. @@ -624,7 +645,8 @@ LINPHONE_PUBLIC void linphone_account_params_enable_outbound_proxy(LinphoneAccou * @return enable TRUE if enabled, FALSE otherwise. * @deprecated 16/12/2021 Use linphone_account_params_outbound_proxy_enabled() instead. */ -LINPHONE_PUBLIC bool_t linphone_account_params_get_outbound_proxy_enabled(const LinphoneAccountParams *params); +LINPHONE_DEPRECATED LINPHONE_PUBLIC bool_t +linphone_account_params_get_outbound_proxy_enabled(const LinphoneAccountParams *params); /** * Tell if the proxy is used as the only route. @@ -638,7 +660,16 @@ LINPHONE_PUBLIC bool_t linphone_account_params_outbound_proxy_enabled(const Linp * @param params The #LinphoneAccountParams object @notnil * @return The uri of the conference factory. @maybenil */ -LINPHONE_PUBLIC const char *linphone_account_params_get_conference_factory_uri(const LinphoneAccountParams *params); +LINPHONE_DEPRECATED LINPHONE_PUBLIC const char * +linphone_account_params_get_conference_factory_uri(const LinphoneAccountParams *params); + +/** + * Get the conference factory uri. + * @param params The #LinphoneAccountParams object @notnil + * @return The #LinphoneAddress of the conference factory. @maybenil + */ +LINPHONE_PUBLIC const LinphoneAddress * +linphone_account_params_get_conference_factory_address(const LinphoneAccountParams *params); /** * Get the audio video conference factory uri. diff --git a/include/linphone/api/c-call.h b/include/linphone/api/c-call.h index aaac8119bb..1b3b7a5f36 100644 --- a/include/linphone/api/c-call.h +++ b/include/linphone/api/c-call.h @@ -747,6 +747,9 @@ LINPHONE_PUBLIC void linphone_call_set_speaker_muted(LinphoneCall *call, bool_t * linphone_core_enable_mic(). * @param call The #LinphoneCall object. @notnil * @return The microphone muted state. + * @warning This method returns state of the mute capability of the call passed as argument. If this call is part of a + *conference, it is strongly recommended to call linphone_conference_get_microphone_muted() to know whether this device + *is muted or not. **/ LINPHONE_PUBLIC bool_t linphone_call_get_microphone_muted(const LinphoneCall *call); @@ -756,6 +759,9 @@ LINPHONE_PUBLIC bool_t linphone_call_get_microphone_muted(const LinphoneCall *ca * linphone_core_enable_mic(). * @param call The #LinphoneCall object. @notnil * @param muted The microphone muted state. + * @warning This method only mutes the call passed as argument. If this call is part of a conference, it is strongly + *recommended to call linphone_conference_set_microphone_muted() to ensure that the setting is correctly apply across + *all participants and the conference callbacks are called. **/ LINPHONE_PUBLIC void linphone_call_set_microphone_muted(LinphoneCall *call, bool_t muted); diff --git a/include/linphone/conference.h b/include/linphone/conference.h index 2ccc0d8e56..9526d9b39f 100644 --- a/include/linphone/conference.h +++ b/include/linphone/conference.h @@ -671,6 +671,31 @@ LINPHONE_PUBLIC bool_t linphone_conference_is_recording(const LinphoneConference */ LINPHONE_PUBLIC LinphoneCall *linphone_conference_get_call(const LinphoneConference *conference); +/** + * Retrieves the volume of a specific participant + * @param conference A #LinphoneConference object @notnil + * @param device The Participant @notnil + * @return The volume of the participant expressed in dbm0. + */ +LINPHONE_PUBLIC bool_t linphone_conference_get_microphone_muted(const LinphoneConference *conference); + +/** + * Get microphone muted state. + * Note that the microphone may be disabled globally if FALSE was given to + * linphone_core_enable_mic(). + * @param conference A #LinphoneConference object @notnil + * @return The microphone muted state. + **/ +LINPHONE_PUBLIC void linphone_conference_set_microphone_muted(LinphoneConference *conference, bool_t muted); + +/** + * Retrieves the volume of a specific participant + * @param conference A #LinphoneConference object @notnil + * @param device The Participant @notnil + * @return The volume of the participant expressed in dbm0. + */ +LINPHONE_PUBLIC float linphone_conference_get_input_volume(const LinphoneConference *conference); + /************ */ /* DEPRECATED */ /* ********** */ @@ -705,10 +730,6 @@ LinphoneConference *linphone_remote_conference_new_with_params(LinphoneCore *cor /* This is actually only used by the ToneManager. TODO: encapsulate this better. */ AudioStream *linphone_conference_get_audio_stream(LinphoneConference *conference); -LINPHONE_PUBLIC int linphone_conference_mute_microphone(LinphoneConference *conference, bool_t val); -LINPHONE_PUBLIC bool_t linphone_conference_microphone_is_muted(const LinphoneConference *conference); -float linphone_conference_get_input_volume(const LinphoneConference *conference); - void linphone_conference_on_call_terminating(LinphoneConference *conference, LinphoneCall *call); LINPHONE_PUBLIC bool_t linphone_conference_check_class(LinphoneConference *conference, LinphoneConferenceClass _class); diff --git a/include/linphone/core.h b/include/linphone/core.h index 6f0d74c38d..ea26994ce4 100644 --- a/include/linphone/core.h +++ b/include/linphone/core.h @@ -8059,18 +8059,18 @@ LINPHONE_DEPRECATED char linphone_core_get_sound_source(LinphoneCore *core); LINPHONE_DEPRECATED void linphone_core_set_sound_source(LinphoneCore *core, char source); -/** - * @deprecated 09/10/2013 Use #linphone_core_enable_mic() instead. - * @donotwrap - **/ -LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_core_mute_mic(LinphoneCore *core, bool_t muted); - -/** - * Get mic state. - * @deprecated 05/06/2014 Use #linphone_core_mic_enabled() instead - * @donotwrap +/* + * Get the list of call logs (past calls) that matches the given #LinphoneAddress. + * At the contrary of linphone_core_get_call_logs, it is your responsibility to unref the logs and free this list once + *you are done using it. Requires ENABLE_DB_STORAGE to work. + * @param core #LinphoneCore object @notnil + * @param address #LinphoneAddress object @notnil + * @return A list of #LinphoneCallLog. \bctbx_list{LinphoneCallLog} @tobefreed @maybenil + * @deprecated 29/10/2018 Use #linphone_core_get_call_history_2() instead. + * @ingroup call_logs **/ -LINPHONE_PUBLIC LINPHONE_DEPRECATED bool_t linphone_core_is_mic_muted(LinphoneCore *core); +LINPHONE_PUBLIC LINPHONE_DEPRECATED bctbx_list_t * +linphone_core_get_call_history_for_address(LinphoneCore *core, const LinphoneAddress *address); /** * Enables video globally. diff --git a/src/account/account-params.cpp b/src/account/account-params.cpp index fe213e0a3f..1221b11bec 100644 --- a/src/account/account-params.cpp +++ b/src/account/account-params.cpp @@ -250,8 +250,8 @@ AccountParams::AccountParams(LinphoneCore *lc, int index) : AccountParams(nullpt mNatPolicy = NatPolicy::toCpp(natPolicy)->toSharedPtr(); } - mConferenceFactoryUri = - linphone_config_get_string(config, key, "conference_factory_uri", mConferenceFactoryUri.c_str()); + setConferenceFactoryUri(L_C_TO_STRING(linphone_config_get_string(config, key, "conference_factory_uri", ""))); + string audioVideoConferenceFactoryUri = linphone_config_get_string(config, key, "audio_video_conference_factory_uri", ""); mAudioVideoConferenceFactoryAddress = nullptr; @@ -264,6 +264,7 @@ AccountParams::AccountParams(LinphoneCore *lc, int index) : AccountParams(nullpt setCustomContact(linphone_config_get_string(config, key, "custom_contact", "")); setLimeServerUrl(linphone_config_get_string(config, key, "lime_server_url", mLimeServerUrl.c_str())); + setPictureUri(linphone_config_get_string(config, key, "picture_uri", mPictureUri.c_str())); readCustomParamsFromConfigFile(config, key); @@ -296,7 +297,13 @@ AccountParams::AccountParams(const AccountParams &other) : HybridObject(other), mRefKey = other.mRefKey; mDependsOn = other.mDependsOn; mIdKey = other.mIdKey; - mConferenceFactoryUri = other.mConferenceFactoryUri; + + if (other.mConferenceFactoryAddress) { + mConferenceFactoryAddress = other.mConferenceFactoryAddress->clone()->toSharedPtr(); + } else { + mConferenceFactoryAddress = nullptr; + } + if (other.mAudioVideoConferenceFactoryAddress) { mAudioVideoConferenceFactoryAddress = other.mAudioVideoConferenceFactoryAddress->clone()->toSharedPtr(); } else { @@ -469,7 +476,26 @@ void AccountParams::setIdKey(const std::string &idKey) { } void AccountParams::setConferenceFactoryUri(const std::string &conferenceFactoryUri) { - mConferenceFactoryUri = conferenceFactoryUri; + setConferenceFactoryAddress(conferenceFactoryUri.empty() ? nullptr : Address::create(conferenceFactoryUri)); +} + +void AccountParams::setConferenceFactoryAddress(const std::shared_ptr<const Address> conferenceFactoryAddress) { + if (mConferenceFactoryAddress != nullptr) { + mConferenceFactoryAddress = nullptr; + } + if (conferenceFactoryAddress != nullptr) { + mConferenceFactoryAddress = conferenceFactoryAddress->clone()->toSharedPtr(); + } +} + +void AccountParams::setAudioVideoConferenceFactoryAddress( + const std::shared_ptr<const Address> audioVideoConferenceFactoryAddress) { + if (mAudioVideoConferenceFactoryAddress != nullptr) { + mAudioVideoConferenceFactoryAddress = nullptr; + } + if (audioVideoConferenceFactoryAddress != nullptr) { + mAudioVideoConferenceFactoryAddress = audioVideoConferenceFactoryAddress->clone()->toSharedPtr(); + } } void AccountParams::setFileTranferServer(const std::string &fileTransferServer) { @@ -541,16 +567,6 @@ void AccountParams::setPushNotificationConfig(PushNotificationConfig *pushNotifi mPushNotificationConfig->ref(); } -void AccountParams::setAudioVideoConferenceFactoryAddress( - const std::shared_ptr<const Address> audioVideoConferenceFactoryAddress) { - if (mAudioVideoConferenceFactoryAddress != nullptr) { - mAudioVideoConferenceFactoryAddress = nullptr; - } - if (audioVideoConferenceFactoryAddress != nullptr) { - mAudioVideoConferenceFactoryAddress = audioVideoConferenceFactoryAddress->clone()->toSharedPtr(); - } -} - void AccountParams::enableRtpBundle(bool value) { mRtpBundleEnabled = value; } @@ -693,8 +709,23 @@ const std::string &AccountParams::getIdKey() const { return mIdKey; } -const std::string &AccountParams::getConferenceFactoryUri() const { - return mConferenceFactoryUri; +const char *AccountParams::getConferenceFactoryCstr() const { + if (mConferenceFactoryAddressCstr) { + ms_free(mConferenceFactoryAddressCstr); + mConferenceFactoryAddressCstr = nullptr; + } + if (mConferenceFactoryAddress) { + mConferenceFactoryAddressCstr = mConferenceFactoryAddress->asStringUriOnlyCstr(); + } + return mConferenceFactoryAddressCstr; +} + +const std::shared_ptr<Address> &AccountParams::getConferenceFactoryAddress() const { + return mConferenceFactoryAddress; +} + +const std::shared_ptr<Address> &AccountParams::getAudioVideoConferenceFactoryAddress() const { + return mAudioVideoConferenceFactoryAddress; } const std::string &AccountParams::getFileTransferServer() const { @@ -752,10 +783,6 @@ PushNotificationConfig *AccountParams::getPushNotificationConfig() const { return mPushNotificationConfig; } -const std::shared_ptr<Address> &AccountParams::getAudioVideoConferenceFactoryAddress() const { - return mAudioVideoConferenceFactoryAddress; -} - bool AccountParams::rtpBundleEnabled() const { return mRtpBundleEnabled; } @@ -915,7 +942,9 @@ void AccountParams::writeToConfigFile(LinphoneConfig *config, int index) { linphone_config_set_string(config, key, "nat_policy_ref", mNatPolicy->getRef().c_str()); } - linphone_config_set_string(config, key, "conference_factory_uri", mConferenceFactoryUri.c_str()); + if (mConferenceFactoryAddress != nullptr) { + linphone_config_set_string(config, key, "conference_factory_uri", getConferenceFactoryCstr()); + } if (mAudioVideoConferenceFactoryAddress != nullptr) { char *factory_address = mAudioVideoConferenceFactoryAddress->asStringUriOnlyCstr(); diff --git a/src/account/account-params.h b/src/account/account-params.h index ef00a096d2..9a35d2d827 100644 --- a/src/account/account-params.h +++ b/src/account/account-params.h @@ -71,6 +71,8 @@ public: void setDependsOn(const std::string &dependsOn); void setIdKey(const std::string &idKey); void setConferenceFactoryUri(const std::string &conferenceFactoryUri); + void setConferenceFactoryAddress(const std::shared_ptr<const Address> factoryAddress); + void setAudioVideoConferenceFactoryAddress(const std::shared_ptr<const Address> audioVideoConferenceFactoryAddress); void setFileTranferServer(const std::string &fileTransferServer); void setPrivacy(LinphonePrivacyMask privacy); void setAvpfMode(LinphoneAVPFMode avpfMode); @@ -79,7 +81,6 @@ public: LinphoneStatus setIdentityAddress(const std::shared_ptr<Address> identityAddress); LinphoneStatus setRoutes(const std::list<std::shared_ptr<Address>> &routes); LinphoneStatus setRoutesFromStringList(const bctbx_list_t *routes); - void setAudioVideoConferenceFactoryAddress(const std::shared_ptr<const Address> audioVideoConferenceFactoryAddress); void enableRtpBundle(bool value); void enableRtpBundleAssumption(bool value); void setCustomContact(const std::shared_ptr<Address> contact); @@ -112,10 +113,12 @@ public: const std::string &getRefKey() const; const std::string &getDependsOn() const; const std::string &getIdKey() const; - const std::string &getConferenceFactoryUri() const; + const std::shared_ptr<Address> &getConferenceFactoryAddress() const; + const std::shared_ptr<Address> &getAudioVideoConferenceFactoryAddress() const; const std::string &getFileTransferServer() const; const std::string &getIdentity() const; const char *getDomainCstr() const; + const char *getConferenceFactoryCstr() const; const std::string getDomain() const; const std::list<std::shared_ptr<Address>> &getRoutes() const; const std::list<std::string> getRoutesString() const; @@ -125,7 +128,6 @@ public: LinphoneAVPFMode getAvpfMode() const; std::shared_ptr<NatPolicy> getNatPolicy() const; PushNotificationConfig *getPushNotificationConfig() const; - const std::shared_ptr<Address> &getAudioVideoConferenceFactoryAddress() const; bool rtpBundleEnabled() const; bool rtpBundleAssumptionEnabled() const; const std::shared_ptr<Address> &getCustomContact() const; @@ -168,6 +170,8 @@ private: void *mUserData; + mutable char *mConferenceFactoryAddressCstr = nullptr; + std::string mInternationalPrefix; std::string mProxy; std::string mRealm; @@ -177,7 +181,6 @@ private: std::string mRefKey; std::string mDependsOn; std::string mIdKey; - std::string mConferenceFactoryUri; std::string mFileTransferServer; std::string mLimeServerUrl; std::string mIdentity; @@ -197,6 +200,7 @@ private: PushNotificationConfig *mPushNotificationConfig; + std::shared_ptr<Address> mConferenceFactoryAddress = nullptr; std::shared_ptr<Address> mAudioVideoConferenceFactoryAddress = nullptr; std::shared_ptr<Address> mCustomContact = nullptr; }; diff --git a/src/account/account.cpp b/src/account/account.cpp index 787407e5c9..126e0feed0 100644 --- a/src/account/account.cpp +++ b/src/account/account.cpp @@ -206,16 +206,21 @@ void Account::applyParamsChanges() { if (mOldParams == nullptr || mOldParams->mInternationalPrefix != mParams->mInternationalPrefix) onInternationalPrefixChanged(); - if (mOldParams == nullptr || mOldParams->mConferenceFactoryUri != mParams->mConferenceFactoryUri) - onConferenceFactoryUriChanged(mParams->mConferenceFactoryUri); + if (mOldParams == nullptr || + ((mOldParams->mConferenceFactoryAddress != nullptr) ^ (mParams->mConferenceFactoryAddress != nullptr)) || + ((mOldParams->mConferenceFactoryAddress != nullptr) && (mParams->mConferenceFactoryAddress != nullptr) && + (*mOldParams->mConferenceFactoryAddress == *mParams->mConferenceFactoryAddress))) { + onConferenceFactoryAddressChanged(mParams->mConferenceFactoryAddress); + } if (mOldParams == nullptr || ((mOldParams->mAudioVideoConferenceFactoryAddress != nullptr) ^ (mParams->mAudioVideoConferenceFactoryAddress != nullptr)) || ((mOldParams->mAudioVideoConferenceFactoryAddress != nullptr) && (mParams->mAudioVideoConferenceFactoryAddress != nullptr) && - (*mOldParams->mAudioVideoConferenceFactoryAddress == *mParams->mAudioVideoConferenceFactoryAddress))) + (*mOldParams->mAudioVideoConferenceFactoryAddress == *mParams->mAudioVideoConferenceFactoryAddress))) { onAudioVideoConferenceFactoryAddressChanged(mParams->mAudioVideoConferenceFactoryAddress); + } if (mOldParams == nullptr || mOldParams->mNatPolicy != mParams->mNatPolicy) if (mParams->mNatPolicy != nullptr) onNatPolicyChanged(mParams->mNatPolicy); @@ -1126,10 +1131,16 @@ int Account::sendPublish() { } bool Account::check() { - if (mParams->mProxy.empty()) return false; - if (mParams->mIdentityAddress == NULL) return false; + if (mParams->mProxy.empty()) { + lWarning() << "No proxy given for account " << this; + return false; + } + if (mParams->mIdentityAddress == NULL) { + lWarning() << "Identity address of account " << this << " has not been set"; + return false; + } resolveDependencies(); - return TRUE; + return true; } void Account::releaseOps() { @@ -1202,10 +1213,9 @@ void Account::onInternationalPrefixChanged() { } } -void Account::onConferenceFactoryUriChanged(const std::string &conferenceFactoryUri) { +void Account::onConferenceFactoryAddressChanged(const std::shared_ptr<Address> &conferenceFactoryAddress) { auto core = getCCore(); if (!core) return; - std::string conferenceSpec("conference/"); conferenceSpec.append(Core::conferenceVersionAsString()); std::string groupchatSpec("groupchat/"); @@ -1213,7 +1223,7 @@ void Account::onConferenceFactoryUriChanged(const std::string &conferenceFactory std::string ephemeralSpec("ephemeral/"); ephemeralSpec.append(Core::ephemeralVersionAsString()); - if (!conferenceFactoryUri.empty()) { + if (conferenceFactoryAddress && conferenceFactoryAddress->isValid()) { linphone_core_add_linphone_spec(core, L_STRING_TO_C(conferenceSpec)); linphone_core_add_linphone_spec(core, L_STRING_TO_C(groupchatSpec)); linphone_core_add_linphone_spec(core, L_STRING_TO_C(ephemeralSpec)); @@ -1223,9 +1233,9 @@ void Account::onConferenceFactoryUriChanged(const std::string &conferenceFactory // Check that no other account needs the specs before removing it for (bctbx_list_t *it = core->sip_conf.accounts; it; it = it->next) { if (it->data != this->toC()) { - const char *confUri = linphone_account_params_get_conference_factory_uri( + const auto confUri = linphone_account_params_get_conference_factory_address( linphone_account_get_params((LinphoneAccount *)it->data)); - if (confUri && strlen(confUri)) { + if (confUri) { remove = false; removeAudioVideoConfAddress = false; break; @@ -1263,11 +1273,11 @@ void Account::onAudioVideoConferenceFactoryAddressChanged( // Check that no other account needs the specs before removing it for (bctbx_list_t *it = core->sip_conf.accounts; it; it = it->next) { if (it->data != this->toC()) { - const char *confUri = linphone_account_params_get_conference_factory_uri( + const auto confUri = linphone_account_params_get_conference_factory_address( linphone_account_get_params((LinphoneAccount *)it->data)); const auto audioVideoConfUri = linphone_account_params_get_audio_video_conference_factory_address( linphone_account_get_params((LinphoneAccount *)it->data)); - if ((confUri && strlen(confUri)) || audioVideoConfUri) { + if (confUri || audioVideoConfUri) { remove = false; break; } diff --git a/src/account/account.h b/src/account/account.h index d359c9dcee..b50971cbe4 100644 --- a/src/account/account.h +++ b/src/account/account.h @@ -153,7 +153,7 @@ private: std::shared_ptr<Address> guessContactForRegister(); void onInternationalPrefixChanged(); - void onConferenceFactoryUriChanged(const std::string &conferenceFactoryUri); + void onConferenceFactoryAddressChanged(const std::shared_ptr<Address> &conferenceFactoryAddress); void onAudioVideoConferenceFactoryAddressChanged(const std::shared_ptr<Address> &audioVideoConferenceFactoryAddress); void onNatPolicyChanged(const std::shared_ptr<NatPolicy> &policy); diff --git a/src/c-wrapper/api/c-account-params.cpp b/src/c-wrapper/api/c-account-params.cpp index 62f3ad9a08..a087521971 100644 --- a/src/c-wrapper/api/c-account-params.cpp +++ b/src/c-wrapper/api/c-account-params.cpp @@ -315,12 +315,23 @@ void linphone_account_params_set_conference_factory_uri(LinphoneAccountParams *p } const char *linphone_account_params_get_conference_factory_uri(const LinphoneAccountParams *params) { - return L_STRING_TO_C(AccountParams::toCpp(params)->getConferenceFactoryUri()); + return AccountParams::toCpp(params)->getConferenceFactoryCstr(); } +void linphone_account_params_set_conference_factory_address(LinphoneAccountParams *params, + const LinphoneAddress *address) { + AccountParams::toCpp(params)->setConferenceFactoryAddress(address ? Address::toCpp(address)->getSharedFromThis() + : nullptr); +} + +const LinphoneAddress *linphone_account_params_get_conference_factory_address(const LinphoneAccountParams *params) { + const auto &address = AccountParams::toCpp(params)->getConferenceFactoryAddress(); + return address != nullptr ? address->toC() : nullptr; +} void linphone_account_params_set_audio_video_conference_factory_address(LinphoneAccountParams *params, const LinphoneAddress *address) { - AccountParams::toCpp(params)->setAudioVideoConferenceFactoryAddress(Address::toCpp(address)->getSharedFromThis()); + AccountParams::toCpp(params)->setAudioVideoConferenceFactoryAddress( + address ? Address::toCpp(address)->getSharedFromThis() : nullptr); } const LinphoneAddress * diff --git a/src/call/call.cpp b/src/call/call.cpp index b4ee2e5b48..f309344f00 100644 --- a/src/call/call.cpp +++ b/src/call/call.cpp @@ -170,9 +170,6 @@ bool Call::getMicrophoneMuted() const { void Call::setMicrophoneMuted(bool muted) { static_pointer_cast<MediaSession>(getActiveSession())->getPrivate()->setMicrophoneMuted(muted); - if (getConference()) { - getConference()->notifyLocalMutedDevices(muted || !linphone_core_mic_enabled(getCore()->getCCore())); - } } LinphoneCallStats *Call::getPrivateStats(LinphoneStreamType type) const { diff --git a/src/chat/chat-room/client-group-chat-room-p.h b/src/chat/chat-room/client-group-chat-room-p.h index 1fd9af20a1..8f7edbb839 100644 --- a/src/chat/chat-room/client-group-chat-room-p.h +++ b/src/chat/chat-room/client-group-chat-room-p.h @@ -41,7 +41,7 @@ public: virtual ~ClientGroupChatRoomPrivate() = default; std::list<std::shared_ptr<Address>> cleanAddressesList(const std::list<std::shared_ptr<Address>> &addresses) const; - std::shared_ptr<CallSession> createSessionTo(std::shared_ptr<Address> sessionTo); + std::shared_ptr<CallSession> createSessionTo(const std::shared_ptr<Address> &sessionTo); std::shared_ptr<CallSession> createSession(); void multipartNotifyReceived(const std::shared_ptr<Event> ¬ifyLev, const Content &content); void notifyReceived(const std::shared_ptr<Event> ¬ifyLev, const Content &content); diff --git a/src/chat/chat-room/client-group-chat-room.cpp b/src/chat/chat-room/client-group-chat-room.cpp index f3a6995d1f..2258b25b7d 100644 --- a/src/chat/chat-room/client-group-chat-room.cpp +++ b/src/chat/chat-room/client-group-chat-room.cpp @@ -70,7 +70,7 @@ ClientGroupChatRoomPrivate::cleanAddressesList(const list<std::shared_ptr<Addres return cleanedList; } -shared_ptr<CallSession> ClientGroupChatRoomPrivate::createSessionTo(std::shared_ptr<Address> sessionTo) { +shared_ptr<CallSession> ClientGroupChatRoomPrivate::createSessionTo(const std::shared_ptr<Address> &sessionTo) { L_Q(); CallSessionParams csp; @@ -872,8 +872,8 @@ void ClientGroupChatRoom::exhume() { content.setContentEncoding("deflate"); } - string conferenceFactoryUri = Core::getConferenceFactoryUri(getCore(), getConferenceId().getLocalAddress()); - std::shared_ptr<Address> conferenceFactoryAddress = Address::create(conferenceFactoryUri); + const auto &conferenceFactoryAddress = + Core::getConferenceFactoryAddress(getCore(), getConferenceId().getLocalAddress()); auto session = d->createSessionTo(conferenceFactoryAddress); session->startInvite(nullptr, getUtf8Subject(), &content); setState(ConferenceInterface::State::CreationPending); diff --git a/src/conference/handlers/remote-conference-list-event-handler.cpp b/src/conference/handlers/remote-conference-list-event-handler.cpp index a6f6d40bf6..e2d48333df 100644 --- a/src/conference/handlers/remote-conference-list-event-handler.cpp +++ b/src/conference/handlers/remote-conference-list-event-handler.cpp @@ -121,16 +121,15 @@ void RemoteConferenceListEventHandler::subscribe(const shared_ptr<Account> &acco if (account->getState() != LinphoneRegistrationOk) return; - const auto &factoryUri = accountParams->getConferenceFactoryUri(); - if (factoryUri.empty()) { - lError() << "Couldn't send chat room list subscription for account " << account << " (" << identityAddress + const auto &factoryUri = accountParams->getConferenceFactoryAddress(); + if (!factoryUri || !factoryUri->isValid()) { + lError() << "Couldn't send chat room list subscription for account " << account << " (" << *identityAddress << ") because there's no conference factory uri"; return; } - auto rlsAddr = Address::create(factoryUri); auto evSub = dynamic_pointer_cast<EventSubscribe>( - (new EventSubscribe(getCore(), rlsAddr, "conference", 600))->toSharedPtr()); + (new EventSubscribe(getCore(), factoryUri, "conference", 600))->toSharedPtr()); std::string from = account->getContactAddress()->toString(); evSub->getOp()->setFrom(from); evSub->setInternal(true); @@ -267,6 +266,9 @@ void RemoteConferenceListEventHandler::addHandler(RemoteConferenceEventHandler * } if (!isHandlerInSameDomainAsCore(conferenceId)) { + lWarning() << "The chatroom with conference id " << conferenceId + << " is not in the same domain as the conference factory of the account is linked to hence not " + "adding to the list of subscribes"; return; } @@ -281,14 +283,17 @@ void RemoteConferenceListEventHandler::addHandler(RemoteConferenceEventHandler * bool RemoteConferenceListEventHandler::isHandlerInSameDomainAsCore(const ConferenceId &conferenceId) const { // Ensure that conference and conference factory are in the same domain const std::shared_ptr<Address> &localAddress = conferenceId.getLocalAddress(); - const std::shared_ptr<Address> &peerAddress = conferenceId.getPeerAddress(); - std::shared_ptr<Address> conferenceFactoryUri = - Address::create(Core::getConferenceFactoryUri(getCore(), localAddress)); + const auto conferenceFactoryUri = Core::getConferenceFactoryAddress(getCore(), localAddress); + if (!conferenceFactoryUri) { + lWarning() << "Account with local address " << *localAddress << " hasn't a conference factory URI defined"; + return false; + } + + const std::shared_ptr<Address> &peerAddress = conferenceId.getPeerAddress(); if (peerAddress->getDomain() != conferenceFactoryUri->getDomain()) { - lWarning() << "Peer address " << peerAddress->toString() - << " is not in the same domain as the conference factory URI " << conferenceFactoryUri->toString() - << " hence not adding to the list of subscribes"; + lWarning() << "Peer address " << *peerAddress << " is not in the same domain as the conference factory URI " + << *conferenceFactoryUri; return false; } @@ -303,6 +308,9 @@ void RemoteConferenceListEventHandler::removeHandler(RemoteConferenceEventHandle } if (!isHandlerInSameDomainAsCore(conferenceId)) { + lWarning() << "The chatroom with conference id " << conferenceId + << " is not in the same domain as the conference factory of the account is linked to hence no need " + "to remove it from the list of subscribes"; return; } diff --git a/src/conference/session/audio-mixer.cpp b/src/conference/session/audio-mixer.cpp index 3107c3fcaa..86f26db58f 100644 --- a/src/conference/session/audio-mixer.cpp +++ b/src/conference/session/audio-mixer.cpp @@ -150,9 +150,16 @@ void MS2AudioMixer::setRecordPath(const std::string &path) { void MS2AudioMixer::enableMic(bool value) { mLocalMicEnabled = value; - if (mLocalEndpoint) - ms_audio_conference_mute_member(mConference, mLocalEndpoint, - !(value && linphone_core_mic_enabled(mSession.getCore().getCCore()))); + if (mLocalEndpoint) { + bool coreMicrophoneEnabled = !!linphone_core_mic_enabled(mSession.getCore().getCCore()); + if (!coreMicrophoneEnabled) { + lWarning() << "Microphone of the local participant of conference will be muted because the microphone is disabled in the core settings"; + } + bool enabled = (value && coreMicrophoneEnabled); + bctbx_message("AudioMixer[%p]: mic of local participnt is [%s].", this, enabled ? "enabled" : "disabled"); + + ms_audio_conference_mute_member(mConference, mLocalEndpoint, !enabled); + } } bool MS2AudioMixer::micEnabled() const { diff --git a/src/core/core-call.cpp b/src/core/core-call.cpp index fe16054507..f7349188ae 100644 --- a/src/core/core-call.cpp +++ b/src/core/core-call.cpp @@ -363,10 +363,10 @@ void Core::reportConferenceCallEvent(EventLog::Type type, LinphoneAccount *account = linphone_core_lookup_known_account(getCCore(), to->toC()); std::shared_ptr<Address> from = callLog->getFromAddress() ? callLog->getFromAddress() : nullptr; if (account) { - string conferenceFactoryUri = Account::toCpp(account)->getAccountParams()->getConferenceFactoryUri(); - if (!conferenceFactoryUri.empty()) { - std::shared_ptr<Address> conferenceFactory = Address::create(conferenceFactoryUri); - if (to->weakEqual(*conferenceFactory)) { + const auto &conferenceFactoryUri = + Account::toCpp(account)->getAccountParams()->getConferenceFactoryAddress(); + if (conferenceFactoryUri && conferenceFactoryUri->isValid()) { + if (to->weakEqual(*conferenceFactoryUri)) { return; } } diff --git a/src/core/core-chat-room.cpp b/src/core/core-chat-room.cpp index bcf9f0ec7e..b1a02e01da 100644 --- a/src/core/core-chat-room.cpp +++ b/src/core/core-chat-room.cpp @@ -196,8 +196,7 @@ CorePrivate::createClientGroupChatRoom(const string &subject, bool fallback, boo L_Q(); auto defaultLocalAddress = getDefaultLocalAddress(nullptr, true); - std::shared_ptr<Address> conferenceFactoryUri = - Address::create(Core::getConferenceFactoryUri(q->getSharedFromThis(), defaultLocalAddress)); + const auto &conferenceFactoryUri = Core::getConferenceFactoryAddress(q->getSharedFromThis(), defaultLocalAddress); shared_ptr<ChatRoomParams> params = ChatRoomParams::create(subject, encrypted, !fallback, ChatRoomParams::ChatRoomBackend::FlexisipChat); @@ -212,7 +211,8 @@ shared_ptr<AbstractChatRoom> CorePrivate::createBasicChatRoom(const ConferenceId shared_ptr<AbstractChatRoom> chatRoom; BasicChatRoom *basicChatRoom = new BasicChatRoom(q->getSharedFromThis(), conferenceId, params); - string conferenceFactoryUri = Core::getConferenceFactoryUri(q->getSharedFromThis(), conferenceId.getLocalAddress()); + const auto &conferenceFactoryUri = + Core::getConferenceFactoryAddress(q->getSharedFromThis(), conferenceId.getLocalAddress()); if (basicToFlexisipChatroomMigrationEnabled()) { capabilities.set(ChatRoom::Capabilities::Migratable); } else { @@ -220,7 +220,8 @@ shared_ptr<AbstractChatRoom> CorePrivate::createBasicChatRoom(const ConferenceId } #ifdef HAVE_ADVANCED_IM - if ((capabilities & ChatRoom::Capabilities::Migratable) && !conferenceFactoryUri.empty()) { + if ((capabilities & ChatRoom::Capabilities::Migratable) && conferenceFactoryUri && + conferenceFactoryUri->isValid()) { chatRoom.reset(new BasicToClientGroupChatRoom(shared_ptr<BasicChatRoom>(basicChatRoom))); } else { #endif @@ -316,8 +317,8 @@ shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const shared_ptr<ChatRo shared_ptr<AbstractChatRoom> chatRoom; if (params->getChatRoomBackend() == ChatRoomParams::ChatRoomBackend::FlexisipChat) { #ifdef HAVE_ADVANCED_IM - string conferenceFactoryUri = Core::getConferenceFactoryUri(q->getSharedFromThis(), localAddr); - if (conferenceFactoryUri.empty()) { + const auto &conferenceFactoryUri = Core::getConferenceFactoryAddress(q->getSharedFromThis(), localAddr); + if (!conferenceFactoryUri || !conferenceFactoryUri->isValid()) { lWarning() << "Not creating group chat room: no conference factory uri for local address [" << localAddr << "]"; return nullptr; @@ -344,8 +345,7 @@ shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const shared_ptr<ChatRo } } - std::shared_ptr<Address> conferenceFactory = Address::create(conferenceFactoryUri); - chatRoom = createClientGroupChatRoom(params->getSubject(), conferenceFactory, conferenceId, Content(), + chatRoom = createClientGroupChatRoom(params->getSubject(), conferenceFactoryUri, conferenceId, Content(), ChatRoomParams::toCapabilities(params), params, false); if (!chatRoom) { @@ -651,23 +651,26 @@ static bool compare_chat_room(const shared_ptr<AbstractChatRoom> &first, const s return first->getLastUpdateTime() > second->getLastUpdateTime(); } -string Core::getConferenceFactoryUri(const shared_ptr<Core> &core, const std::shared_ptr<const Address> &localAddress) { - LinphoneAccount *account = linphone_core_lookup_account_by_identity(core->getCCore(), localAddress->toC()); +const std::shared_ptr<Address> Core::getConferenceFactoryAddress(const shared_ptr<Core> &core, + const std::shared_ptr<const Address> &localAddress) { + LinphoneAccount *account = + linphone_core_lookup_account_by_identity(core->getCCore(), localAddress ? localAddress->toC() : nullptr); if (!account) { lWarning() << "No account found for local address: [" << localAddress->toString() << "]"; - return string(); - } else return getConferenceFactoryUri(core, account); + return nullptr; + } else return getConferenceFactoryAddress(core, Account::toCpp(account)->getSharedFromThis()); } -string Core::getConferenceFactoryUri(BCTBX_UNUSED(const shared_ptr<Core> &core), const LinphoneAccount *account) { - const LinphoneAccountParams *params = linphone_account_get_params(account); +const std::shared_ptr<Address> Core::getConferenceFactoryAddress(BCTBX_UNUSED(const shared_ptr<Core> &core), + const std::shared_ptr<Account> account) { + const auto ¶ms = account->getAccountParams(); if (params) { - const char *uri = linphone_account_params_get_conference_factory_uri(params); + const auto &uri = params->getConferenceFactoryAddress(); if (uri) { return uri; } } - return string(); + return nullptr; } // ----------------------------------------------------------------------------- diff --git a/src/core/core.cpp b/src/core/core.cpp index 9be7a0830c..75aeecb89e 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -1724,12 +1724,11 @@ shared_ptr<CallSession> Core::createOrUpdateConferenceOnServer(const std::shared if (confAddr) { conferenceFactoryUri = confAddr; } else { - LinphoneAddress *factoryUri = Core::getAudioVideoConferenceFactoryAddress(getSharedFromThis(), localAddr); - if (factoryUri == nullptr) { + conferenceFactoryUri = Core::getAudioVideoConferenceFactoryAddress(getSharedFromThis(), localAddr); + if (!conferenceFactoryUri || !conferenceFactoryUri->isValid()) { lWarning() << "Not creating conference: no conference factory uri for local address [" << *localAddr << "]"; return nullptr; } - conferenceFactoryUri = Address::toCpp(factoryUri)->getSharedFromThis(); conferenceFactoryUri->setUriParam(Conference::SecurityModeParameter, ConferenceParams::getSecurityLevelAttribute(confParams->getSecurityLevel())); } @@ -1822,29 +1821,29 @@ const std::list<LinphoneMediaEncryption> Core::getSupportedMediaEncryptions() co return encEnumList; } -LinphoneAddress *Core::getAudioVideoConferenceFactoryAddress(const std::shared_ptr<Core> &core, - const std::shared_ptr<Address> &localAddress) { +const std::shared_ptr<Address> +Core::getAudioVideoConferenceFactoryAddress(const std::shared_ptr<Core> &core, + const std::shared_ptr<Address> &localAddress) { std::shared_ptr<Address> addr = localAddress; LinphoneAccount *account = linphone_core_lookup_known_account(core->getCCore(), addr->toC()); if (!account) { - lWarning() << "No account found for local address: [" << localAddress->toString() << "]"; + lWarning() << "No account found for local address: [" << *localAddress << "]"; return nullptr; - } else return getAudioVideoConferenceFactoryAddress(core, account); + } else return getAudioVideoConferenceFactoryAddress(core, Account::toCpp(account)->getSharedFromThis()); } -LinphoneAddress *Core::getAudioVideoConferenceFactoryAddress(const std::shared_ptr<Core> &core, - const LinphoneAccount *account) { - const auto &address = Account::toCpp(account)->getAccountParams()->getAudioVideoConferenceFactoryAddress(); +const std::shared_ptr<Address> Core::getAudioVideoConferenceFactoryAddress(const std::shared_ptr<Core> &core, + const std::shared_ptr<Account> account) { + const auto &address = account->getAccountParams()->getAudioVideoConferenceFactoryAddress(); if (address == nullptr) { - string conferenceFactoryUri = getConferenceFactoryUri(core, account); + const auto &conferenceFactoryUri = getConferenceFactoryAddress(core, account); lWarning() << "Audio/video conference factory is null, fallback to default conference factory URI [" - << conferenceFactoryUri << "]"; - if (conferenceFactoryUri.empty()) return nullptr; - return linphone_address_new(conferenceFactoryUri.c_str()); + << *conferenceFactoryUri << "]"; + if (!conferenceFactoryUri || !conferenceFactoryUri->isValid()) return nullptr; + return conferenceFactoryUri; } - LinphoneAddress *factory_address = address->toC(); - return factory_address; + return address; } void Core::initPlugins() { diff --git a/src/core/core.h b/src/core/core.h index 68e6918bdb..d5ee872e4e 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -125,13 +125,15 @@ public: // Return a new Core instance. Entry point of Linphone. static std::shared_ptr<Core> create(LinphoneCore *cCore); - static std::string getConferenceFactoryUri(const std::shared_ptr<Core> &core, - const std::shared_ptr<const Address> &localAddress); - static std::string getConferenceFactoryUri(const std::shared_ptr<Core> &core, const LinphoneAccount *account); - static LinphoneAddress *getAudioVideoConferenceFactoryAddress(const std::shared_ptr<Core> &core, - const std::shared_ptr<Address> &localAddress); - static LinphoneAddress *getAudioVideoConferenceFactoryAddress(const std::shared_ptr<Core> &core, - const LinphoneAccount *account); + static const std::shared_ptr<Address> + getConferenceFactoryAddress(const std::shared_ptr<Core> &core, const std::shared_ptr<const Address> &localAddress); + static const std::shared_ptr<Address> getConferenceFactoryAddress(const std::shared_ptr<Core> &core, + const std::shared_ptr<Account> account); + static const std::shared_ptr<Address> + getAudioVideoConferenceFactoryAddress(const std::shared_ptr<Core> &core, + const std::shared_ptr<Address> &localAddress); + static const std::shared_ptr<Address> getAudioVideoConferenceFactoryAddress(const std::shared_ptr<Core> &core, + const std::shared_ptr<Account> account); // --------------------------------------------------------------------------- // Application lifecycle. diff --git a/tester/audio_video_conference_tester.c b/tester/audio_video_conference_tester.c index 9ae4d22297..f34da0c012 100644 --- a/tester/audio_video_conference_tester.c +++ b/tester/audio_video_conference_tester.c @@ -1111,13 +1111,13 @@ static void simple_conference_notify_muted_device(void) { } bctbx_list_free_with_data(participant_devices, (void (*)(void *))linphone_participant_device_unref); - linphone_core_mute_mic(pauline->lc, TRUE); + linphone_core_enable_mic(pauline->lc, FALSE); BC_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneParticipantDeviceMuted, 1, 5000)); - linphone_core_mute_mic(pauline->lc, FALSE); + linphone_core_enable_mic(pauline->lc, TRUE); BC_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneParticipantDeviceUnmuted, 1, 5000)); - linphone_core_mute_mic(laure->lc, TRUE); + linphone_core_enable_mic(laure->lc, FALSE); BC_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneParticipantDeviceMuted, 2, 5000)); terminate_conference(new_participants, marie, NULL, NULL); @@ -2985,8 +2985,8 @@ static void simple_conference_with_subject_change_from_admin_base(bool_t enable_ linphone_proxy_config_set_route(laure_proxy_config, laure_proxy_uri); linphone_proxy_config_done(laure_proxy_config); - // Remove conference spec after setting conference factory uri as the callback onConferenceFactoryUriChanged sets - // ephemeral, groupchat and conference versions + // Remove conference spec after setting conference factory uri as the callback onConferenceFactoryAddressChanged + // sets ephemeral, groupchat and conference versions if (remove_conference_version) { linphone_core_remove_linphone_spec(marie->lc, "conference"); } diff --git a/tester/local_chat_imdn_tester.cpp b/tester/local_chat_imdn_tester.cpp index 4b9d5be667..e408eee728 100644 --- a/tester/local_chat_imdn_tester.cpp +++ b/tester/local_chat_imdn_tester.cpp @@ -233,11 +233,11 @@ static void group_chat_room_with_client_idmn_after_restart_base(bool_t encrypted, bool_t add_participant, bool_t stop_core) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity(), encrypted); - ClientConference michelle("michelle_rc", focus.getIdentity(), encrypted); - ClientConference michelle2("michelle_rc", focus.getIdentity(), encrypted); - ClientConference pauline("pauline_rc", focus.getIdentity(), encrypted); - ClientConference laure("laure_tcp_rc", focus.getIdentity(), encrypted); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference michelle2("michelle_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress(), encrypted); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(michelle); @@ -358,7 +358,7 @@ group_chat_room_with_client_idmn_after_restart_base(bool_t encrypted, bool_t add ms_message("%s goes offline", linphone_core_get_identity(laure.getLc())); linphone_core_set_network_reachable(laure.getLc(), FALSE); - ClientConference berthe("berthe_rc", focus.getIdentity(), encrypted); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress(), encrypted); focus.registerAsParticipantDevice(berthe); linphone_im_notif_policy_enable_all(linphone_core_get_im_notif_policy(berthe.getLc())); stats berthe_stat = berthe.getStats(); @@ -696,9 +696,9 @@ static void group_chat_room_lime_session_corrupted(void) { { // to make sure focus is destroyed after clients. linphone_core_enable_lime_x3dh(focus.getLc(), true); - ClientConference marie("marie_rc", focus.getIdentity(), true); - ClientConference pauline("pauline_rc", focus.getIdentity(), true); - ClientConference laure("laure_tcp_rc", focus.getIdentity(), true); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress(), true); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress(), true); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress(), true); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); diff --git a/tester/local_chat_tester.cpp b/tester/local_chat_tester.cpp index 2a1ff017b0..f08158fe6e 100644 --- a/tester/local_chat_tester.cpp +++ b/tester/local_chat_tester.cpp @@ -28,9 +28,9 @@ namespace LinphoneTest { static void group_chat_room_creation_server(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -133,9 +133,9 @@ static void group_chat_room_creation_server(void) { static void group_chat_room_server_deletion(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference pauline2("pauline_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline2("pauline_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -224,8 +224,8 @@ static void group_chat_room_server_deletion(void) { static void group_chat_room_server_deletion_with_rmt_lst_event_handler(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -328,9 +328,9 @@ static void group_chat_room_server_deletion_with_rmt_lst_event_handler(void) { static void group_chat_room_with_client_removed_added(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference michelle("michelle_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(michelle); @@ -404,7 +404,7 @@ static void group_chat_room_with_client_removed_added(void) { initialMichelleStats = michelle.getStats(); initialPaulineStats = pauline.getStats(); - ClientConference michelle2("michelle_rc", focus.getIdentity()); + ClientConference michelle2("michelle_rc", focus.getConferenceFactoryAddress()); stats initialMichelle2Stats = michelle2.getStats(); coresList = bctbx_list_append(coresList, michelle2.getLc()); focus.registerAsParticipantDevice(michelle2); @@ -566,10 +566,10 @@ static void group_chat_room_with_client_deletes_chatroom_after_restart(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. bool encrypted = false; - ClientConference marie("marie_rc", focus.getIdentity(), encrypted); - ClientConference michelle("michelle_rc", focus.getIdentity(), encrypted); - ClientConference pauline("pauline_rc", focus.getIdentity(), encrypted); - ClientConference laure("laure_tcp_rc", focus.getIdentity(), encrypted); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress(), encrypted); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(michelle); @@ -739,9 +739,9 @@ static void group_chat_room_with_client_registering_with_short_register_expires( Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. bool_t encrypted = FALSE; - ClientConference marie("marie_rc", focus.getIdentity(), encrypted); - ClientConference michelle("michelle_rc", focus.getIdentity(), encrypted); - ClientConference berthe("berthe_rc", focus.getIdentity(), encrypted); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress(), encrypted); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(michelle); @@ -947,9 +947,9 @@ static void group_chat_room_with_client_restart_removed_from_server(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. bool_t encrypted = FALSE; - ClientConference marie("marie_rc", focus.getIdentity(), encrypted); - ClientConference michelle("michelle_rc", focus.getIdentity(), encrypted); - ClientConference berthe("berthe_rc", focus.getIdentity(), encrypted); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress(), encrypted); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(michelle); @@ -1137,9 +1137,9 @@ static void group_chat_room_with_client_removed_while_stopped_base(bool_t use_re Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. bool_t encrypted = FALSE; - ClientConference marie("marie_rc", focus.getIdentity(), encrypted); - ClientConference michelle("michelle_rc", focus.getIdentity(), encrypted); - ClientConference berthe("berthe_rc", focus.getIdentity(), encrypted); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress(), encrypted); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(michelle); @@ -1302,8 +1302,8 @@ static void group_chat_room_with_client_removed_while_stopped_base(bool_t use_re LinphoneAccount *account = linphone_core_get_default_account(michelle.getLc()); const LinphoneAccountParams *account_params = linphone_account_get_params(account); LinphoneAccountParams *new_account_params = linphone_account_params_clone(account_params); - linphone_account_params_set_conference_factory_uri(new_account_params, - focus.getIdentity().asString().c_str()); + linphone_account_params_set_conference_factory_address(new_account_params, + focus.getConferenceFactoryAddress().toC()); linphone_account_set_params(account, new_account_params); linphone_account_params_unref(new_account_params); } @@ -1343,7 +1343,7 @@ static void group_chat_room_with_client_removed_while_stopped_base(bool_t use_re // A second device for Berthe is added in order to verify that the server will not send a NOTIFY full state // where Michelle is still a participant but she has no devices associated - ClientConference berthe2("berthe_rc", focus.getIdentity(), encrypted); + ClientConference berthe2("berthe_rc", focus.getConferenceFactoryAddress(), encrypted); stats initialBerthe2Stats = berthe2.getStats(); coresList = bctbx_list_append(coresList, berthe2.getLc()); @@ -1473,10 +1473,10 @@ static void group_chat_room_with_creator_without_groupchat_capability_in_registe Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. bool_t encrypted = FALSE; - ClientConference marie("marie_rc", focus.getIdentity(), encrypted); - ClientConference marie2("marie_rc", focus.getIdentity(), encrypted); - ClientConference michelle("michelle_rc", focus.getIdentity(), encrypted); - ClientConference berthe("berthe_rc", focus.getIdentity(), encrypted); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference marie2("marie_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress(), encrypted); stats initialMarieStats = marie.getStats(); stats initialMarie2Stats = marie2.getStats(); @@ -1610,9 +1610,9 @@ static void group_chat_room_with_creator_without_groupchat_capability(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. bool_t encrypted = FALSE; - ClientConference marie("marie_rc", focus.getIdentity(), encrypted); - ClientConference michelle("michelle_rc", focus.getIdentity(), encrypted); - ClientConference berthe("berthe_rc", focus.getIdentity(), encrypted); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress(), encrypted); bctbx_list_t *coresList = bctbx_list_append(NULL, focus.getLc()); coresList = bctbx_list_append(coresList, marie.getLc()); @@ -1694,9 +1694,9 @@ static void group_chat_room_with_subscribe_error(void) { static void group_chat_room_bulk_notify_to_participant(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference michelle("michelle_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -1766,7 +1766,7 @@ static void group_chat_room_bulk_notify_to_participant(void) { linphone_core_set_network_reachable(pauline.getLc(), FALSE); // Adding Laure - ClientConference laure("laure_tcp_rc", focus.getIdentity()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); coresList = bctbx_list_append(coresList, laure.getLc()); focus.registerAsParticipantDevice(laure); @@ -1955,8 +1955,8 @@ static void group_chat_room_bulk_notify_to_participant(void) { static void one_to_one_chatroom_exhumed_while_offline(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -2163,9 +2163,9 @@ static void multidomain_group_chat_room(void) { Focus focusExampleDotOrg("chloe_rc"); Focus focusAuth1DotExampleDotOrg("arthur_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focusExampleDotOrg.getIdentity()); - ClientConference pauline("pauline_rc", focusExampleDotOrg.getIdentity()); - ClientConference michelle("michelle_rc", focusExampleDotOrg.getIdentity()); + ClientConference marie("marie_rc", focusExampleDotOrg.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focusExampleDotOrg.getConferenceFactoryAddress()); + ClientConference michelle("michelle_rc", focusExampleDotOrg.getConferenceFactoryAddress()); focusExampleDotOrg.registerAsParticipantDevice(marie); focusExampleDotOrg.registerAsParticipantDevice(pauline); @@ -2300,7 +2300,7 @@ static void multidomain_group_chat_room(void) { BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneSubscriptionActive, 2, liblinphone_tester_sip_timeout)); - ClientConference laure("laure_tcp_rc", focusExampleDotOrg.getIdentity()); + ClientConference laure("laure_tcp_rc", focusExampleDotOrg.getConferenceFactoryAddress()); coresList = bctbx_list_append(coresList, laure.getLc()); Address laureAddr = laure.getIdentity(); focusExampleDotOrg.registerAsParticipantDevice(laure); @@ -2395,9 +2395,9 @@ static void one_to_one_group_chat_room_deletion_by_server_client(void) { static void group_chat_room_add_participant_with_invalid_address(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference michelle("michelle_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -2532,7 +2532,7 @@ static void group_chat_room_add_participant_with_invalid_address(void) { static void group_chat_room_with_only_participant_with_invalid_address(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); diff --git a/tester/local_conference_edition_tester.cpp b/tester/local_conference_edition_tester.cpp index abdbabca03..2930cd0b81 100644 --- a/tester/local_conference_edition_tester.cpp +++ b/tester/local_conference_edition_tester.cpp @@ -35,11 +35,11 @@ static void edit_simple_conference_base(bool_t from_organizer, Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); - ClientConference michelle("michelle_rc", focus.getIdentity()); - ClientConference lise("lise_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress()); + ClientConference lise("lise_rc", focus.getConferenceFactoryAddress()); LinphoneCoreManager *manager_editing = (from_organizer) ? marie.getCMgr() : laure.getCMgr(); linphone_core_enable_rtp_bundle(manager_editing->lc, enable_bundle_mode); @@ -956,10 +956,10 @@ static void conference_edition_with_simultaneous_participant_add_remove_base(boo { // to make sure focus is destroyed after clients. linphone_core_enable_lime_x3dh(focus.getLc(), true); - ClientConference marie("marie_rc", focus.getIdentity(), true); - ClientConference pauline("pauline_rc", focus.getIdentity(), true); - ClientConference laure("laure_tcp_rc", focus.getIdentity(), true); - ClientConference michelle("michelle_rc", focus.getIdentity(), true); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress(), true); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress(), true); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress(), true); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress(), true); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -1252,10 +1252,10 @@ static void conference_edition_with_organizer_codec_mismatch(void) { static void conference_cancelled_through_edit_base(bool_t server_restart) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); - ClientConference michelle("michelle_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); diff --git a/tester/local_conference_tester_functions.cpp b/tester/local_conference_tester_functions.cpp index 7cb2bcbf74..e9faf8e6fc 100644 --- a/tester/local_conference_tester_functions.cpp +++ b/tester/local_conference_tester_functions.cpp @@ -174,8 +174,8 @@ bool checkChatroom(Focus &focus, const ConfCoreManager &core, const time_t baseJ void group_chat_room_server_admin_managed_messages_base(bool_t encrypted) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity(), encrypted); - ClientConference pauline("pauline_rc", focus.getIdentity(), encrypted); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress(), encrypted); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -272,10 +272,10 @@ void group_chat_room_server_admin_managed_messages_base(bool_t encrypted) { void group_chat_room_with_client_restart_base(bool encrypted) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity(), encrypted); - ClientConference michelle("michelle_rc", focus.getIdentity(), encrypted); - ClientConference laure("laure_tcp_rc", focus.getIdentity(), encrypted); - ClientConference berthe("berthe_rc", focus.getIdentity(), encrypted); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress(), encrypted); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(michelle); @@ -377,7 +377,7 @@ void group_chat_room_with_client_restart_base(bool encrypted) { .waitUntil(chrono::seconds(10), [&focus, &core] { return checkChatroom(focus, core, -1); })); }; - ClientConference michelle2("michelle_rc", focus.getIdentity(), encrypted); + ClientConference michelle2("michelle_rc", focus.getConferenceFactoryAddress(), encrypted); stats initialMichelle2Stats = michelle2.getStats(); coresList = bctbx_list_append(coresList, michelle2.getLc()); if (encrypted) { @@ -648,12 +648,12 @@ server_core_chat_room_state_changed_sip_error(LinphoneCore *core, LinphoneChatRo void group_chat_room_with_sip_errors_base(bool invite_error, bool subscribe_error, bool encrypted) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity(), encrypted); - ClientConference pauline("pauline_rc", focus.getIdentity(), encrypted); - ClientConference laure("laure_tcp_rc", focus.getIdentity(), encrypted); - ClientConference berthe("berthe_rc", focus.getIdentity(), encrypted); - ClientConference michelle("michelle_rc", focus.getIdentity(), encrypted); - ClientConference michelle2("michelle_rc", focus.getIdentity(), encrypted); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference michelle2("michelle_rc", focus.getConferenceFactoryAddress(), encrypted); stats initialFocusStats = focus.getStats(); stats initialMarieStats = marie.getStats(); @@ -1252,9 +1252,9 @@ void group_chat_room_lime_server_message(bool encrypted) { { // to make sure focus is destroyed after clients. linphone_core_enable_lime_x3dh(focus.getLc(), true); - ClientConference marie("marie_rc", focus.getIdentity(), encrypted); - ClientConference pauline("pauline_rc", focus.getIdentity(), encrypted); - ClientConference laure("laure_tcp_rc", focus.getIdentity(), encrypted); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress(), encrypted); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -1401,8 +1401,8 @@ void one_to_one_group_chat_room_deletion_by_server_client_base(bool encrypted) { { // to make sure focus is destroyed after clients. linphone_core_enable_lime_x3dh(focus.getLc(), true); - ClientConference marie("marie_rc", focus.getIdentity(), encrypted); - ClientConference pauline("pauline_rc", focus.getIdentity(), encrypted); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress(), encrypted); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress(), encrypted); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -2651,11 +2651,11 @@ void create_conference_base(time_t start_time, bool_t all_speakers) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); - ClientConference michelle("michelle_rc", focus.getIdentity()); - ClientConference berthe("berthe_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress()); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -3063,7 +3063,7 @@ void create_conference_base(time_t start_time, LinphoneConference *marie_conference = linphone_core_search_conference_2(marie.getLc(), confAddr); BC_ASSERT_PTR_NOT_NULL(marie_conference); if (marie_conference) { - linphone_conference_mute_microphone(marie_conference, TRUE); + linphone_conference_set_microphone_muted(marie_conference, TRUE); } for (auto mgr : conferenceMgrs) { @@ -4877,11 +4877,11 @@ void create_conference_with_late_participant_addition_base(time_t start_time, LinphoneConferenceSecurityLevel security_level) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); - ClientConference michelle("michelle_rc", focus.getIdentity()); - ClientConference berthe("berthe_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress()); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -5608,11 +5608,11 @@ void create_conference_with_late_participant_addition_base(time_t start_time, void two_overlapping_conferences_base(bool_t same_organizer, bool_t dialout) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); - ClientConference michelle("michelle_rc", focus.getIdentity()); - ClientConference berthe("berthe_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress()); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -6518,9 +6518,9 @@ void create_one_participant_conference_toggle_video_base(LinphoneConferenceLayou bool_t enable_stun) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); @@ -7201,11 +7201,11 @@ void create_one_participant_conference_toggle_video_base(LinphoneConferenceLayou void create_conference_with_active_call_base(bool_t dialout) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); - ClientConference michelle("michelle_rc", focus.getIdentity()); - ClientConference berthe("berthe_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress()); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -7817,9 +7817,9 @@ void create_simple_conference_merging_calls_base(bool_t enable_ice, LinphoneConferenceSecurityLevel security_level) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); diff --git a/tester/local_conference_tester_functions.h b/tester/local_conference_tester_functions.h index ff660bf560..89cce82b8a 100644 --- a/tester/local_conference_tester_functions.h +++ b/tester/local_conference_tester_functions.h @@ -246,6 +246,13 @@ public: configureFocus(); } + const Address getConferenceFactoryAddress() const { + LinphoneAccount *account = linphone_core_get_default_account(getLc()); + const LinphoneAccountParams *account_params = linphone_account_get_params(account); + const LinphoneAddress *factory_uri = linphone_account_params_get_conference_factory_address(account_params); + return *Address::toCpp(factory_uri); + } + private: static void server_core_chat_room_conference_address_generation(LinphoneChatRoom *cr) { Focus *focus = @@ -327,7 +334,8 @@ private: const LinphoneAccountParams *account_params = linphone_account_get_params(account); LinphoneAccountParams *new_account_params = linphone_account_params_clone(account_params); linphone_account_params_enable_rtp_bundle(new_account_params, TRUE); - linphone_account_params_set_conference_factory_uri(new_account_params, getIdentity().toString().c_str()); + Address factoryAddress = getIdentity(); + linphone_account_params_set_conference_factory_address(new_account_params, factoryAddress.toC()); linphone_account_set_params(account, new_account_params); linphone_account_params_unref(new_account_params); BC_ASSERT_TRUE(linphone_account_params_rtp_bundle_enabled(linphone_account_get_params(account))); diff --git a/tester/local_ephemeral_chat_tester.cpp b/tester/local_ephemeral_chat_tester.cpp index 4fa7ccea20..176cd07f69 100644 --- a/tester/local_ephemeral_chat_tester.cpp +++ b/tester/local_ephemeral_chat_tester.cpp @@ -31,8 +31,8 @@ static void group_chat_room_server_admin_managed_messages_unencrypted(void) { static void group_chat_room_server_admin_managed_messages_ephemeral_enabled_after_creation(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -186,8 +186,8 @@ static void group_chat_room_server_admin_managed_messages_ephemeral_enabled_afte static void group_chat_room_server_admin_managed_messages_ephemeral_disabled_after_creation(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -395,8 +395,8 @@ static void group_chat_room_server_admin_managed_messages_ephemeral_disabled_aft static void group_chat_room_server_admin_managed_messages_ephemeral_lifetime_update(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); linphone_core_set_default_ephemeral_lifetime(marie.getLc(), 5); @@ -518,8 +518,8 @@ static void group_chat_room_server_admin_managed_messages_ephemeral_lifetime_upd static void group_chat_room_server_admin_managed_messages_ephemeral_lifetime_toggle_using_different_methods(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -708,8 +708,8 @@ static void group_chat_room_server_admin_managed_messages_ephemeral_lifetime_tog static void group_chat_room_server_ephemeral_mode_changed(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); diff --git a/tester/local_ice_conference_tester.cpp b/tester/local_ice_conference_tester.cpp index 43fe0a6cd7..4641f02c7c 100644 --- a/tester/local_ice_conference_tester.cpp +++ b/tester/local_ice_conference_tester.cpp @@ -102,9 +102,9 @@ static void create_simple_ice_conference_merging_calls(void) { static void abort_call_to_ice_conference(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); diff --git a/tester/local_inpromptu_conference_tester.cpp b/tester/local_inpromptu_conference_tester.cpp index 335714a2b7..ae3a061735 100644 --- a/tester/local_inpromptu_conference_tester.cpp +++ b/tester/local_inpromptu_conference_tester.cpp @@ -35,11 +35,11 @@ static void create_conference_dial_out_base(bool_t send_ics, LinphoneConferenceSecurityLevel security_level) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); - ClientConference michelle("michelle_rc", focus.getIdentity()); - ClientConference berthe("berthe_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress()); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -916,11 +916,11 @@ static void create_simple_conference_dial_out_with_video_not_initiated(void) { static void create_simple_conference_dial_out_organizer_codec_mismatch(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); - ClientConference michelle("michelle_rc", focus.getIdentity()); - ClientConference berthe("berthe_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress()); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -1004,11 +1004,11 @@ static void create_simple_conference_dial_out_organizer_codec_mismatch(void) { static void create_simple_conference_dial_out_with_some_calls_declined_base(LinphoneReason reason) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); - ClientConference michelle("michelle_rc", focus.getIdentity()); - ClientConference berthe("berthe_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress()); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -1663,11 +1663,11 @@ static void create_dial_out_conference_with_active_call(void) { static void simple_dial_out_conference_with_no_payloads(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); - ClientConference michelle("michelle_rc", focus.getIdentity()); - ClientConference berthe("berthe_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress()); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); diff --git a/tester/local_scheduled_conference_tester.cpp b/tester/local_scheduled_conference_tester.cpp index 13d8f1b146..2fb666b5f5 100644 --- a/tester/local_scheduled_conference_tester.cpp +++ b/tester/local_scheduled_conference_tester.cpp @@ -28,7 +28,7 @@ namespace LinphoneTest { static void call_to_inexisting_conference_address(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); bctbx_list_t *coresList = NULL; coresList = bctbx_list_append(coresList, focus.getLc()); @@ -61,7 +61,7 @@ static void call_to_inexisting_conference_address(void) { static void create_conference_on_unresponsive_server(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); @@ -295,10 +295,10 @@ static void two_overlapping_scheduled_conferences_from_different_organizers(void static void create_conference_with_audio_only_participants_base(LinphoneConferenceSecurityLevel security_level) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); - ClientConference berthe("berthe_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -832,11 +832,11 @@ static void create_end_to_end_encryption_conference_with_audio_only_participants static void create_conference_with_codec_mismatch_base(bool_t organizer_codec_mismatch) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); - ClientConference michelle("michelle_rc", focus.getIdentity()); - ClientConference berthe("berthe_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress()); + ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -1230,9 +1230,9 @@ static void create_conference_with_participant_codec_mismatch(void) { static void create_conference_with_server_restart_base(bool_t organizer_first) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -1574,10 +1574,10 @@ static void create_conference_with_server_restart_participant_first(void) { static void create_simple_conference_with_update_deferred(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); - ClientConference michelle("michelle_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); @@ -2044,9 +2044,9 @@ static void create_simple_conference_with_update_deferred(void) { static void change_active_speaker(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); // audio only - ClientConference laure("laure_tcp_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); // audio only + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); setup_conference_info_cbs(marie.getCMgr()); @@ -2328,9 +2328,9 @@ static void create_scheduled_conference_with_active_call(void) { static void conference_with_participant_added_outside_valid_time_slot (bool_t before_start) { Focus focus("chloe_rc"); {//to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity()); - ClientConference pauline("pauline_rc", focus.getIdentity()); - ClientConference laure("laure_tcp_rc", focus.getIdentity()); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); + ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); + ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); diff --git a/tester/local_secure_chat_tester.cpp b/tester/local_secure_chat_tester.cpp index 1e17d89792..dcdbdaece7 100644 --- a/tester/local_secure_chat_tester.cpp +++ b/tester/local_secure_chat_tester.cpp @@ -39,10 +39,10 @@ static void secure_group_chat_room_with_subscribe_error(void) { static void secure_group_chat_room_with_chat_room_deleted_before_server_restart(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. - ClientConference marie("marie_rc", focus.getIdentity(), true); - ClientConference marie2("marie_rc", focus.getIdentity(), true); - ClientConference michelle("michelle_rc", focus.getIdentity(), true); - ClientConference michelle2("michelle_rc", focus.getIdentity(), true); + ClientConference marie("marie_rc", focus.getConferenceFactoryAddress(), true); + ClientConference marie2("marie_rc", focus.getConferenceFactoryAddress(), true); + ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress(), true); + ClientConference michelle2("michelle_rc", focus.getConferenceFactoryAddress(), true); stats initialFocusStats = focus.getStats(); stats initialMarieStats = marie.getStats(); diff --git a/tester/vcard_tester.c b/tester/vcard_tester.c index 95e6e588f9..487688bf67 100644 --- a/tester/vcard_tester.c +++ b/tester/vcard_tester.c @@ -165,7 +165,7 @@ static void linphone_vcard_phone_numbers_and_sip_addresses(void) { BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(sip_addresses), 2, unsigned int, "%u"); BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(phone_numbers), 1, unsigned int, "%u"); - if (phone_numbers) bctbx_list_free(phone_numbers); + if (phone_numbers) bctbx_list_free_with_data(phone_numbers, ms_free); linphone_friend_unref(lf); lvc = linphone_vcard_context_get_vcard_from_buffer( @@ -180,7 +180,7 @@ static void linphone_vcard_phone_numbers_and_sip_addresses(void) { BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(sip_addresses), 0, unsigned int, "%u"); BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(phone_numbers), 2, unsigned int, "%u"); - if (phone_numbers) bctbx_list_free(phone_numbers); + if (phone_numbers) bctbx_list_free_with_data(phone_numbers, ms_free); addr = linphone_address_new("sip:sylvain@sip.linphone.org"); linphone_friend_add_address(lf, addr); @@ -190,12 +190,12 @@ static void linphone_vcard_phone_numbers_and_sip_addresses(void) { linphone_friend_remove_phone_number(lf, "0952636505"); phone_numbers = linphone_friend_get_phone_numbers(lf); BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(phone_numbers), 1, unsigned int, "%u"); - if (phone_numbers) bctbx_list_free(phone_numbers); + if (phone_numbers) bctbx_list_free_with_data(phone_numbers, ms_free); linphone_friend_remove_phone_number(lf, "0476010203"); phone_numbers = linphone_friend_get_phone_numbers(lf); BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(phone_numbers), 0, unsigned int, "%u"); - if (phone_numbers) bctbx_list_free(phone_numbers); + if (phone_numbers) bctbx_list_free_with_data(phone_numbers, ms_free); linphone_friend_edit(lf); linphone_friend_remove_address(lf, addr); @@ -206,7 +206,7 @@ static void linphone_vcard_phone_numbers_and_sip_addresses(void) { linphone_friend_add_phone_number(lf, "+33952636505"); phone_numbers = linphone_friend_get_phone_numbers(lf); BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(phone_numbers), 1, unsigned int, "%u"); - if (phone_numbers) bctbx_list_free(phone_numbers); + if (phone_numbers) bctbx_list_free_with_data(phone_numbers, ms_free); linphone_address_unref(addr); linphone_friend_unref(lf); -- GitLab