diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 262353fbaf4379a9859ebc1386d16c3e2c45e911..dd4cd5470ff7837ba39be109d06682a580bfc896 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -181,6 +181,10 @@ static void call_received(SalCallOp *h) { #endif auto params = ConferenceParams::create(L_GET_CPP_PTR_FROM_C_OBJECT(lc)); + LinphoneAccount *account = linphone_core_lookup_account_by_identity(lc, to->toC()); + if (account) { + params->setAccount(Account::toCpp(account)->getSharedFromThis()); + } params->setUtf8Subject(h->getSubject()); if (hasStreams) { params->setAudioVideoDefaults(); @@ -322,7 +326,7 @@ static void call_received(SalCallOp *h) { // The duration is stored in minutes whereas the start time in seconds params->setEndTime(startTime + duration * 60); } - conference = (new ServerConference(core, to, nullptr, params))->toSharedPtr(); + conference = (new ServerConference(core, nullptr, params))->toSharedPtr(); conference->init(h); } else #endif // HAVE_DB_STORAGE @@ -338,7 +342,7 @@ static void call_received(SalCallOp *h) { h->release(); return; } else { - auto serverConference = (new ServerConference(core, to, nullptr, params))->toSharedPtr(); + auto serverConference = (new ServerConference(core, nullptr, params))->toSharedPtr(); serverConference->init(h); static_pointer_cast<ServerConference>(serverConference)->confirmCreation(); return; @@ -985,12 +989,14 @@ static void message_delivery_update(SalOp *op, SalMessageDeliveryStatus status) auto chatRoom = msg->getChatRoom(); // Check that the message does not belong to an already destroyed chat room - if so, do not invoke callbacks if (chatRoom) { - auto errorInfo = op->getErrorInfo(); - auto reason = errorInfo ? linphone_reason_from_sal(errorInfo->reason) : LinphoneReasonNone; - L_GET_PRIVATE(msg)->setParticipantState( - chatRoom->getMe()->getAddress(), - (LinphonePrivate::ChatMessage::State)chatStatusSal2Linphone(lc, status, errorInfo), ::ms_time(NULL), - reason); + const auto &me = chatRoom->getMe(); + if (me) { + auto errorInfo = op->getErrorInfo(); + auto reason = errorInfo ? linphone_reason_from_sal(errorInfo->reason) : LinphoneReasonNone; + L_GET_PRIVATE(msg)->setParticipantState( + me->getAddress(), (LinphonePrivate::ChatMessage::State)chatStatusSal2Linphone(lc, status, errorInfo), + ::ms_time(NULL), reason); + } } } diff --git a/coreapi/chat.c b/coreapi/chat.c index 0088ab5365d6032b6f928d17865ba14212d156fb..3efb2eb007bb324d96085736deed9ee81c320d18 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -127,27 +127,37 @@ LinphoneChatRoom *linphone_core_create_chat_room_5(LinphoneCore *lc, const Linph return result; } +// Deprecated see linphone_core_create_chat_room_7 LinphoneChatRoom *linphone_core_create_chat_room_6(LinphoneCore *lc, const LinphoneChatRoomParams *params, const LinphoneAddress *localAddr, const bctbx_list_t *participants) { - return linphone_core_create_chat_room_7(lc, params, localAddr, participants); + LinphoneConferenceParams *cloned_params = NULL; + if (params) { + cloned_params = linphone_conference_params_clone(params); + } else { + cloned_params = linphone_core_create_conference_params_2(lc, NULL); + } + if (!linphone_conference_params_get_account(cloned_params) && localAddr) { + linphone_conference_params_set_account(cloned_params, linphone_core_lookup_account_by_identity(lc, localAddr)); + } + LinphoneChatRoom *chat_room = linphone_core_create_chat_room_7(lc, cloned_params, participants); + if (cloned_params) { + linphone_conference_params_unref(cloned_params); + } + return chat_room; } LinphoneChatRoom *linphone_core_create_chat_room_7(LinphoneCore *lc, const LinphoneConferenceParams *params, - const LinphoneAddress *localAddr, const bctbx_list_t *participants) { CoreLogContextualizer logContextualizer(lc); shared_ptr<LinphonePrivate::ConferenceParams> conferenceParams = params ? LinphonePrivate::ConferenceParams::toCpp(params)->clone()->toSharedPtr() : nullptr; const list<std::shared_ptr<LinphonePrivate::Address>> participantsList = LinphonePrivate::Utils::bctbxListToCppSharedPtrList<LinphoneAddress, Address>(participants); - shared_ptr<const LinphonePrivate::Address> localAddress = - localAddr ? LinphonePrivate::Address::toCpp(localAddr)->getSharedFromThis() - : L_GET_PRIVATE_FROM_C_OBJECT(lc)->getDefaultLocalAddress(nullptr, false); shared_ptr<LinphonePrivate::AbstractChatRoom> room = - L_GET_PRIVATE_FROM_C_OBJECT(lc)->createChatRoom(conferenceParams, localAddress, participantsList); + L_GET_PRIVATE_FROM_C_OBJECT(lc)->createChatRoom(conferenceParams, participantsList); if (room) { auto cRoom = room->toC(); linphone_chat_room_ref(cRoom); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 026b02f60d3613af8a2fef76a777967c41aa6bf7..0827aae8121f621a801199790fbc275087f23edf 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4742,7 +4742,7 @@ LinphoneProxyConfig *linphone_core_lookup_proxy_by_identity(LinphoneCore *lc, co } /* - * Returns an account matching the given identity address + * Returns an account matching the given conference factory address * Prefers registered, then first registering matching, otherwise first matching * returns NULL if none is found */ @@ -9333,16 +9333,10 @@ LinphoneConference *linphone_core_create_conference_with_params(LinphoneCore *lc linphone_conference_params_enable_audio(params2, TRUE); LinphoneAccount *conference_account = linphone_conference_params_get_account(params2); LinphoneAccount *default_account = linphone_core_get_default_account(lc); - const std::shared_ptr<LinphonePrivate::Address> &meAddress = - LinphonePrivate::ConferenceParams::toCpp(params2)->getMe(); - bool isMeValid = (meAddress && meAddress->isValid()); if (!conference_account) { lWarning() << "The application didn't explicitely specified the account to use to create a conference, " - "therefore the core is going to find the one matching the me address or the default account"; + "therefore the core is going to use the default account"; conference_account = linphone_core_get_default_account(lc); - if (isMeValid) { - conference_account = linphone_core_lookup_account_by_identity(lc, meAddress->toC()); - } linphone_conference_params_set_account(params2, conference_account); } const LinphoneAddress *factory_uri_const = linphone_conference_params_get_conference_factory_address(params2); @@ -9354,10 +9348,7 @@ LinphoneConference *linphone_core_create_conference_with_params(LinphoneCore *lc // backward compatibility : use default identity even if set in conference parameters identity = linphone_address_new(core_identity); } else { - if (isMeValid) { - lInfo() << "Creating conference with identity from conference params : " << *meAddress; - identity = linphone_address_clone(meAddress->toC()); - } else if (conference_account) { + if (conference_account) { identity = linphone_address_clone( linphone_account_params_get_identity_address(linphone_account_get_params(conference_account))); lInfo() << "Creating conference with identity from conference " << *Account::toCpp(conference_account); diff --git a/include/linphone/core.h b/include/linphone/core.h index b977c58fc90a59beae7db9489eba2ae41894917b..aa0be62b24c64b0cf92e5ed971cb476e42e0b11e 100644 --- a/include/linphone/core.h +++ b/include/linphone/core.h @@ -6209,36 +6209,17 @@ LINPHONE_PUBLIC bctbx_list_t *linphone_core_get_linphone_specs_list(LinphoneCore * @addtogroup chatroom * @{ */ - -/** - * Create a chat room. - * - * @param core A #LinphoneCore object @notnil - * @param params The chat room creation parameters #LinphoneChatRoomParams @notnil - * @param localAddr #LinphoneAddress of a local #LinphoneAccount identity or NULL @maybenil - * @param participants The initial list of participants of the chat room. \bctbx_list{LinphoneAddress} @notnil - * @return The newly created chat room (can be an existing one if backend is Basic) or NULL. @maybenil - * @deprecated 22/10/2024, use linphone_core_create_chat_room_7() instead - * @ingroup chatroom - */ -LINPHONE_PUBLIC LinphoneChatRoom *linphone_core_create_chat_room_6(LinphoneCore *core, - const LinphoneChatRoomParams *params, - const LinphoneAddress *localAddr, - const bctbx_list_t *participants); - /** * Create a chat room. * * @param core A #LinphoneCore object @notnil * @param params The chat room creation parameters #LinphoneConferenceParams @notnil - * @param localAddr #LinphoneAddress of a local #LinphoneAccount identity or NULL @maybenil * @param participants The initial list of participants of the chat room. \bctbx_list{LinphoneAddress} @notnil * @return The newly created chat room (can be an existing one if backend is Basic) or NULL. @maybenil * @ingroup chatroom */ LINPHONE_PUBLIC LinphoneChatRoom *linphone_core_create_chat_room_7(LinphoneCore *core, const LinphoneConferenceParams *params, - const LinphoneAddress *localAddr, const bctbx_list_t *participants); /** @@ -7807,13 +7788,15 @@ LINPHONE_PUBLIC bool_t linphone_core_get_register_only_when_network_is_up(const * @return #LinphoneCall or NULL if no match is found. @maybenil * @deprecated 27/10/2020. Use linphone_core_get_call_by_remote_address2() instead. */ -LINPHONE_PUBLIC LinphoneCall *linphone_core_find_call_from_uri(const LinphoneCore *core, const char *uri); +LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneCall *linphone_core_find_call_from_uri(const LinphoneCore *core, + const char *uri); /** * Create some default conference parameters for instanciating a conference with *linphone_core_create_conference_with_params(). * @param core the #LinphoneCore object @notnil * @return a #LinphoneConferenceParams object. @notnil + * @deprecated 23/07/2024. Use linphone_core_create_conference_params_2() instead. **/ LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneConferenceParams * linphone_core_create_conference_params(LinphoneCore *core); @@ -9002,7 +8985,7 @@ LINPHONE_PUBLIC void linphone_core_enable_database(LinphoneCore *core, bool_t va * @param fallback Boolean value telling whether we should plan on being able to fallback to a basic chat room if the * client-side group chat room creation fails * @return The newly created client-side group chat room. @maybenil - * @deprecated 02/07/2020, use linphone_core_create_chat_room_6() instead + * @deprecated 02/07/2020, use linphone_core_create_chat_room_7() instead * @ingroup chatroom */ LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneChatRoom * @@ -9022,7 +9005,7 @@ linphone_core_create_client_group_chat_room(LinphoneCore *core, const char *subj * @param encrypted Boolean value telling whether we should apply encryption or not on chat messages sent and received * on this room. * @return The newly created client-side group chat room. @maybenil - * @deprecated 02/07/2020, use linphone_core_create_chat_room_6() instead + * @deprecated 02/07/2020, use linphone_core_create_chat_room_7() instead * @ingroup chatroom */ LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneChatRoom *linphone_core_create_client_group_chat_room_2(LinphoneCore *core, @@ -9040,7 +9023,7 @@ LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneChatRoom *linphone_core_create_clien * @param subject The subject of the group chat room @notnil * @param participants The initial list of participants of the chat room \bctbx_list{LinphoneAddress} @notnil * @return The newly created chat room. @maybenil - * @deprecated 02/07/2020, use linphone_core_create_chat_room_6() instead + * @deprecated 02/07/2020, use linphone_core_create_chat_room_7() instead * @ingroup chatroom */ LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneChatRoom * @@ -9058,7 +9041,7 @@ linphone_core_create_chat_room(LinphoneCore *core, * @param subject The subject of the group chat room @notnil * @param participants The initial list of participants of the chat room. \bctbx_list{LinphoneAddress} @notnil * @return The newly created chat room. @maybenil - * @deprecated 02/07/2020, use linphone_core_create_chat_room_6() instead + * @deprecated 02/07/2020, use linphone_core_create_chat_room_7() instead * @ingroup chatroom */ LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneChatRoom *linphone_core_create_chat_room_2( @@ -9070,7 +9053,7 @@ LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneChatRoom *linphone_core_create_chat_ * @param subject The subject of the group chat room @notnil * @param participants The initial list of participants of the chat room. \bctbx_list{LinphoneAddress} @notnil * @return The newly created chat room. @maybenil - * @deprecated 02/07/2020, use linphone_core_create_chat_room_6() instead + * @deprecated 02/07/2020, use linphone_core_create_chat_room_7() instead * @ingroup chatroom */ LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneChatRoom * @@ -9084,7 +9067,7 @@ linphone_core_create_chat_room_3(LinphoneCore *core, const char *subject, const * @notnil * @param participant #LinphoneAddress representing the initial participant to add to the chat room @notnil * @return The newly created chat room. @maybenil - * @deprecated 02/07/2020, use linphone_core_create_chat_room_6() instead + * @deprecated 02/07/2020, use linphone_core_create_chat_room_7() instead * @ingroup chatroom */ LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneChatRoom * @@ -9098,12 +9081,29 @@ linphone_core_create_chat_room_4(LinphoneCore *core, * @param core A #LinphoneCore object @notnil * @param participant #LinphoneAddress representing the initial participant to add to the chat room @notnil * @return The newly created chat room. @maybenil - * @deprecated 02/07/2020, use linphone_core_create_chat_room_6() instead + * @deprecated 02/07/2020, use linphone_core_create_chat_room_7() instead * @ingroup chatroom */ LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneChatRoom * linphone_core_create_chat_room_5(LinphoneCore *core, const LinphoneAddress *participant); +/** + * Create a chat room. + * + * @param core A #LinphoneCore object @notnil + * @param params The chat room creation parameters #LinphoneChatRoomParams @notnil + * @param localAddr #LinphoneAddress of a local #LinphoneAccount identity or NULL @maybenil + * @param participants The initial list of participants of the chat room. \bctbx_list{LinphoneAddress} @notnil + * @return The newly created chat room (can be an existing one if backend is Basic) or NULL. @maybenil + * @deprecated 22/10/2024, use linphone_core_create_chat_room_7() instead + * @ingroup chatroom + */ +LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneChatRoom * +linphone_core_create_chat_room_6(LinphoneCore *core, + const LinphoneChatRoomParams *params, + const LinphoneAddress *localAddr, + const bctbx_list_t *participants); + /** * Get a chat room whose peer is the supplied address. If it does not exist yet, it will be created as a basic chat *room. No reference is transferred to the application. The #LinphoneCore keeps a reference on the chat room. diff --git a/src/c-wrapper/api/c-conference.cpp b/src/c-wrapper/api/c-conference.cpp index 15b6c5e258970101dded93a995193549c254c009..45b90f6d1e70eab79c42d0fa45292be19ac28c77 100644 --- a/src/c-wrapper/api/c-conference.cpp +++ b/src/c-wrapper/api/c-conference.cpp @@ -71,12 +71,22 @@ LinphoneConference *linphone_local_conference_new(LinphoneCore *core, LinphoneAd LinphoneConference *linphone_local_conference_new_with_params(LinphoneCore *core, LinphoneAddress *addr, const LinphoneConferenceParams *params) { + + LinphoneConferenceParams *cloned_params = NULL; + if (params) { + cloned_params = linphone_conference_params_clone(params); + } else { + cloned_params = linphone_core_create_conference_params_2(core, NULL); + } + if (!linphone_conference_params_get_account(cloned_params) && addr) { + linphone_conference_params_set_account(cloned_params, linphone_core_lookup_account_by_identity(core, addr)); + } + std::shared_ptr<ConferenceParams> conf_params = ConferenceParams::toCpp(cloned_params)->getSharedFromThis(); std::shared_ptr<Conference> localConf = - (new ServerConference( - L_GET_CPP_PTR_FROM_C_OBJECT(core), Address::toCpp(addr)->getSharedFromThis(), nullptr, - params ? ConferenceParams::toCpp(const_cast<LinphoneConferenceParams *>(params))->getSharedFromThis() - : ConferenceParams::create(L_GET_CPP_PTR_FROM_C_OBJECT(core)))) - ->toSharedPtr(); + (new ServerConference(L_GET_CPP_PTR_FROM_C_OBJECT(core), nullptr, conf_params))->toSharedPtr(); + if (cloned_params) { + linphone_conference_params_unref(cloned_params); + } localConf->init(); localConf->ref(); return localConf->toC(); @@ -90,16 +100,21 @@ LinphoneConference *linphone_remote_conference_new_with_params(LinphoneCore *cor LinphoneAddress *focus, LinphoneAddress *addr, const LinphoneConferenceParams *params) { - std::shared_ptr<const ConferenceParams> conf_params = nullptr; + LinphoneConferenceParams *cloned_params = NULL; if (params) { - conf_params = ConferenceParams::toCpp(params)->getSharedFromThis(); + cloned_params = linphone_conference_params_clone(params); } else { - conf_params = ConferenceParams::create(L_GET_CPP_PTR_FROM_C_OBJECT(core)); + cloned_params = linphone_core_create_conference_params_2(core, NULL); } + if (!linphone_conference_params_get_account(cloned_params) && addr) { + linphone_conference_params_set_account(cloned_params, linphone_core_lookup_account_by_identity(core, addr)); + } + std::shared_ptr<const ConferenceParams> conf_params = ConferenceParams::toCpp(cloned_params)->getSharedFromThis(); std::shared_ptr<Conference> conference = - (new ClientConference(L_GET_CPP_PTR_FROM_C_OBJECT(core), Address::toCpp(addr)->getSharedFromThis(), nullptr, - conf_params)) - ->toSharedPtr(); + (new ClientConference(L_GET_CPP_PTR_FROM_C_OBJECT(core), nullptr, conf_params))->toSharedPtr(); + if (cloned_params) { + linphone_conference_params_unref(cloned_params); + } static_pointer_cast<ClientConference>(conference) ->initWithFocus(Address::toCpp(focus)->getSharedFromThis(), nullptr, nullptr, conference.get()); conference->ref(); diff --git a/src/call/call.cpp b/src/call/call.cpp index 0bc87c07f0986a4b3ea1ae2e13a529168784adff..4b698114b5531d02c879689ec00163324ce4a6c5 100644 --- a/src/call/call.cpp +++ b/src/call/call.cpp @@ -564,6 +564,7 @@ void Call::createClientConference(const shared_ptr<CallSession> &session) { } } else { auto confParams = ConferenceParams::create(getCore()); + confParams->setAccount(getParams()->getAccount()); std::shared_ptr<SalMediaDescription> md = (op) ? op->getFinalMediaDescription() : nullptr; if (op && op->getSal()->mediaDisabled()) md = op->getRemoteMediaDescription(); @@ -576,7 +577,7 @@ void Call::createClientConference(const shared_ptr<CallSession> &session) { if (confParams->audioEnabled() || confParams->videoEnabled() || confParams->chatEnabled()) { clientConference = dynamic_pointer_cast<ClientConference>( - (new ClientConference(getCore(), conferenceId.getLocalAddress(), nullptr, confParams))->toSharedPtr()); + (new ClientConference(getCore(), nullptr, confParams))->toSharedPtr()); clientConference->initWithFocus(remoteContactAddress, session, op); } else { lError() << "Unable to attach call (local address " << *session->getLocalAddress() << " remote address " diff --git a/src/chat/chat-message/chat-message.cpp b/src/chat/chat-message/chat-message.cpp index dd7b2c500fe890cab10b87927f1d7edf22373e02..00160523f6b547ab5b44c45e620505d4f74c801a 100644 --- a/src/chat/chat-message/chat-message.cpp +++ b/src/chat/chat-message/chat-message.cpp @@ -850,7 +850,10 @@ void ChatMessagePrivate::setChatRoom(const shared_ptr<AbstractChatRoom> &chatRoo fromAddress = peerAddress; toAddress = localAddress; } - mMeAddress = chatRoom->getMe()->getAddress()->clone()->toSharedPtr(); + const auto &me = chatRoom->getMe(); + if (me) { + mMeAddress = me->getAddress()->clone()->toSharedPtr(); + } } // ----------------------------------------------------------------------------- diff --git a/src/chat/chat-room/chat-room.cpp b/src/chat/chat-room/chat-room.cpp index 2a667361cb0f3ab335332a788dc459aa75749015..eae6947e9e6dbc331f05b4e59d9ff0a8eda7f433 100644 --- a/src/chat/chat-room/chat-room.cpp +++ b/src/chat/chat-room/chat-room.cpp @@ -332,6 +332,7 @@ std::shared_ptr<AbstractChatRoom> ChatRoom::getImdnChatRoom(const std::shared_pt chatRoom = getCore()->getPrivate()->searchChatRoom(getCurrentParams(), getLocalAddress(), peerAddress, {}); if (!chatRoom) { shared_ptr<ConferenceParams> params = ConferenceParams::create(getCore()); + params->setAccount(getCurrentParams()->getAccount()); params->setChatDefaults(); params->setGroup(false); auto isEncrypted = getCurrentParams()->getChatParams()->isEncrypted(); @@ -345,7 +346,7 @@ std::shared_ptr<AbstractChatRoom> ChatRoom::getImdnChatRoom(const std::shared_pt params->getChatParams()->setBackend(ChatParams::Backend::Basic); params->setSecurityLevel(ConferenceParams::SecurityLevel::None); } - chatRoom = getCore()->getPrivate()->createChatRoom(params, getLocalAddress(), peerAddress); + chatRoom = getCore()->getPrivate()->createChatRoom(params, peerAddress); } } return chatRoom; diff --git a/src/conference/ccmp-conference-scheduler.cpp b/src/conference/ccmp-conference-scheduler.cpp index b4bb7718531f10b0d44aef0a644c1aba99173fc9..d7f60199651738b1f31d7fff7adb37c0ecfff6ee 100644 --- a/src/conference/ccmp-conference-scheduler.cpp +++ b/src/conference/ccmp-conference-scheduler.cpp @@ -81,10 +81,10 @@ void CCMPConferenceScheduler::handleCCMPResponse(const HttpResponse &response) { } } -void CCMPConferenceScheduler::createOrUpdateConference(const std::shared_ptr<ConferenceInfo> &conferenceInfo, - const std::shared_ptr<Address> &creator) { +void CCMPConferenceScheduler::createOrUpdateConference(const std::shared_ptr<ConferenceInfo> &conferenceInfo) { const auto &account = getAccount() ? getAccount() : getCore()->getDefaultAccount(); const auto accountParams = account ? account->getAccountParams() : nullptr; + const auto &creator = accountParams->getIdentityAddress(); if (!accountParams) { lError() << "Aborting creation of conference because the account of conference scheduler [" << this diff --git a/src/conference/ccmp-conference-scheduler.h b/src/conference/ccmp-conference-scheduler.h index 32ecd93a04b71d3284a872cec4a867278c0e8298..de55fee907417e1417918f8e6b7208e151641dfe 100644 --- a/src/conference/ccmp-conference-scheduler.h +++ b/src/conference/ccmp-conference-scheduler.h @@ -33,8 +33,7 @@ public: CCMPConferenceScheduler(const std::shared_ptr<Core> &core, const std::shared_ptr<Account> &account = nullptr); virtual ~CCMPConferenceScheduler() = default; - virtual void createOrUpdateConference(const std::shared_ptr<ConferenceInfo> &conferenceInfo, - const std::shared_ptr<Address> &creator) override; + virtual void createOrUpdateConference(const std::shared_ptr<ConferenceInfo> &conferenceInfo) override; virtual void processResponse(const LinphoneErrorInfo *errorInfo, const std::shared_ptr<Address> conferenceAddress) override; diff --git a/src/conference/client-conference.cpp b/src/conference/client-conference.cpp index 96e089cbd0bded4c24f262ec3beedb96e352935d..0b1169d2fdba32abf5753761407b64a65e067e4a 100644 --- a/src/conference/client-conference.cpp +++ b/src/conference/client-conference.cpp @@ -53,10 +53,9 @@ using namespace std; LINPHONE_BEGIN_NAMESPACE ClientConference::ClientConference(const shared_ptr<Core> &core, - const std::shared_ptr<Address> &myAddress, std::shared_ptr<CallSessionListener> listener, const std::shared_ptr<const ConferenceParams> params) - : Conference(core, myAddress, listener, params) { + : Conference(core, listener, params) { } ClientConference::~ClientConference() { @@ -100,7 +99,7 @@ void ClientConference::initFromDb(const std::shared_ptr<Participant> &me, bool hasBeenLeft) { const auto &conferenceAddress = mConfParams->getConferenceAddress(); createFocus(conferenceAddress, nullptr); - mMe = Participant::create(getSharedFromThis(), mConfParams->getMe()); + mMe = Participant::create(getSharedFromThis(), me->getAddress()); mMe->setAdmin(me->isAdmin()); for (const auto &device : me->getDevices()) { mMe->addDevice(device); @@ -143,11 +142,11 @@ void ClientConference::init(SalCallOp *op, BCTBX_UNUSED(ConferenceListener *conf // Local conference sets last notify to 1 in its constructor setLastNotify(0); - const auto &meAddress = mConfParams->getMe(); - mMe = Participant::create(getSharedFromThis(), meAddress); + inititializeMe(); + + const auto &core = getCore(); std::shared_ptr<Address> organizerAddress = nullptr; auto conferenceAddress = mFocus ? mFocus->getAddress() : nullptr; - const auto &core = getCore(); std::shared_ptr<ConferenceInfo> conferenceInfo = nullptr; #ifdef HAVE_DB_STORAGE if (conferenceAddress && core->getPrivate()->mainDb && supportsMedia()) { @@ -203,6 +202,7 @@ void ClientConference::init(SalCallOp *op, BCTBX_UNUSED(ConferenceListener *conf } #endif // HAVE_ADVANCED_IM + const auto &meAddress = mMe->getAddress(); if (supportsMedia()) { getMe()->setAdmin((focusSession == nullptr) || (organizerAddress == nullptr) || organizerAddress->weakEqual(*meAddress)); @@ -434,13 +434,20 @@ void ClientConference::setConferenceId(const ConferenceId &conferenceId) { if (mFocus) { shared_ptr<CallSession> session = mFocus->getSession(); if (session) { - shared_ptr<CallLog> sessionLog = session->getLog(); + std::shared_ptr<Address> address; if (conferenceId.getPeerAddress()->isValid()) { - // Use the peer address of the conference ID because it has also the conf-id param hence the To field - // can be used to search in the map of chat rooms - sessionLog->setToAddress(conferenceId.getPeerAddress()); + // Use the peer address of the conference ID because it has also the conf-id param hence the To or From + // field can be used to search in the map of conferences or chat rooms + address = conferenceId.getPeerAddress(); + } else { + address = mFocus->getAddress(); + } + const auto &direction = session->getDirection(); + auto sessionLog = session->getLog(); + if (direction == LinphoneCallIncoming) { + sessionLog->setFromAddress(address); } else { - sessionLog->setToAddress(mFocus->getAddress()); + sessionLog->setToAddress(address); } } } @@ -2035,8 +2042,7 @@ int ClientConference::inviteAddresses(const std::list<std::shared_ptr<Address>> // The main session for the time being is the one used to create the conference. It will later replaced by the // actual session used to join the conference - auto session = - getCore()->createOrUpdateConferenceOnServer(mConfParams, organizer, invitees, getConferenceAddress(), ref); + auto session = getCore()->createOrUpdateConferenceOnServer(mConfParams, invitees, getConferenceAddress(), ref); if (!session) { lInfo() << "Aborting creation of conference " << *this << " because the call session cannot be established"; setState(ConferenceInterface::State::CreationFailed); diff --git a/src/conference/client-conference.h b/src/conference/client-conference.h index 24285440ce926b595d27a41850a769f5073fd48d..c0bd05f664acd18c5703718f28d2b6da70d21925 100644 --- a/src/conference/client-conference.h +++ b/src/conference/client-conference.h @@ -39,7 +39,6 @@ class LINPHONE_PUBLIC ClientConference : public Conference, public ConferenceLis public: ClientConference(const std::shared_ptr<Core> &core, - const std::shared_ptr<Address> &meAddr, std::shared_ptr<CallSessionListener> listener, const std::shared_ptr<const ConferenceParams> params); virtual ~ClientConference(); diff --git a/src/conference/conference-params-interface.h b/src/conference/conference-params-interface.h index 0c84e992e42bff1bf81d426a6d1bc572bfa3b071..d1ec03533d674e1d8ed404d0cf21c7436efcdc4a 100644 --- a/src/conference/conference-params-interface.h +++ b/src/conference/conference-params-interface.h @@ -67,13 +67,6 @@ public: */ virtual void setUtf8Subject(const std::string &subject) = 0; - /* - *Set participant representing myself in this Conference. - *If set this participant is added to the conference - * @param[in] participantAddress of the conference focus. - */ - virtual void setMe(const std::shared_ptr<const Address> &participantAddress) = 0; - /* * Enable audio media type for a conference * @param enable If true, audio will be enabled during conference diff --git a/src/conference/conference-params.cpp b/src/conference/conference-params.cpp index 6a4e0a9b4059d5ea9786ab4cf2ea65e144606746..4eb6b1b7d4c2625528507055bda01509d61e0f0b 100644 --- a/src/conference/conference-params.cpp +++ b/src/conference/conference-params.cpp @@ -113,12 +113,6 @@ void ConferenceParams::updateFromAccount( if (account) { auto accountParams = account->getAccountParams(); if (accountParams) { - auto identity = accountParams->getIdentityAddress(); - if (identity) { - setMe(identity); - } else { - setMe(nullptr); - } if (mUseDefaultFactoryAddress) { const auto &conferenceFactory = (audioEnabled() || videoEnabled()) ? accountParams->getAudioVideoConferenceFactoryAddress() diff --git a/src/conference/conference-params.h b/src/conference/conference-params.h index 16dbb3b78340bd0575457b03f176191650a7d4f6..a28d1bf4cd484ffaf9802bbc22313bb8bd23a3be 100644 --- a/src/conference/conference-params.h +++ b/src/conference/conference-params.h @@ -128,14 +128,6 @@ public: return mUtf8Subject; } const std::string &getSubject() const; - - virtual void setMe(const std::shared_ptr<const Address> &participantAddress) override { - mMe = participantAddress ? participantAddress->clone()->toSharedPtr() : nullptr; - }; - std::shared_ptr<Address> getMe() const { - return mMe; - }; - void setAccount(const std::shared_ptr<Account> &a); std::shared_ptr<Account> getAccount() const; diff --git a/src/conference/conference-scheduler.cpp b/src/conference/conference-scheduler.cpp index cd3587b108351ccf6b6b7cbd3717b0e258dd77aa..fc3326854d55b4ec297d3b838f1994e2596596a3 100644 --- a/src/conference/conference-scheduler.cpp +++ b/src/conference/conference-scheduler.cpp @@ -206,7 +206,7 @@ void ConferenceScheduler::setInfo(const std::shared_ptr<ConferenceInfo> &info) { mConferenceInfo = clone; - createOrUpdateConference(mConferenceInfo, creator); + createOrUpdateConference(mConferenceInfo); } void ConferenceScheduler::onChatMessageStateChanged(const shared_ptr<ChatMessage> &message, ChatMessage::State state) { @@ -485,7 +485,7 @@ void ConferenceScheduler::sendInvitations(shared_ptr<ConferenceParams> conferenc if (!chatRoom) { lInfo() << "[Conference Scheduler] [" << this << "] Existing chat room between [" << *sender << "] and [" << *participant << "] wasn't found, creating it."; - chatRoom = getCore()->getPrivate()->createChatRoom(conferenceParams, sender, chatRoomParticipantList); + chatRoom = getCore()->getPrivate()->createChatRoom(conferenceParams, chatRoomParticipantList); } else { lInfo() << "[Conference Scheduler] [" << this << "] Found existing chat room [" << *chatRoom->getPeerAddress() << "] between [" << *sender << "] and [" << *participant diff --git a/src/conference/conference-scheduler.h b/src/conference/conference-scheduler.h index 02e99fa2b9e339e9642da7db7060129446e465cc..0b44d2f8b6e9d92c38d01e0c5a3cd80372697ab1 100644 --- a/src/conference/conference-scheduler.h +++ b/src/conference/conference-scheduler.h @@ -79,8 +79,7 @@ protected: bool cancel); void fillCancelList(const ConferenceInfo::participant_list_t &oldList, const ConferenceInfo::participant_list_t &newList); - virtual void createOrUpdateConference(const std::shared_ptr<ConferenceInfo> &conferenceInfo, - const std::shared_ptr<Address> &creator) = 0; + virtual void createOrUpdateConference(const std::shared_ptr<ConferenceInfo> &conferenceInfo) = 0; virtual void processResponse(const LinphoneErrorInfo *errorCode, const std::shared_ptr<Address> conferenceAddress) = 0; diff --git a/src/conference/conference.cpp b/src/conference/conference.cpp index 195f1810ce594e9b39aeaabeeaf38819cf9ccfa9..939359a9564ee967202d3ec32403378135b45551 100644 --- a/src/conference/conference.cpp +++ b/src/conference/conference.cpp @@ -61,14 +61,11 @@ const std::string Conference::IsFocusParameter = "isfocus"; const std::string Conference::TextParameter = "text"; Conference::Conference(const shared_ptr<Core> &core, - const std::shared_ptr<const Address> &myAddress, std::shared_ptr<CallSessionListener> callSessionListener, const std::shared_ptr<const ConferenceParams> params) - : CoreAccessor(core), mConferenceId(Address(), Address(*myAddress), core->createConferenceIdParams()) { + : CoreAccessor(core) { mCallSessionListener = callSessionListener; update(*params); - mConfParams->setMe(myAddress); - if (mConfParams->videoEnabled()) { // If video is enabled, then always enable audio capabilities mConfParams->enableAudio(true); @@ -101,6 +98,27 @@ Conference::~Conference() { } // ----------------------------------------------------------------------------- +void Conference::inititializeMe() { + const auto &core = getCore(); + auto account = mConfParams->getAccount(); + if (!account) { + account = core->getDefaultAccount(); + if (account) { + lInfo() << "Using default account " << *account << " for " << *this + << " because it was not set in the conference parameters"; + mConfParams->setAccount(account); + } else { + lInfo() << "Not setting account for " << *this + << " because it was not set in the conference parameters and the core has no default account"; + } + } + + if (account) { + auto meAddress = account->getAccountParams()->getIdentityAddress()->getUri(); + mConferenceId = ConferenceId(Address(), std::move(meAddress), core->createConferenceIdParams()); + mMe = Participant::create(getSharedFromThis(), mConferenceId.getLocalAddress()); + } +} void Conference::removeListener(std::shared_ptr<ConferenceListenerInterface> listener) { mConfListeners.remove(listener); @@ -366,7 +384,7 @@ bool Conference::addParticipant(const std::shared_ptr<Address> &participantAddre } std::shared_ptr<CallSession> Conference::getMainSession() const { - return mMe->getSession(); + return mMe ? mMe->getSession() : nullptr; } bool Conference::addParticipants(const std::list<std::shared_ptr<Address>> &addresses) { @@ -1071,6 +1089,14 @@ std::map<ConferenceMediaCapabilities, bool> Conference::getMediaCapabilities() c // ----------------------------------------------------------------------------- bool Conference::isMe(const std::shared_ptr<const Address> &addr) const { + if (!mMe) { + // Cannot know if it is the me participant if it is not defined. + // This may happen when a server chat room is retrieved from the database. The me participant is not defined as + // it has already been created. The server is therefore a passive component whose task is to dispatch MESSAGE + // request or handle participants. + lDebug() << *this << ": Unable to known if the me participant is not defined"; + return false; + } if (!addr || !addr->isValid()) { lError() << *this << ": Unable to known if an invalid address is the me participant"; return false; @@ -1838,7 +1864,7 @@ int Conference::stopRecording() { if (aci) { aci->stopRecording(); } else { - lError() << "ServerConference::stopRecording(): no audio mixer."; + lError() << "Conference::stopRecording(): no audio mixer."; return -1; } return 0; diff --git a/src/conference/conference.h b/src/conference/conference.h index d474bbeeb0b62d0ec7afd4799d5f81ad44b6e9db..705a2b7f0bdc58a8a5b8d591cdb6f23dbb6e50b0 100644 --- a/src/conference/conference.h +++ b/src/conference/conference.h @@ -357,7 +357,6 @@ public: protected: explicit Conference(const std::shared_ptr<Core> &core, - const std::shared_ptr<const Address> &myAddress, std::shared_ptr<CallSessionListener> callSessionListener, const std::shared_ptr<const ConferenceParams> params); @@ -429,6 +428,7 @@ protected: void notifyNewDevice(const std::shared_ptr<ParticipantDevice> &device); virtual void configure(SalCallOp *op) = 0; + void inititializeMe(); void incrementLastNotify(); void setLastNotify(unsigned int lastNotify); diff --git a/src/conference/db-conference-scheduler.cpp b/src/conference/db-conference-scheduler.cpp index cc77bc8d1cc25843bf9a4e0e23428b44b22bf7ff..b8df1b126420daba775e76617a2d736aaee5ba0d 100644 --- a/src/conference/db-conference-scheduler.cpp +++ b/src/conference/db-conference-scheduler.cpp @@ -38,13 +38,15 @@ DBConferenceScheduler::DBConferenceScheduler(const shared_ptr<Core> &core, const } void DBConferenceScheduler::createOrUpdateConference( - BCTBX_UNUSED(const std::shared_ptr<ConferenceInfo> &conferenceInfo), const std::shared_ptr<Address> &creator) { + BCTBX_UNUSED(const std::shared_ptr<ConferenceInfo> &conferenceInfo)) { std::shared_ptr<Address> conferenceAddress = nullptr; if (getState() == State::AllocationPending) { if (mConferenceInfo->getDateTime() <= 0) { // Set start time only if a conference is going to be created mConferenceInfo->setDateTime(ms_time(NULL)); } + const auto &account = getAccount() ? getAccount() : getCore()->getDefaultAccount(); + const auto &creator = account->getAccountParams()->getIdentityAddress(); conferenceAddress = creator->clone()->toSharedPtr(); char confId[LinphonePrivate::ServerConference::sConfIdLength]; belle_sip_random_token(confId, sizeof(confId)); diff --git a/src/conference/db-conference-scheduler.h b/src/conference/db-conference-scheduler.h index 436bbc2f1474da786040f0a22bf247019f9e7f10..7ec081992ffca2b437a76b4a7c7e1325727a9997 100644 --- a/src/conference/db-conference-scheduler.h +++ b/src/conference/db-conference-scheduler.h @@ -32,8 +32,7 @@ public: DBConferenceScheduler(const std::shared_ptr<Core> &core, const std::shared_ptr<Account> &account = nullptr); virtual ~DBConferenceScheduler() = default; - virtual void createOrUpdateConference(const std::shared_ptr<ConferenceInfo> &conferenceInfo, - const std::shared_ptr<Address> &creator) override; + virtual void createOrUpdateConference(const std::shared_ptr<ConferenceInfo> &conferenceInfo) override; virtual void processResponse(const LinphoneErrorInfo *errorInfo, const std::shared_ptr<Address> conferenceAddress) override; diff --git a/src/conference/server-conference.cpp b/src/conference/server-conference.cpp index ff2e662fbe22e121b128985d009e39e4835c3d6b..55ffe1121db3fb42c338dd29afe134dcb9c6aa24 100644 --- a/src/conference/server-conference.cpp +++ b/src/conference/server-conference.cpp @@ -57,10 +57,9 @@ LINPHONE_BEGIN_NAMESPACE constexpr int SERVER_CONFIGURATION_FAILED = 1; ServerConference::ServerConference(const shared_ptr<Core> &core, - const std::shared_ptr<const Address> &myAddress, std::shared_ptr<CallSessionListener> listener, const std::shared_ptr<ConferenceParams> params) - : Conference(core, myAddress, listener, params) { + : Conference(core, listener, params) { } ServerConference::~ServerConference() { @@ -77,11 +76,13 @@ ServerConference::~ServerConference() { cleanup(); } -void ServerConference::initFromDb(BCTBX_UNUSED(const std::shared_ptr<Participant> &me), +void ServerConference::initFromDb(const std::shared_ptr<Participant> &me, const ConferenceId conferenceId, const unsigned int lastNotifyId, BCTBX_UNUSED(bool hasBeenLeft)) { - mMe = Participant::create(getSharedFromThis(), mConfParams->getMe()); + if (me) { + mMe = me->clone()->toSharedPtr(); + } setLastNotify(lastNotifyId); mConferenceId = conferenceId; getCore()->getPrivate()->registerListener(this); @@ -104,27 +105,29 @@ void ServerConference::init(SalCallOp *op, ConferenceListener *confListener) { // Set last notify to 1 in order to ensure that the 1st notify to client conference is correctly processed // Remote conference sets last notify to 0 in its constructor setLastNotify(1); - mMe = Participant::create(getSharedFromThis(), mConfParams->getMe()); + + inititializeMe(); setOrganizer(op ? Address::create(op->getFrom()) : mMe->getAddress()); + const auto &core = getCore(); createEventHandler(confListener); if (mConfParams->chatEnabled()) { mConfParams->enableLocalParticipant(false); - getCore()->getPrivate()->registerListener(this); + core->getPrivate()->registerListener(this); #ifdef HAVE_ADVANCED_IM auto chatRoom = - dynamic_pointer_cast<ServerChatRoom>((new ServerChatRoom(getCore(), getSharedFromThis()))->toSharedPtr()); + dynamic_pointer_cast<ServerChatRoom>((new ServerChatRoom(core, getSharedFromThis()))->toSharedPtr()); setChatRoom(chatRoom); #endif // HAVE_ADVANCED_IM } setState(ConferenceInterface::State::Instantiated); - LinphoneCore *lc = getCore()->getCCore(); + LinphoneCore *lc = core->getCCore(); if (op) { configure(op); } else { // Update proxy contact address to add conference ID // Do not use organizer address directly as it may lack some parameter like gruu - auto account = getCore()->lookupKnownAccount(mOrganizer, true); + auto account = core->lookupKnownAccount(mOrganizer, true); char *contactAddressStr = nullptr; if (account && account->getOp()) { contactAddressStr = sal_address_as_string(account->getOp()->getContactAddress()); @@ -153,13 +156,13 @@ void ServerConference::init(SalCallOp *op, ConferenceListener *confListener) { #endif // HAVE_ADVANCED_IM if (!eventLogEnabled) { - setConferenceId(ConferenceId(contactAddress, contactAddress, getCore()->createConferenceIdParams())); + setConferenceId(ConferenceId(contactAddress, contactAddress, core->createConferenceIdParams())); } #ifdef HAVE_DB_STORAGE const auto &conferenceInfo = createOrGetConferenceInfo(); if (conferenceInfo) { - auto &mainDb = getCore()->getPrivate()->mainDb; + auto &mainDb = core->getPrivate()->mainDb; if (mainDb) { lInfo() << "Inserting new conference information to database in order to be able to recreate the " "conference " @@ -971,7 +974,7 @@ void ServerConference::finalizeCreation() { if (createdConference) { lInfo() << "Conference [" << this << "] with address " << *conferenceAddress << " has already been created therefore no need to carry out the redirection to its address"; - } else { + } else if (mMe) { shared_ptr<CallSession> session = mMe->getSession(); if (session) { if (mConfParams->getJoiningMode() == ConferenceParams::JoiningMode::DialOut) { diff --git a/src/conference/server-conference.h b/src/conference/server-conference.h index 333f75debc76c097bd7ce8d6bec7164711e4a495..2f147b6b2e0af7fdd980845cf4e4094204ab13b6 100644 --- a/src/conference/server-conference.h +++ b/src/conference/server-conference.h @@ -47,7 +47,6 @@ public: static constexpr int sConfIdLength = 32; ServerConference(const std::shared_ptr<Core> &core, - const std::shared_ptr<const Address> &myAddress, std::shared_ptr<CallSessionListener> listener, const std::shared_ptr<ConferenceParams> params); virtual ~ServerConference(); diff --git a/src/conference/session/media-session.cpp b/src/conference/session/media-session.cpp index 7227143b36626a4ab7439d3415548a4ce56425ae..d18416b0be3d799364d053865e011a005b571810 100644 --- a/src/conference/session/media-session.cpp +++ b/src/conference/session/media-session.cpp @@ -1055,7 +1055,7 @@ void MediaSessionPrivate::setState(CallSession::State newState, const string &me if ((newState != state) && (newState != CallSession::State::StreamsRunning)) q->cancelDtmfs(); CallSessionPrivate::setState(newState, message); q->notifyCallSessionStateChangedForReporting(); - std::shared_ptr<SalMediaDescription> rmd = nullptr; + std::shared_ptr<SalMediaDescription> rmd; switch (newState) { case CallSession::State::UpdatedByRemote: // Handle specifically the case of an incoming ICE-concluded reINVITE @@ -2302,7 +2302,7 @@ void MediaSessionPrivate::addConferenceParticipantStreams(std::shared_ptr<SalMed const auto idx = std::distance(refMd->streams.cbegin(), sIt); const std::string participantsAttrValue = s.getLabel(); - std::shared_ptr<ParticipantDevice> dev = nullptr; + std::shared_ptr<ParticipantDevice> dev; if (!participantsAttrValue.empty()) { dev = conference->findParticipantDeviceByLabel(sal_stream_type_to_linphone(type), participantsAttrValue); @@ -2517,7 +2517,7 @@ void MediaSessionPrivate::makeLocalMediaDescription(bool localIsOfferer, bool isAudioConferenceEnabled = false; ConferenceLayout confLayout = ConferenceLayout::ActiveSpeaker; auto deviceState = ParticipantDevice::State::ScheduledForJoining; - std::shared_ptr<ParticipantDevice> participantDevice = nullptr; + std::shared_ptr<ParticipantDevice> participantDevice; if (conference) { const auto ¤tConfParams = conference->getCurrentParams(); const auto &conferenceState = conference->getState(); @@ -3969,10 +3969,15 @@ void MediaSessionPrivate::updateCurrentParams() const { getCurrentParams()->getPrivate()->setUpdateCallWhenIceCompleted(isUpdateSentWhenIceCompleted()); bool deviceIsScreenSharing = false; if (conference) { - const auto meDevices = conference->getMe()->getDevices(); - const auto &participantDevice = ((meDevices.size() == 0) || isInConference()) - ? conference->findParticipantDevice(q->getSharedFromThis()) - : meDevices.front(); + std::shared_ptr<ParticipantDevice> participantDevice; + if (isInConference()) { + participantDevice = conference->findParticipantDevice(q->getSharedFromThis()); + } else { + const auto meDevices = conference->getMe()->getDevices(); + if (meDevices.size() > 0) { + participantDevice = meDevices.front(); + } + } if (participantDevice) { deviceIsScreenSharing = participantDevice->screenSharingEnabled(); } @@ -4261,7 +4266,7 @@ void MediaSessionPrivate::stunAuthRequestedCb(const char *realm, const char **ha1) { L_Q(); /* Get the username from the nat policy or the proxy config */ - std::shared_ptr<Account> stunAccount = nullptr; + std::shared_ptr<Account> stunAccount; const auto &account = getDestAccount(); if (account) stunAccount = account; else { @@ -4792,10 +4797,8 @@ void MediaSession::sendVfuRequest() { // will succeed when a client creates a conference. const std::shared_ptr<Conference> MediaSession::getLocalConference() const { L_D(); - ConferenceId serverConferenceId; - shared_ptr<Conference> conference = nullptr; - + shared_ptr<Conference> conference; auto log = getLog(); const auto conferenceInfo = (log) ? log->getConferenceInfo() : nullptr; auto conferenceIdParams = getCore()->createConferenceIdParams(); @@ -5586,8 +5589,8 @@ const MediaSessionParams *MediaSession::getRemoteParams() const { shared_ptr<CallStats> MediaSession::getStats(LinphoneStreamType type) const { L_D(); if (type == LinphoneStreamTypeUnknown) return nullptr; - shared_ptr<CallStats> stats = nullptr; - shared_ptr<CallStats> statsCopy = nullptr; + shared_ptr<CallStats> stats; + shared_ptr<CallStats> statsCopy; Stream *s = d->getStream(type); if (s && (stats = s->getStats())) { statsCopy = stats->clone()->toSharedPtr(); diff --git a/src/conference/sip-conference-scheduler.cpp b/src/conference/sip-conference-scheduler.cpp index 354149ba8344fe749e3c155f334ecdda1b916835..6204f47ed6b16e24f54c9b3825405efe08397d45 100644 --- a/src/conference/sip-conference-scheduler.cpp +++ b/src/conference/sip-conference-scheduler.cpp @@ -36,8 +36,7 @@ SIPConferenceScheduler::SIPConferenceScheduler(const shared_ptr<Core> &core, con : ConferenceScheduler(core, account) { } -void SIPConferenceScheduler::createOrUpdateConference(const std::shared_ptr<ConferenceInfo> &conferenceInfo, - const std::shared_ptr<Address> &creator) { +void SIPConferenceScheduler::createOrUpdateConference(const std::shared_ptr<ConferenceInfo> &conferenceInfo) { shared_ptr<LinphonePrivate::ConferenceParams> conferenceParams = ConferenceParams::create(getCore()); conferenceParams->setAccount(getAccount()); @@ -70,7 +69,7 @@ void SIPConferenceScheduler::createOrUpdateConference(const std::shared_ptr<Conf auto ref = getSharedFromThis(); const auto &conferenceAddress = conferenceInfo->getUri(); - mSession = getCore()->createOrUpdateConferenceOnServer(conferenceParams, creator, invitees, conferenceAddress, + mSession = getCore()->createOrUpdateConferenceOnServer(conferenceParams, invitees, conferenceAddress, dynamic_pointer_cast<SIPConferenceScheduler>(ref)); if (mSession == nullptr) { lError() << "[Conference Scheduler] [" << this << "] createConferenceOnServer returned a null session!"; diff --git a/src/conference/sip-conference-scheduler.h b/src/conference/sip-conference-scheduler.h index 03303ce1ccbed1963f15121e7afd752eb0bc50d7..49297c005df577326f515a96f5b539c50841e092 100644 --- a/src/conference/sip-conference-scheduler.h +++ b/src/conference/sip-conference-scheduler.h @@ -38,8 +38,7 @@ public: virtual void onCallSessionStateChanged(const std::shared_ptr<CallSession> &session, CallSession::State state, const std::string &message) override; - virtual void createOrUpdateConference(const std::shared_ptr<ConferenceInfo> &conferenceInfo, - const std::shared_ptr<Address> &creator) override; + virtual void createOrUpdateConference(const std::shared_ptr<ConferenceInfo> &conferenceInfo) override; virtual void processResponse(const LinphoneErrorInfo *errorInfo, const std::shared_ptr<Address> conferenceAddress) override; inline std::shared_ptr<CallSession> getSession() { diff --git a/src/core/core-chat-room.cpp b/src/core/core-chat-room.cpp index 769eed7b5d3f4ae2101d7b6419abbc266ea34fc8..f81cbf1108128def367969c781956d4b69a746c0 100644 --- a/src/core/core-chat-room.cpp +++ b/src/core/core-chat-room.cpp @@ -113,7 +113,7 @@ CorePrivate::getIdentityAddressWithGruu(const std::shared_ptr<const Address> &id #endif // _MSC_VER // Base server group chat room creator shared_ptr<AbstractChatRoom> -CorePrivate::createServerChatRoom(const std::shared_ptr<const Address> &conferenceFactoryUri, +CorePrivate::createServerChatRoom(BCTBX_UNUSED(const std::shared_ptr<const Address> &conferenceFactoryUri), SalCallOp *op, const std::shared_ptr<ConferenceParams> ¶ms) { #ifdef HAVE_ADVANCED_IM @@ -135,8 +135,7 @@ CorePrivate::createServerChatRoom(const std::shared_ptr<const Address> &conferen } auto conference = dynamic_pointer_cast<ServerConference>( - (new ServerConference(q->getSharedFromThis(), conferenceFactoryUri, nullptr, newConferenceParameters)) - ->toSharedPtr()); + (new ServerConference(q->getSharedFromThis(), nullptr, newConferenceParameters))->toSharedPtr()); conference->init(op, conference.get()); return conference->getChatRoom(); #else @@ -179,8 +178,7 @@ CorePrivate::createClientChatRoom(const std::shared_ptr<const Address> &conferen } auto conference = dynamic_pointer_cast<ClientConference>( - (new ClientConference(q->getSharedFromThis(), conferenceId.getLocalAddress(), nullptr, newConferenceParameters)) - ->toSharedPtr()); + (new ClientConference(q->getSharedFromThis(), nullptr, newConferenceParameters))->toSharedPtr()); conference->initWithFocus(conferenceFactoryUri, nullptr, op, conference.get()); if (conferenceId.isValid()) { conference->setConferenceId(conferenceId); @@ -302,7 +300,6 @@ std::shared_ptr<AbstractChatRoom> CorePrivate::searchChatRoom(const std::string } shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const shared_ptr<ConferenceParams> ¶ms, - const std::shared_ptr<const Address> &localAddr, const std::list<std::shared_ptr<Address>> &participants) { L_Q(); if (!params) { @@ -322,13 +319,20 @@ shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const shared_ptr<Confer lWarning() << "Tying to create chat room with unavailable backend"; return nullptr; } - shared_ptr<AbstractChatRoom> chatRoom; + auto account = params->getAccount(); + if (!account) { + account = q->getDefaultAccount(); + } + const std::shared_ptr<const Address> localAddr = + account ? account->getAccountParams()->getIdentityAddress() : getDefaultLocalAddress(nullptr, false); + + shared_ptr<AbstractChatRoom> chatRoom; if (params->getChatParams()->getBackend() == ChatParams::Backend::FlexisipChat) { #ifdef HAVE_ADVANCED_IM - const auto &conferenceFactoryUri = Core::getConferenceFactoryAddress(q->getSharedFromThis(), localAddr); + const auto &conferenceFactoryUri = account->getAccountParams()->getConferenceFactoryAddress(); if (!conferenceFactoryUri || !conferenceFactoryUri->isValid()) { - lWarning() << "Not creating group chat room: no conference factory uri for local address [" << localAddr + lWarning() << "Not creating group chat room: no conference factory uri for local address [" << *localAddr << "]"; return nullptr; } @@ -342,9 +346,8 @@ shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const shared_ptr<Confer } } - ConferenceId conferenceId = ConferenceId(nullptr, localAddr, q->createConferenceIdParams()); + ConferenceId conferenceId(nullptr, localAddr, q->createConferenceIdParams()); chatRoom = createClientChatRoom(conferenceFactoryUri, conferenceId, nullptr, params); - if (!chatRoom) { lWarning() << "Cannot create createClientChatRoom with subject [" << params->getSubject() << "]"; return nullptr; @@ -372,23 +375,16 @@ shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const shared_ptr<Confer insertChatRoom(chatRoom); insertChatRoomWithDb(chatRoom); } else { - lInfo() << "Found an existing BasicChatRoom with this participant, using it instead of creating a new one"; + lInfo() << "Found an existing BasicChatRoom with " << *remoteAddr + << ", using it instead of creating a new one"; } } return chatRoom; } -shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const shared_ptr<ConferenceParams> ¶ms, - const std::list<std::shared_ptr<Address>> &participants) { - auto defaultLocalAddress = - getDefaultLocalAddress(nullptr, params->getChatParams()->getBackend() == ChatParams::Backend::FlexisipChat); - return createChatRoom(params, defaultLocalAddress, participants); -} - shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const std::string &subject, const std::list<std::shared_ptr<Address>> &participants) { L_Q(); - shared_ptr<ConferenceParams> params = ConferenceParams::create(q->getSharedFromThis()); params->setChatDefaults(); if (participants.size() > 1) { @@ -397,17 +393,15 @@ shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const std::string &subj } else { params->getChatParams()->setBackend(ChatParams::Backend::Basic); } - auto defaultLocalAddress = - getDefaultLocalAddress(nullptr, params->getChatParams()->getBackend() == ChatParams::Backend::FlexisipChat); + params->setAccount(q->getDefaultAccount()); params->setUtf8Subject(subject); - return createChatRoom(params, defaultLocalAddress, participants); + return createChatRoom(params, participants); } shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const shared_ptr<ConferenceParams> ¶ms, - const std::shared_ptr<Address> &localAddr, const std::shared_ptr<Address> &participant) { - const std::list<std::shared_ptr<Address>> &participants{participant}; - return createChatRoom(params, localAddr, participants); + const std::list<std::shared_ptr<Address>> participants{participant}; + return createChatRoom(params, participants); } // Assume basic chat room creation diff --git a/src/core/core-p.h b/src/core/core-p.h index 85f474e50fbee40f6bff5f42be9dd4c786d6c366..05264da6cd65415e4e6aaebc7cc9f827a1232760 100644 --- a/src/core/core-p.h +++ b/src/core/core-p.h @@ -131,15 +131,11 @@ public: long ephemeralLifeTime); std::shared_ptr<AbstractChatRoom> createClientChatRoom(const std::string &subject, bool fallback, bool encrypted); - std::shared_ptr<AbstractChatRoom> createChatRoom(const std::shared_ptr<ConferenceParams> ¶ms, - const std::shared_ptr<const Address> &localAddr, - const std::list<std::shared_ptr<Address>> &participants); std::shared_ptr<AbstractChatRoom> createChatRoom(const std::shared_ptr<ConferenceParams> ¶ms, const std::list<std::shared_ptr<Address>> &participants); std::shared_ptr<AbstractChatRoom> createChatRoom(const std::string &subject, const std::list<std::shared_ptr<Address>> &participants); std::shared_ptr<AbstractChatRoom> createChatRoom(const std::shared_ptr<ConferenceParams> ¶ms, - const std::shared_ptr<Address> &localAddr, const std::shared_ptr<Address> &participant); std::shared_ptr<AbstractChatRoom> createChatRoom(const std::shared_ptr<Address> &participant); diff --git a/src/core/core.cpp b/src/core/core.cpp index 57b3bd0ac1512b9d16b14684e983631dee28f516..242f4df012bb6a11d021d351ff5e3c1c8ecb0569 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -1891,7 +1891,8 @@ std::shared_ptr<Conference> Core::findConference(const std::shared_ptr<const Cal L_D(); for (const auto &[id, conference] : d->mConferenceById) { - if (session == conference->getMainSession()) { + const auto &conferenceSession = conference->getMainSession(); + if (conferenceSession && (session == conferenceSession)) { return conference; } } @@ -2050,7 +2051,6 @@ void Core::addConferenceScheduler(const std::shared_ptr<ConferenceScheduler> &sc } shared_ptr<CallSession> Core::createOrUpdateConferenceOnServer(const std::shared_ptr<ConferenceParams> &confParams, - const std::shared_ptr<const Address> &localAddr, const std::list<Address> &participants, const std::shared_ptr<Address> &confAddr, std::shared_ptr<CallSessionListener> listener) { @@ -2062,7 +2062,10 @@ shared_ptr<CallSession> Core::createOrUpdateConferenceOnServer(const std::shared MediaSessionParams params; params.initDefault(getSharedFromThis(), LinphoneCallOutgoing); - const auto &account = confParams->getAccount(); + auto account = confParams->getAccount(); + if (!account) { + account = getDefaultAccount(); + } params.setAccount(account); std::shared_ptr<Address> conferenceFactoryUri; @@ -2072,12 +2075,13 @@ shared_ptr<CallSession> Core::createOrUpdateConferenceOnServer(const std::shared } else { std::shared_ptr<const Address> conferenceFactoryUriRef; if (mediaEnabled) { - conferenceFactoryUriRef = Core::getAudioVideoConferenceFactoryAddress(getSharedFromThis(), localAddr); + conferenceFactoryUriRef = Core::getAudioVideoConferenceFactoryAddress(getSharedFromThis(), account); } else { - conferenceFactoryUriRef = Core::getConferenceFactoryAddress(getSharedFromThis(), localAddr); + conferenceFactoryUriRef = account->getAccountParams()->getConferenceFactoryAddress(); } if (!conferenceFactoryUriRef || !conferenceFactoryUriRef->isValid()) { - lWarning() << "Not creating conference: no conference factory uri for local address [" << *localAddr << "]"; + lWarning() << "Not creating conference: no conference factory uri for local address [" + << *account->getAccountParams()->getIdentityAddress() << "]"; return nullptr; } conferenceFactoryUri = conferenceFactoryUriRef->clone()->toSharedPtr(); @@ -2122,6 +2126,7 @@ shared_ptr<CallSession> Core::createOrUpdateConferenceOnServer(const std::shared params.getPrivate()->disableRinging(true); params.getPrivate()->enableToneIndications(false); + const auto &localAddr = account->getAccountParams()->getIdentityAddress(); auto participant = Participant::create(nullptr, localAddr); auto session = participant->createSession(getSharedFromThis(), ¶ms, true); session->addListener(listener); diff --git a/src/core/core.h b/src/core/core.h index 1063ad5feb8e3e0deb3f1f6e3d5f370100f146a6..4792c874402105b582bd3abab3a3e8068aa7f930 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -365,7 +365,6 @@ public: const std::list<LinphoneMediaEncryption> getSupportedMediaEncryptions() const; std::shared_ptr<CallSession> createOrUpdateConferenceOnServer(const std::shared_ptr<ConferenceParams> &confParams, - const std::shared_ptr<const Address> &localAddr, const std::list<Address> &participants, const std::shared_ptr<Address> &confAddr, std::shared_ptr<CallSessionListener> listener); diff --git a/src/db/main-db.cpp b/src/db/main-db.cpp index 447931206c2bd15c7a710be1096f1a2737a58933..b83614ad2f411d422c6137f82e79710a0832137c 100644 --- a/src/db/main-db.cpp +++ b/src/db/main-db.cpp @@ -6310,7 +6310,7 @@ list<shared_ptr<AbstractChatRoom>> MainDb::getChatRooms() { std::shared_ptr<Conference> conference = nullptr; if (serverMode) { params->enableLocalParticipant(false); - conference = (new ServerConference(core, localAddress, nullptr, params))->toSharedPtr(); + conference = (new ServerConference(core, nullptr, params))->toSharedPtr(); conference->initFromDb(me, conferenceId, lastNotifyId, false); chatRoom = conference->getChatRoom(); conference->setState(ConferenceInterface::State::Created); @@ -6320,7 +6320,7 @@ list<shared_ptr<AbstractChatRoom>> MainDb::getChatRooms() { continue; } bool hasBeenLeft = !!row.get<int>(8, 0); - conference = (new ClientConference(core, me->getAddress(), nullptr, params))->toSharedPtr(); + conference = (new ClientConference(core, nullptr, params))->toSharedPtr(); conference->initFromDb(me, conferenceId, lastNotifyId, hasBeenLeft); chatRoom = conference->getChatRoom(); updateFlags = confInfo && !hasBeenLeft; diff --git a/tester/conference-event-tester.cpp b/tester/conference-event-tester.cpp index 1d3651217e06fb9bf185c07f25ebb3c9b3acda48..4c1e44f864fb7557e0c574fd8b45ca4736ced0c5 100644 --- a/tester/conference-event-tester.cpp +++ b/tester/conference-event-tester.cpp @@ -747,7 +747,7 @@ L_ENABLE_ATTR_ACCESS(ServerConference, shared_ptr<ServerConferenceEventHandler>, class ConferenceEventTester : public ClientConference { public: - ConferenceEventTester(const shared_ptr<Core> &core, const std::shared_ptr<Address> &confAddr); + ConferenceEventTester(const shared_ptr<Core> &core); virtual ~ConferenceEventTester(); private: @@ -779,8 +779,9 @@ public: virtual void init(SalCallOp *op = nullptr, ConferenceListener *confListener = nullptr) override; }; -ConferenceEventTester::ConferenceEventTester(const shared_ptr<Core> &core, const std::shared_ptr<Address> &confAddr) - : ClientConference(core, confAddr, nullptr, ConferenceParams::create(core)) { +ConferenceEventTester::ConferenceEventTester(const shared_ptr<Core> &core) + : ClientConference(core, nullptr, ConferenceParams::create(core)) { + getCurrentParams()->setAccount(core->getDefaultAccount()); getCurrentParams()->enableAudio(true); } @@ -865,10 +866,9 @@ void ConferenceEventTester::onParticipantDeviceRemoved(const shared_ptr<Conferen class ServerConferenceTester : public ServerConference { public: - ServerConferenceTester(const std::shared_ptr<Core> &core, - const std::shared_ptr<Address> &myAddress, - std::shared_ptr<CallSessionListener> listener) - : ServerConference(core, myAddress, listener, ConferenceParams::create(core)) { + ServerConferenceTester(const std::shared_ptr<Core> &core, std::shared_ptr<CallSessionListener> listener) + : ServerConference(core, listener, ConferenceParams::create(core)) { + getCurrentParams()->setAccount(core->getDefaultAccount()); getCurrentParams()->enableLocalParticipant(false); getCurrentParams()->enableAudio(true); getCurrentParams()->enableChat(false); @@ -992,16 +992,15 @@ static void setParticipantAsAdmin(shared_ptr<Conference> localConf, std::shared_ void first_notify_parsing() { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneAddress *confAddress = linphone_core_interpret_url(marie->lc, confUri); - std::shared_ptr<Address> addr = Address::toCpp(confAddress)->getSharedFromThis(); - linphone_address_unref(confAddress); - shared_ptr<ConferenceEventTester> tester = dynamic_pointer_cast<ConferenceEventTester>( - (new ConferenceEventTester(marie->lc->cppPtr, addr))->toSharedPtr()); + shared_ptr<ConferenceEventTester> tester = + dynamic_pointer_cast<ConferenceEventTester>((new ConferenceEventTester(marie->lc->cppPtr))->toSharedPtr()); tester->init(); LinphoneAddress *bobAddr = linphone_core_interpret_url(marie->lc, bobUri); LinphoneAddress *aliceAddr = linphone_core_interpret_url(marie->lc, aliceUri); size_t size = strlen(first_notify) + strlen(confUri); char *notify = new char[size]; + std::shared_ptr<Address> addr = Address::toCpp(confAddress)->getSharedFromThis(); tester->setConferenceAddress(addr); const_cast<ConferenceId &>(tester->handler->getConferenceId()).setPeerAddress(addr); @@ -1031,6 +1030,7 @@ void first_notify_parsing() { bctbx_free(bobAddrStr); bctbx_free(aliceAddrStr); + linphone_address_unref(confAddress); linphone_address_unref(bobAddr); linphone_address_unref(aliceAddr); linphone_core_manager_destroy(marie); @@ -1039,16 +1039,15 @@ void first_notify_parsing() { void first_notify_with_extensions_parsing() { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneAddress *confAddress = linphone_core_interpret_url(marie->lc, confUri); - std::shared_ptr<Address> addr = Address::toCpp(confAddress)->getSharedFromThis(); - linphone_address_unref(confAddress); - shared_ptr<ConferenceEventTester> tester = dynamic_pointer_cast<ConferenceEventTester>( - (new ConferenceEventTester(marie->lc->cppPtr, addr))->toSharedPtr()); + shared_ptr<ConferenceEventTester> tester = + dynamic_pointer_cast<ConferenceEventTester>((new ConferenceEventTester(marie->lc->cppPtr))->toSharedPtr()); tester->init(); LinphoneAddress *bobAddr = linphone_core_interpret_url(marie->lc, bobUri); LinphoneAddress *aliceAddr = linphone_core_interpret_url(marie->lc, aliceUri); size_t size = strlen(first_notify) + strlen(confUri); char *notify = new char[size]; + std::shared_ptr<Address> addr = Address::toCpp(confAddress)->getSharedFromThis(); tester->setConferenceAddress(addr); const_cast<ConferenceId &>(tester->handler->getConferenceId()).setPeerAddress(addr); @@ -1078,6 +1077,7 @@ void first_notify_with_extensions_parsing() { bctbx_free(bobAddrStr); bctbx_free(aliceAddrStr); + linphone_address_unref(confAddress); linphone_address_unref(bobAddr); linphone_address_unref(aliceAddr); linphone_core_manager_destroy(marie); @@ -1086,16 +1086,15 @@ void first_notify_with_extensions_parsing() { void first_notify_parsing_wrong_conf() { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneAddress *confAddress = linphone_core_interpret_url(marie->lc, "sips:conf322@example.com"); - std::shared_ptr<Address> addr = Address::toCpp(confAddress)->getSharedFromThis(); - linphone_address_unref(confAddress); - shared_ptr<ConferenceEventTester> tester = dynamic_pointer_cast<ConferenceEventTester>( - (new ConferenceEventTester(marie->lc->cppPtr, addr))->toSharedPtr()); + shared_ptr<ConferenceEventTester> tester = + dynamic_pointer_cast<ConferenceEventTester>((new ConferenceEventTester(marie->lc->cppPtr))->toSharedPtr()); tester->init(); LinphoneAddress *bobAddr = linphone_core_interpret_url(marie->lc, bobUri); LinphoneAddress *aliceAddr = linphone_core_interpret_url(marie->lc, aliceUri); size_t size = strlen(first_notify) + strlen(confUri); char *notify = new char[size]; + std::shared_ptr<Address> addr = Address::toCpp(confAddress)->getSharedFromThis(); tester->setConferenceAddress(addr); const_cast<ConferenceId &>(tester->handler->getConferenceId()).setPeerAddress(addr); snprintf(notify, size, first_notify, confUri); @@ -1118,6 +1117,7 @@ void first_notify_parsing_wrong_conf() { bctbx_free(bobAddrStr); bctbx_free(aliceAddrStr); + linphone_address_unref(confAddress); linphone_address_unref(bobAddr); linphone_address_unref(aliceAddr); linphone_core_manager_destroy(marie); @@ -1126,10 +1126,8 @@ void first_notify_parsing_wrong_conf() { void participant_added_parsing() { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneAddress *confAddress = linphone_core_interpret_url(marie->lc, confUri); - std::shared_ptr<Address> addr = Address::toCpp(confAddress)->getSharedFromThis(); - linphone_address_unref(confAddress); - shared_ptr<ConferenceEventTester> tester = dynamic_pointer_cast<ConferenceEventTester>( - (new ConferenceEventTester(marie->lc->cppPtr, addr))->toSharedPtr()); + shared_ptr<ConferenceEventTester> tester = + dynamic_pointer_cast<ConferenceEventTester>((new ConferenceEventTester(marie->lc->cppPtr))->toSharedPtr()); tester->init(); LinphoneAddress *bobAddr = linphone_core_interpret_url(marie->lc, bobUri); LinphoneAddress *aliceAddr = linphone_core_interpret_url(marie->lc, aliceUri); @@ -1139,6 +1137,7 @@ void participant_added_parsing() { size_t size2 = strlen(participant_added_notify) + strlen(confUri); char *notify_added = new char[size2]; + std::shared_ptr<Address> addr = Address::toCpp(confAddress)->getSharedFromThis(); tester->setConferenceAddress(addr); const_cast<ConferenceId &>(tester->handler->getConferenceId()).setPeerAddress(addr); snprintf(notify, size, first_notify, confUri); @@ -1179,6 +1178,7 @@ void participant_added_parsing() { BC_ASSERT_TRUE(!tester->participants.find(frankAddrStr)->second); bctbx_free(frankAddrStr); + linphone_address_unref(confAddress); linphone_address_unref(bobAddr); linphone_address_unref(aliceAddr); linphone_address_unref(frankAddr); @@ -1189,10 +1189,8 @@ void participant_not_added_parsing() { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); setup_mgr_for_conference(marie, NULL); LinphoneAddress *confAddress = linphone_core_interpret_url(marie->lc, confUri); - std::shared_ptr<Address> addr = Address::toCpp(confAddress)->getSharedFromThis(); - linphone_address_unref(confAddress); - shared_ptr<ConferenceEventTester> tester = dynamic_pointer_cast<ConferenceEventTester>( - (new ConferenceEventTester(marie->lc->cppPtr, addr))->toSharedPtr()); + shared_ptr<ConferenceEventTester> tester = + dynamic_pointer_cast<ConferenceEventTester>((new ConferenceEventTester(marie->lc->cppPtr))->toSharedPtr()); tester->init(); LinphoneAddress *bobAddr = linphone_core_interpret_url(marie->lc, bobUri); LinphoneAddress *aliceAddr = linphone_core_interpret_url(marie->lc, aliceUri); @@ -1206,6 +1204,7 @@ void participant_not_added_parsing() { size_t size4 = strlen(participant_device_not_added_notify) + strlen(confUri) + sizeof(int); char *notify_device_not_added = new char[size4]; + std::shared_ptr<Address> addr = Address::toCpp(confAddress)->getSharedFromThis(); tester->setConferenceAddress(addr); const_cast<ConferenceId &>(tester->handler->getConferenceId()).setPeerAddress(addr); const_cast<ConferenceId &>(tester->handler->getConferenceId()) @@ -1286,6 +1285,7 @@ void participant_not_added_parsing() { tester->handler->unsubscribe(); + linphone_address_unref(confAddress); linphone_address_unref(bobAddr); linphone_address_unref(aliceAddr); linphone_address_unref(frankAddr); @@ -1295,10 +1295,8 @@ void participant_not_added_parsing() { void participant_deleted_parsing() { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneAddress *confAddress = linphone_core_interpret_url(marie->lc, confUri); - std::shared_ptr<Address> addr = Address::toCpp(confAddress)->getSharedFromThis(); - linphone_address_unref(confAddress); - shared_ptr<ConferenceEventTester> tester = dynamic_pointer_cast<ConferenceEventTester>( - (new ConferenceEventTester(marie->lc->cppPtr, addr))->toSharedPtr()); + shared_ptr<ConferenceEventTester> tester = + dynamic_pointer_cast<ConferenceEventTester>((new ConferenceEventTester(marie->lc->cppPtr))->toSharedPtr()); tester->init(); LinphoneAddress *bobAddr = linphone_core_interpret_url(marie->lc, bobUri); LinphoneAddress *aliceAddr = linphone_core_interpret_url(marie->lc, aliceUri); @@ -1307,6 +1305,7 @@ void participant_deleted_parsing() { size_t size2 = strlen(participant_deleted_notify) + strlen(confUri); char *notify_deleted = new char[size2]; + std::shared_ptr<Address> addr = Address::toCpp(confAddress)->getSharedFromThis(); tester->setConferenceAddress(addr); const_cast<ConferenceId &>(tester->handler->getConferenceId()).setPeerAddress(addr); snprintf(notify, size, first_notify, confUri); @@ -1344,6 +1343,7 @@ void participant_deleted_parsing() { bctbx_free(bobAddrStr); bctbx_free(aliceAddrStr); + linphone_address_unref(confAddress); linphone_address_unref(bobAddr); linphone_address_unref(aliceAddr); linphone_core_manager_destroy(marie); @@ -1352,10 +1352,8 @@ void participant_deleted_parsing() { void participant_admined_parsing() { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneAddress *confAddress = linphone_core_interpret_url(marie->lc, confUri); - std::shared_ptr<Address> addr = Address::toCpp(confAddress)->getSharedFromThis(); - linphone_address_unref(confAddress); - shared_ptr<ConferenceEventTester> tester = dynamic_pointer_cast<ConferenceEventTester>( - (new ConferenceEventTester(marie->lc->cppPtr, addr))->toSharedPtr()); + shared_ptr<ConferenceEventTester> tester = + dynamic_pointer_cast<ConferenceEventTester>((new ConferenceEventTester(marie->lc->cppPtr))->toSharedPtr()); tester->init(); LinphoneAddress *bobAddr = linphone_core_interpret_url(marie->lc, bobUri); LinphoneAddress *aliceAddr = linphone_core_interpret_url(marie->lc, aliceUri); @@ -1364,6 +1362,7 @@ void participant_admined_parsing() { size_t size2 = strlen(participant_admined_notify) + strlen(confUri); char *notify_admined = new char[size2]; + std::shared_ptr<Address> addr = Address::toCpp(confAddress)->getSharedFromThis(); tester->setConferenceAddress(addr); const_cast<ConferenceId &>(tester->handler->getConferenceId()).setPeerAddress(addr); snprintf(notify, size, first_notify, confUri); @@ -1400,6 +1399,7 @@ void participant_admined_parsing() { bctbx_free(bobAddrStr); bctbx_free(aliceAddrStr); + linphone_address_unref(confAddress); linphone_address_unref(bobAddr); linphone_address_unref(aliceAddr); linphone_core_manager_destroy(marie); @@ -1408,10 +1408,8 @@ void participant_admined_parsing() { void participant_unadmined_parsing() { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneAddress *confAddress = linphone_core_interpret_url(marie->lc, confUri); - std::shared_ptr<Address> addr = Address::toCpp(confAddress)->getSharedFromThis(); - linphone_address_unref(confAddress); - shared_ptr<ConferenceEventTester> tester = dynamic_pointer_cast<ConferenceEventTester>( - (new ConferenceEventTester(marie->lc->cppPtr, addr))->toSharedPtr()); + shared_ptr<ConferenceEventTester> tester = + dynamic_pointer_cast<ConferenceEventTester>((new ConferenceEventTester(marie->lc->cppPtr))->toSharedPtr()); tester->init(); LinphoneAddress *bobAddr = linphone_core_interpret_url(marie->lc, bobUri); LinphoneAddress *aliceAddr = linphone_core_interpret_url(marie->lc, aliceUri); @@ -1420,6 +1418,7 @@ void participant_unadmined_parsing() { size_t size2 = strlen(participant_unadmined_notify) + strlen(confUri); char *notify_unadmined = new char[size2]; + std::shared_ptr<Address> addr = Address::toCpp(confAddress)->getSharedFromThis(); tester->setConferenceAddress(addr); const_cast<ConferenceId &>(tester->handler->getConferenceId()).setPeerAddress(addr); snprintf(notify, size, first_notify, confUri); @@ -1456,6 +1455,7 @@ void participant_unadmined_parsing() { bctbx_free(bobAddrStr); bctbx_free(aliceAddrStr); + linphone_address_unref(confAddress); linphone_address_unref(bobAddr); linphone_address_unref(aliceAddr); linphone_core_manager_destroy(marie); @@ -1465,14 +1465,13 @@ void send_first_notify() { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); - std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); - shared_ptr<ConferenceEventTester> tester = dynamic_pointer_cast<ConferenceEventTester>( - (new ConferenceEventTester(marie->lc->cppPtr, addr))->toSharedPtr()); + shared_ptr<ConferenceEventTester> tester = + dynamic_pointer_cast<ConferenceEventTester>((new ConferenceEventTester(marie->lc->cppPtr))->toSharedPtr()); tester->init(); auto params = ConferenceParams::create(pauline->lc->cppPtr); params->enableAudio(true); - shared_ptr<Conference> localConf = - (new ServerConference(pauline->lc->cppPtr, addr, nullptr, params))->toSharedPtr(); + params->enableLocalParticipant(false); + shared_ptr<Conference> localConf = (new ServerConference(pauline->lc->cppPtr, nullptr, params))->toSharedPtr(); localConf->init(); std::shared_ptr<ConferenceListenerInterfaceTester> confListener = std::make_shared<ConferenceListenerInterfaceTester>(); @@ -1493,6 +1492,7 @@ void send_first_notify() { ServerConferenceEventHandler *localHandler = (L_ATTR_GET(dynamic_pointer_cast<ServerConference>(localConf).get(), mEventHandler)).get(); localConf->setState(ConferenceInterface::State::Instantiated); + std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); localConf->setConferenceAddress(addr); auto content = localHandler->createNotifyFullState(NULL); @@ -1516,9 +1516,7 @@ void send_added_notify_through_address() { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); - std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); - shared_ptr<ServerConferenceTester> localConf = - make_shared<ServerConferenceTester>(pauline->lc->cppPtr, addr, nullptr); + shared_ptr<ServerConferenceTester> localConf = make_shared<ServerConferenceTester>(pauline->lc->cppPtr, nullptr); localConf->init(); std::shared_ptr<ConferenceListenerInterfaceTester> confListener = std::make_shared<ConferenceListenerInterfaceTester>(); @@ -1537,6 +1535,7 @@ void send_added_notify_through_address() { localConf->addParticipant(aliceAddr); setParticipantAsAdmin(localConf, aliceAddr, true); localConf->setState(ConferenceInterface::State::Instantiated); + std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); localConf->setConferenceAddress(addr); BC_ASSERT_EQUAL(confListener->participants.size(), 2, size_t, "%zu"); BC_ASSERT_EQUAL(confListener->participantDevices.size(), 2, size_t, "%zu"); @@ -1866,7 +1865,7 @@ add_participant_to_conference_through_call(bctbx_list_t **mgrs, size_t increment = 0; if (participantSize == 0) { // Also me is added as participant - increment = 2; + increment = 1 + ((conf->getCurrentParams()->localParticipantEnabled()) ? 1 : 0); } else { increment = 1; } @@ -1874,11 +1873,12 @@ add_participant_to_conference_through_call(bctbx_list_t **mgrs, BC_ASSERT_EQUAL(confListener->participantDevices.size(), (participantDeviceSize + increment), size_t, "%zu"); if (participantCall) { - auto cppAddress = Call::toCpp(participantCall)->getToAddress()->clone()->toSharedPtr(); + auto cppAddress = Call::toCpp(participantCall)->getLog()->getToAddress()->clone()->toSharedPtr(); auto addressParams = cppAddress->getUriParams(); for (const auto &[name, value] : addressParams) { cppAddress->removeUriParam(name); } + BC_ASSERT_TRUE(linphone_address_weak_equal(cppAddress->toC(), participant_mgr->identity)); const auto participant = confListener->participants.find(cppAddress->asStringUriOnly()); BC_ASSERT_TRUE(participant != confListener->participants.end()); @@ -1925,13 +1925,11 @@ void send_added_notify_through_call() { bctbx_list_t *mgrs = NULL; mgrs = bctbx_list_append(mgrs, pauline); - std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); stats initialPaulineStats = pauline->stat; { auto params = ConferenceParams::create(pauline->lc->cppPtr); params->enableAudio(true); - shared_ptr<Conference> localConf = - (new ServerConference(pauline->lc->cppPtr, addr, nullptr, params))->toSharedPtr(); + shared_ptr<Conference> localConf = (new ServerConference(pauline->lc->cppPtr, nullptr, params))->toSharedPtr(); localConf->init(); BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneConferenceStateCreationPending, @@ -2006,14 +2004,12 @@ void send_removed_notify_through_call() { bctbx_list_t *removed_mgrs = NULL; - std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); stats initialPaulineStats = pauline->stat; - { auto params = ConferenceParams::create(pauline->lc->cppPtr); params->enableAudio(true); - shared_ptr<Conference> localConf = - (new ServerConference(pauline->lc->cppPtr, addr, nullptr, params))->toSharedPtr(); + params->enableLocalParticipant(false); + shared_ptr<Conference> localConf = (new ServerConference(pauline->lc->cppPtr, nullptr, params))->toSharedPtr(); localConf->init(); BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneConferenceStateCreationPending, @@ -2105,9 +2101,7 @@ void send_removed_notify() { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); - std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); - shared_ptr<ServerConferenceTester> localConf = - make_shared<ServerConferenceTester>(pauline->lc->cppPtr, addr, nullptr); + shared_ptr<ServerConferenceTester> localConf = make_shared<ServerConferenceTester>(pauline->lc->cppPtr, nullptr); localConf->init(); std::shared_ptr<ConferenceListenerInterfaceTester> confListener = std::make_shared<ConferenceListenerInterfaceTester>(); @@ -2123,6 +2117,7 @@ void send_removed_notify() { localConf->addParticipant(aliceAddr); setParticipantAsAdmin(localConf, aliceAddr, true); localConf->setState(ConferenceInterface::State::Instantiated); + std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); localConf->setConferenceAddress(addr); BC_ASSERT_EQUAL(confListener->participants.size(), 2, size_t, "%zu"); @@ -2153,9 +2148,7 @@ void send_admined_notify() { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); - std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); - shared_ptr<ServerConferenceTester> localConf = - make_shared<ServerConferenceTester>(pauline->lc->cppPtr, addr, nullptr); + shared_ptr<ServerConferenceTester> localConf = make_shared<ServerConferenceTester>(pauline->lc->cppPtr, nullptr); localConf->init(); std::shared_ptr<ConferenceListenerInterfaceTester> confListener = std::make_shared<ConferenceListenerInterfaceTester>(); @@ -2171,6 +2164,7 @@ void send_admined_notify() { localConf->addParticipant(aliceAddr); setParticipantAsAdmin(localConf, aliceAddr, true); localConf->setState(ConferenceInterface::State::Instantiated); + std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); localConf->setConferenceAddress(addr); BC_ASSERT_EQUAL(confListener->participants.size(), 2, size_t, "%zu"); @@ -2201,9 +2195,7 @@ void send_unadmined_notify() { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); - std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); - shared_ptr<ServerConferenceTester> localConf = - make_shared<ServerConferenceTester>(pauline->lc->cppPtr, addr, nullptr); + shared_ptr<ServerConferenceTester> localConf = make_shared<ServerConferenceTester>(pauline->lc->cppPtr, nullptr); localConf->init(); std::shared_ptr<ConferenceListenerInterfaceTester> confListener = std::make_shared<ConferenceListenerInterfaceTester>(); @@ -2219,6 +2211,7 @@ void send_unadmined_notify() { localConf->addParticipant(aliceAddr); setParticipantAsAdmin(localConf, aliceAddr, true); localConf->setState(ConferenceInterface::State::Instantiated); + std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); localConf->setConferenceAddress(addr); BC_ASSERT_EQUAL(confListener->participants.size(), 2, size_t, "%zu"); @@ -2247,9 +2240,8 @@ void send_subject_changed_notify() { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); - std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); shared_ptr<ServerConferenceTester> localConf = dynamic_pointer_cast<ServerConferenceTester>( - (new ServerConferenceTester(pauline->lc->cppPtr, addr, nullptr))->toSharedPtr()); + (new ServerConferenceTester(pauline->lc->cppPtr, nullptr))->toSharedPtr()); localConf->init(); std::shared_ptr<ConferenceListenerInterfaceTester> confListener = std::make_shared<ConferenceListenerInterfaceTester>(); @@ -2266,6 +2258,7 @@ void send_subject_changed_notify() { localConf->setSubject("A random test subject"); setParticipantAsAdmin(localConf, aliceAddr, true); localConf->setState(ConferenceInterface::State::Instantiated); + std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); localConf->setConferenceAddress(addr); BC_ASSERT_STRING_EQUAL(confListener->confSubject.c_str(), "A random test subject"); @@ -2301,8 +2294,7 @@ void send_device_added_notify() { _linphone_core_add_callbacks(pauline->lc, cbs, TRUE); linphone_core_cbs_unref(cbs); - std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); - shared_ptr<Conference> localConf = (new ServerConferenceTester(pauline->lc->cppPtr, addr, nullptr))->toSharedPtr(); + shared_ptr<Conference> localConf = (new ServerConferenceTester(pauline->lc->cppPtr, nullptr))->toSharedPtr(); ; localConf->init(); std::shared_ptr<ConferenceListenerInterfaceTester> confListener = @@ -2320,6 +2312,7 @@ void send_device_added_notify() { shared_ptr<Participant> alice = localConf->findParticipant(aliceAddr); setParticipantAsAdmin(localConf, aliceAddr, true); localConf->setState(ConferenceInterface::State::Instantiated); + std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); localConf->setConferenceAddress(addr); BC_ASSERT_EQUAL(confListener->participantDevices.size(), 2, size_t, "%zu"); BC_ASSERT_TRUE(confListener->participantDevices.find(bobAddr->toString()) != @@ -2398,8 +2391,7 @@ void send_device_added_notify() { void send_device_removed_notify() { LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); - std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); - shared_ptr<Conference> localConf = (new ServerConferenceTester(pauline->lc->cppPtr, addr, nullptr))->toSharedPtr(); + shared_ptr<Conference> localConf = (new ServerConferenceTester(pauline->lc->cppPtr, nullptr))->toSharedPtr(); localConf->init(); std::shared_ptr<ConferenceListenerInterfaceTester> confListener = std::make_shared<ConferenceListenerInterfaceTester>(); @@ -2417,6 +2409,7 @@ void send_device_removed_notify() { shared_ptr<Participant> alice = localConf->findParticipant(aliceAddr); setParticipantAsAdmin(localConf, aliceAddr, true); localConf->setState(ConferenceInterface::State::Instantiated); + std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); localConf->setConferenceAddress(addr); BC_ASSERT_EQUAL(confListener->participantDevices.size(), 2, size_t, "%zu"); @@ -2454,16 +2447,14 @@ void one_to_one_keyword() { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); - std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); - shared_ptr<ConferenceEventTester> tester = dynamic_pointer_cast<ConferenceEventTester>( - (new ConferenceEventTester(marie->lc->cppPtr, addr))->toSharedPtr()); + shared_ptr<ConferenceEventTester> tester = + dynamic_pointer_cast<ConferenceEventTester>((new ConferenceEventTester(marie->lc->cppPtr))->toSharedPtr()); tester->init(); auto params = ConferenceParams::create(pauline->lc->cppPtr); params->enableAudio(false); params->enableChat(true); params->setGroup(false); - shared_ptr<Conference> localConf = - (new ServerConference(pauline->lc->cppPtr, addr, nullptr, params))->toSharedPtr(); + shared_ptr<Conference> localConf = (new ServerConference(pauline->lc->cppPtr, nullptr, params))->toSharedPtr(); localConf->init(); std::shared_ptr<ConferenceListenerInterfaceTester> confListener = std::make_shared<ConferenceListenerInterfaceTester>(); @@ -2472,6 +2463,8 @@ void one_to_one_keyword() { std::shared_ptr<Address> bobAddr = Address::toCpp(cBobAddr)->getSharedFromThis(); linphone_address_unref(cBobAddr); + std::shared_ptr<Address> addr = Address::toCpp(pauline->identity)->getSharedFromThis(); + // Create basic chat room with OneToOne capability to ensure that one to one is added to notify pauline->lc->cppPtr->getOrCreateBasicChatRoom(addr, addr); diff --git a/tester/group_chat_tester.c b/tester/group_chat_tester.c index 74bb37d691870f8d092987f8143e36afa423f87c..96818e65b85ee0f309196ff228c2f0f9e68f320d 100644 --- a/tester/group_chat_tester.c +++ b/tester/group_chat_tester.c @@ -6223,8 +6223,7 @@ static void basic_chat_room_with_cpim_base(bool_t use_gruu) { linphone_conference_params_enable_group(marie_params, FALSE); LinphoneChatParams *marie_chat_params = linphone_conference_params_get_chat_params(marie_params); linphone_chat_params_set_backend(marie_chat_params, LinphoneChatRoomBackendBasic); - LinphoneChatRoom *marieCr = - linphone_core_create_chat_room_7(marie->lc, marie_params, marie->identity, participantsAddresses); + LinphoneChatRoom *marieCr = linphone_core_create_chat_room_7(marie->lc, marie_params, participantsAddresses); bctbx_list_free(participantsAddresses); participantsAddresses = NULL; linphone_chat_room_params_unref(marie_params); diff --git a/tester/local-conference-tester-functions.cpp b/tester/local-conference-tester-functions.cpp index e5c81fd972854d9fca24caf0e0d0ebbe321aac11..8f7e62c1c9d0608b722e9c1196e3740fae18846a 100644 --- a/tester/local-conference-tester-functions.cpp +++ b/tester/local-conference-tester-functions.cpp @@ -7299,12 +7299,21 @@ void create_conference_with_chat_base(LinphoneConferenceSecurityLevel security_l liblinphone_tester_sip_timeout)); } + const LinphoneAddress *from = ((mgr == marie.getCMgr()) || (start_time > 0)) ? mgr->identity : confAddr; + const LinphoneAddress *to = ((mgr == marie.getCMgr()) || (start_time > 0)) ? confAddr : mgr->identity; + LinphoneCall *pcall = linphone_core_get_call_by_remote_address2(mgr->lc, confAddr); BC_ASSERT_PTR_NOT_NULL(pcall); if (pcall) { const LinphoneCallParams *call_cparams = linphone_call_get_current_params(pcall); const LinphoneMediaEncryption pcall_enc = linphone_call_params_get_media_encryption(call_cparams); BC_ASSERT_EQUAL(pcall_enc, encryption, int, "%d"); + LinphoneCallLog *call_log = linphone_call_get_call_log(pcall); + BC_ASSERT_PTR_NOT_NULL(call_log); + if (call_log) { + BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_log_get_from_address(call_log), from)); + BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_log_get_to_address(call_log), to)); + } } LinphoneCall *ccall = linphone_core_get_call_by_remote_address2(focus.getLc(), mgr->identity); BC_ASSERT_PTR_NOT_NULL(ccall); @@ -7312,6 +7321,12 @@ void create_conference_with_chat_base(LinphoneConferenceSecurityLevel security_l const LinphoneCallParams *call_cparams = linphone_call_get_current_params(ccall); const LinphoneMediaEncryption ccall_enc = linphone_call_params_get_media_encryption(call_cparams); BC_ASSERT_EQUAL(ccall_enc, encryption, int, "%d"); + LinphoneCallLog *call_log = linphone_call_get_call_log(ccall); + BC_ASSERT_PTR_NOT_NULL(call_log); + if (call_log) { + BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_log_get_from_address(call_log), from)); + BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_log_get_to_address(call_log), to)); + } } LinphoneAddress *deviceAddr = @@ -7411,6 +7426,36 @@ void create_conference_with_chat_base(LinphoneConferenceSecurityLevel security_l return nb_devices == 5; })); } + + const LinphoneAddress *from = ((mgr == marie.getCMgr()) || (start_time > 0)) ? mgr->identity : confAddr; + const LinphoneAddress *to = ((mgr == marie.getCMgr()) || (start_time > 0)) ? confAddr : mgr->identity; + + LinphoneCall *pcall = linphone_core_get_call_by_remote_address2(mgr->lc, confAddr); + BC_ASSERT_PTR_NOT_NULL(pcall); + if (pcall) { + const LinphoneCallParams *call_cparams = linphone_call_get_current_params(pcall); + const LinphoneMediaEncryption pcall_enc = linphone_call_params_get_media_encryption(call_cparams); + BC_ASSERT_EQUAL(pcall_enc, encryption, int, "%d"); + LinphoneCallLog *call_log = linphone_call_get_call_log(pcall); + BC_ASSERT_PTR_NOT_NULL(call_log); + if (call_log) { + BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_log_get_from_address(call_log), from)); + BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_log_get_to_address(call_log), to)); + } + } + LinphoneCall *ccall = linphone_core_get_call_by_remote_address2(focus.getLc(), mgr->identity); + BC_ASSERT_PTR_NOT_NULL(ccall); + if (ccall) { + const LinphoneCallParams *call_cparams = linphone_call_get_current_params(ccall); + const LinphoneMediaEncryption ccall_enc = linphone_call_params_get_media_encryption(call_cparams); + BC_ASSERT_EQUAL(ccall_enc, encryption, int, "%d"); + LinphoneCallLog *call_log = linphone_call_get_call_log(ccall); + BC_ASSERT_PTR_NOT_NULL(call_log); + if (call_log) { + BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_log_get_from_address(call_log), from)); + BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_log_get_to_address(call_log), to)); + } + } } const std::initializer_list<std::reference_wrapper<ClientConference>> cores2{marie, laure, pauline, michelle, @@ -12168,6 +12213,34 @@ void create_conference_dial_out_base(LinphoneConferenceLayout layout, !!((mgr == marie.getCMgr()) ? linphone_video_activation_policy_get_automatically_initiate(mgr_pol) : linphone_video_activation_policy_get_automatically_accept(mgr_pol)); + if (mgr != focus.getCMgr()) { + const LinphoneAddress *from = (mgr == marie.getCMgr()) ? mgr->identity : confAddr; + const LinphoneAddress *to = (mgr == marie.getCMgr()) ? confAddr : mgr->identity; + + LinphoneCall *pcall = linphone_core_get_call_by_remote_address2(mgr->lc, confAddr); + BC_ASSERT_PTR_NOT_NULL(pcall); + if (pcall) { + LinphoneCallLog *call_log = linphone_call_get_call_log(pcall); + BC_ASSERT_PTR_NOT_NULL(call_log); + if (call_log) { + BC_ASSERT_TRUE( + linphone_address_weak_equal(linphone_call_log_get_from_address(call_log), from)); + BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_log_get_to_address(call_log), to)); + } + } + LinphoneCall *ccall = linphone_core_get_call_by_remote_address2(focus.getLc(), mgr->identity); + BC_ASSERT_PTR_NOT_NULL(ccall); + if (ccall) { + LinphoneCallLog *call_log = linphone_call_get_call_log(ccall); + BC_ASSERT_PTR_NOT_NULL(call_log); + if (call_log) { + BC_ASSERT_TRUE( + linphone_address_weak_equal(linphone_call_log_get_from_address(call_log), from)); + BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_log_get_to_address(call_log), to)); + } + } + } + if (pconference) { int no_participants = 0; if (mgr == focus.getCMgr()) { diff --git a/tester/local-scheduled-conference-tester.cpp b/tester/local-scheduled-conference-tester.cpp index e8ed163a408c073d7beef8200cef5fa4cae647f7..3dc702ba51e78db8f33bc30a1d0966bf34089d20 100644 --- a/tester/local-scheduled-conference-tester.cpp +++ b/tester/local-scheduled-conference-tester.cpp @@ -6992,7 +6992,7 @@ test_suite_t local_conference_test_suite_scheduled_conference_advanced = { }; test_suite_t local_conference_test_suite_scheduled_conference_audio_only_participant = { - "Local conference tester (Audio only participants)", + "Local conference tester (Scheduled Conference with Audio only participants)", NULL, NULL, liblinphone_tester_before_each, @@ -7005,7 +7005,7 @@ test_suite_t local_conference_test_suite_scheduled_conference_audio_only_partici }; test_suite_t local_conference_test_suite_scheduled_conference_with_screen_sharing = { - "Local conference tester (Screen sharing)", + "Local conference tester (Scheduled Conference with Screen sharing)", NULL, NULL, liblinphone_tester_before_each, @@ -7018,7 +7018,7 @@ test_suite_t local_conference_test_suite_scheduled_conference_with_screen_sharin }; test_suite_t local_conference_test_suite_scheduled_conference_with_chat = { - "Local conference tester (Conference with chat)", + "Local conference tester (Scheduled Conference with chat)", NULL, NULL, liblinphone_tester_before_each, diff --git a/tester/tester.c b/tester/tester.c index b216e5026ea6348d440528bc9bae56e42d831a2f..4467d6909b0378f79e6f465cbfe55a3ccabe3adc 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -686,7 +686,7 @@ static void conference_state_changed(LinphoneConference *conference, LinphoneCon ms_free(newStateStr); if ((newState != LinphoneConferenceStateNone) && (newState != LinphoneConferenceStateInstantiated) && - (newState != LinphoneConferenceStateCreationPending)) { + (newState != LinphoneConferenceStateCreationPending) && !linphone_core_conference_server_enabled(core)) { LinphoneParticipant *me = linphone_conference_get_me(conference); BC_ASSERT_PTR_NOT_NULL(me); }