local_scheduled_conference_tester.cpp 136.93 KiB
/*
 * copyright (c) 2010-2023 belledonne communications sarl.
 * This file is part of Liblinphone
 * (see https://gitlab.linphone.org/BC/public/liblinphone).
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "conference/conference-info.h"
#include "liblinphone_tester.h"
#include "local_conference_tester_functions.h"
#include "shared_tester_functions.h"
namespace LinphoneTest {
static void call_to_inexisting_conference_address(void) {
	Focus focus("chloe_rc");
	{ // to make sure focus is destroyed after clients.
		ClientConference marie("marie_rc", focus.getConferenceFactoryAddress());
		bctbx_list_t *coresList = NULL;
		coresList = bctbx_list_append(coresList, focus.getLc());
		coresList = bctbx_list_append(coresList, marie.getLc());
		focus.registerAsParticipantDevice(marie);
		LinphoneAddress *confAddr = linphone_address_new(L_STRING_TO_C(focus.getIdentity().toString()));
		linphone_address_set_uri_param(confAddr, "conf-id", "xxxxx");
		stats marie_stat = marie.getStats();
		LinphoneCallParams *new_params = linphone_core_create_call_params(marie.getLc(), nullptr);
		linphone_core_invite_address_with_params_2(marie.getLc(), confAddr, new_params, NULL, nullptr);
		linphone_call_params_unref(new_params);
		BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneCallOutgoingInit,
		                             marie_stat.number_of_LinphoneCallOutgoingInit + 1,
		                             liblinphone_tester_sip_timeout));
		BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneCallError,
		                             marie_stat.number_of_LinphoneCallError + 1, liblinphone_tester_sip_timeout));
		BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneCallReleased,
		                             marie_stat.number_of_LinphoneCallReleased + 1, liblinphone_tester_sip_timeout));
		linphone_address_unref(confAddr);
		bctbx_list_free(coresList);
static void create_conference_on_unresponsive_server(void) {
	Focus focus("chloe_rc");
	{ // to make sure focus is destroyed after clients.
		ClientConference marie("marie_rc", focus.getConferenceFactoryAddress());
		focus.registerAsParticipantDevice(marie);
		setup_conference_info_cbs(marie.getCMgr());
		linphone_core_set_file_transfer_server(marie.getLc(), file_transfer_url);
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
linphone_core_set_conference_participant_list_type(focus.getLc(), LinphoneConferenceParticipantListTypeOpen); bctbx_list_t *coresList = bctbx_list_append(NULL, focus.getLc()); coresList = bctbx_list_append(coresList, marie.getLc()); // Wait for 25s to make sure the request times out int request_timeout_wait = 25000; time_t start_time = ms_time(NULL) - 60; time_t end_time = start_time + 600; const char *subject = "Colleagues"; const char *description = "Tom Black"; LinphoneConferenceSecurityLevel security_level = LinphoneConferenceSecurityLevelEndToEnd; bctbx_list_t *participants_info = NULL; LinphoneParticipantRole role = LinphoneParticipantRoleSpeaker; const char *domain = linphone_address_get_domain(marie.getCMgr()->identity); char user_address[100]; for (int idx = 0; idx < 180; idx++) { snprintf(user_address, sizeof(user_address), "sip:happyuser%0d@%s", idx, domain); LinphoneAddress *user = linphone_factory_create_address(linphone_factory_get(), user_address); add_participant_info_to_list(&participants_info, user, role, -1); if (role == LinphoneParticipantRoleSpeaker) { role = LinphoneParticipantRoleListener; } else if (role == LinphoneParticipantRoleListener) { role = LinphoneParticipantRoleUnknown; } else if (role == LinphoneParticipantRoleUnknown) { role = LinphoneParticipantRoleSpeaker; } linphone_address_unref(user); } // Turn off Chloe's network linphone_core_set_network_reachable(focus.getLc(), FALSE); stats marie_stat = marie.getStats(); // Marie creates a conference scheduler LinphoneConferenceScheduler *conference_scheduler = linphone_core_create_conference_scheduler(marie.getLc()); LinphoneConferenceSchedulerCbs *cbs = linphone_factory_create_conference_scheduler_cbs(linphone_factory_get()); linphone_conference_scheduler_cbs_set_state_changed(cbs, conference_scheduler_state_changed); linphone_conference_scheduler_cbs_set_invitations_sent(cbs, conference_scheduler_invitations_sent); linphone_conference_scheduler_add_callbacks(conference_scheduler, cbs); linphone_conference_scheduler_cbs_unref(cbs); LinphoneConferenceInfo *conf_info = linphone_conference_info_new(); LinphoneAccount *default_account = linphone_core_get_default_account(marie.getLc()); LinphoneAddress *organizer_address = default_account ? linphone_address_clone(linphone_account_params_get_identity_address( linphone_account_get_params(default_account))) : linphone_address_new(linphone_core_get_identity(marie.getLc())); linphone_conference_info_set_organizer(conf_info, organizer_address); linphone_conference_info_set_participant_infos(conf_info, participants_info); linphone_conference_info_set_duration( conf_info, (int)((end_time - start_time) / 60)); // duration is expected to be set in minutes linphone_conference_info_set_date_time(conf_info, start_time); linphone_conference_info_set_subject(conf_info, subject); linphone_conference_info_set_description(conf_info, description); linphone_conference_info_set_security_level(conf_info, security_level); linphone_conference_scheduler_set_info(conference_scheduler, conf_info); BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_ConferenceSchedulerStateAllocationPending, marie_stat.number_of_ConferenceSchedulerStateAllocationPending + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_ConferenceSchedulerStateError, marie_stat.number_of_ConferenceSchedulerStateError + 1, request_timeout_wait));
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
// Marie retries to create a conference and she takes the opportunity to change the duration linphone_conference_info_set_duration( conf_info, (int)((3 * end_time - start_time) / 60)); // duration is expected to be set in minutes linphone_conference_scheduler_set_info(conference_scheduler, conf_info); BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_ConferenceSchedulerStateUpdating, marie_stat.number_of_ConferenceSchedulerStateUpdating + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_ConferenceSchedulerStateError, marie_stat.number_of_ConferenceSchedulerStateError + 2, request_timeout_wait)); linphone_conference_info_unref(conf_info); bctbx_list_free_with_data(participants_info, (bctbx_list_free_func)linphone_participant_info_unref); if (organizer_address) linphone_address_unref(organizer_address); linphone_conference_scheduler_unref(conference_scheduler); bctbx_list_free(coresList); } } static void create_simple_conference(void) { create_conference_base(ms_time(NULL), -1, FALSE, LinphoneConferenceParticipantListTypeOpen, FALSE, LinphoneMediaEncryptionNone, FALSE, LinphoneConferenceLayoutGrid, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, LinphoneMediaDirectionRecvOnly, FALSE, LinphoneConferenceSecurityLevelNone, {LinphoneParticipantRoleSpeaker, LinphoneParticipantRoleListener}); } static void create_simple_point_to_point_encrypted_conference(void) { create_conference_base( ms_time(NULL), -1, FALSE, LinphoneConferenceParticipantListTypeOpen, FALSE, LinphoneMediaEncryptionNone, FALSE, LinphoneConferenceLayoutGrid, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, LinphoneMediaDirectionRecvOnly, FALSE, LinphoneConferenceSecurityLevelPointToPoint, {LinphoneParticipantRoleSpeaker, LinphoneParticipantRoleListener}); } static void create_simple_end_to_end_encrypted_conference(void) { create_conference_base(ms_time(NULL), -1, FALSE, LinphoneConferenceParticipantListTypeOpen, FALSE, LinphoneMediaEncryptionNone, FALSE, LinphoneConferenceLayoutGrid, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, LinphoneMediaDirectionRecvOnly, FALSE, LinphoneConferenceSecurityLevelEndToEnd, {LinphoneParticipantRoleSpeaker, LinphoneParticipantRoleListener}); } static void create_simple_conference_with_server_restart(void) { create_conference_base(ms_time(NULL), -1, FALSE, LinphoneConferenceParticipantListTypeOpen, FALSE, LinphoneMediaEncryptionNone, FALSE, LinphoneConferenceLayoutGrid, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, LinphoneMediaDirectionRecvOnly, TRUE, LinphoneConferenceSecurityLevelNone, {LinphoneParticipantRoleSpeaker, LinphoneParticipantRoleListener}); } static void create_simple_conference_with_client_restart(void) { create_conference_base(ms_time(NULL), -1, FALSE, LinphoneConferenceParticipantListTypeOpen, FALSE, LinphoneMediaEncryptionNone, FALSE, LinphoneConferenceLayoutGrid, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, LinphoneMediaDirectionRecvOnly, TRUE, LinphoneConferenceSecurityLevelNone, {LinphoneParticipantRoleSpeaker, LinphoneParticipantRoleListener}); } static void create_simple_zrtp_conference(void) { create_conference_base( ms_time(NULL), -1, FALSE, LinphoneConferenceParticipantListTypeOpen, FALSE, LinphoneMediaEncryptionZRTP, TRUE, LinphoneConferenceLayoutActiveSpeaker, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, LinphoneMediaDirectionRecvOnly, FALSE, LinphoneConferenceSecurityLevelNone, {LinphoneParticipantRoleSpeaker, LinphoneParticipantRoleListener}); } static void create_simple_dtls_conference(void) { create_conference_base( ms_time(NULL), -1, FALSE, LinphoneConferenceParticipantListTypeOpen, FALSE, LinphoneMediaEncryptionDTLS, TRUE, LinphoneConferenceLayoutActiveSpeaker, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, LinphoneMediaDirectionRecvOnly, FALSE, LinphoneConferenceSecurityLevelNone, {LinphoneParticipantRoleSpeaker, LinphoneParticipantRoleListener}); }
211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
static void create_simple_srtp_conference(void) { create_conference_base(ms_time(NULL), -1, FALSE, LinphoneConferenceParticipantListTypeOpen, FALSE, LinphoneMediaEncryptionSRTP, TRUE, LinphoneConferenceLayoutGrid, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, LinphoneMediaDirectionRecvOnly, FALSE, LinphoneConferenceSecurityLevelNone, {LinphoneParticipantRoleSpeaker, LinphoneParticipantRoleListener}); } static void create_conference_with_only_speakers_and_uninvited_participant(void) { create_conference_base(ms_time(NULL), -1, TRUE, LinphoneConferenceParticipantListTypeOpen, FALSE, LinphoneMediaEncryptionNone, TRUE, LinphoneConferenceLayoutActiveSpeaker, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, LinphoneMediaDirectionSendRecv, FALSE, LinphoneConferenceSecurityLevelNone, {LinphoneParticipantRoleSpeaker}); } /* static void create_conference_with_only_listeners_and_uninvited_participant(void) { create_conference_base(ms_time(NULL), -1, TRUE, LinphoneConferenceParticipantListTypeOpen, TRUE, LinphoneMediaEncryptionNone, TRUE, LinphoneConferenceLayoutGrid, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, LinphoneMediaDirectionSendRecv, TRUE, LinphoneConferenceSecurityLevelNone, {LinphoneParticipantRoleListener}); } */ static void create_conference_with_uninvited_participant(void) { create_conference_base(ms_time(NULL), -1, TRUE, LinphoneConferenceParticipantListTypeOpen, TRUE, LinphoneMediaEncryptionNone, TRUE, LinphoneConferenceLayoutGrid, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, LinphoneMediaDirectionRecvOnly, TRUE, LinphoneConferenceSecurityLevelNone, {LinphoneParticipantRoleSpeaker, LinphoneParticipantRoleListener}); } static void create_conference_with_uninvited_participant_not_allowed(void) { create_conference_base( ms_time(NULL), -1, TRUE, LinphoneConferenceParticipantListTypeClosed, FALSE, LinphoneMediaEncryptionNone, FALSE, LinphoneConferenceLayoutActiveSpeaker, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, LinphoneMediaDirectionSendRecv, FALSE, LinphoneConferenceSecurityLevelNone, {LinphoneParticipantRoleSpeaker, LinphoneParticipantRoleListener}); } static void create_conference_starting_immediately(void) { create_conference_base(ms_time(NULL), 0, FALSE, LinphoneConferenceParticipantListTypeClosed, FALSE, LinphoneMediaEncryptionNone, FALSE, LinphoneConferenceLayoutGrid, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, LinphoneMediaDirectionRecvOnly, FALSE, LinphoneConferenceSecurityLevelNone, {LinphoneParticipantRoleSpeaker, LinphoneParticipantRoleListener}); } static void create_conference_starting_in_the_past(void) { create_conference_base(ms_time(NULL) - 600, 900, FALSE, LinphoneConferenceParticipantListTypeClosed, TRUE, LinphoneMediaEncryptionNone, FALSE, LinphoneConferenceLayoutActiveSpeaker, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, LinphoneMediaDirectionSendRecv, FALSE, LinphoneConferenceSecurityLevelNone, {LinphoneParticipantRoleSpeaker, LinphoneParticipantRoleListener}); } static void create_simple_conference_with_audio_only_participant(void) { create_conference_base(ms_time(NULL), -1, FALSE, LinphoneConferenceParticipantListTypeOpen, FALSE, LinphoneMediaEncryptionNone, TRUE, LinphoneConferenceLayoutGrid, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, LinphoneMediaDirectionSendRecv, FALSE, LinphoneConferenceSecurityLevelNone, {LinphoneParticipantRoleSpeaker, LinphoneParticipantRoleListener}); } static void create_conference_with_audio_only_and_uninvited_participant(void) { create_conference_base(ms_time(NULL), -1, TRUE, LinphoneConferenceParticipantListTypeOpen, TRUE, LinphoneMediaEncryptionNone, TRUE, LinphoneConferenceLayoutGrid, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, LinphoneMediaDirectionSendRecv, FALSE, LinphoneConferenceSecurityLevelNone, {LinphoneParticipantRoleSpeaker, LinphoneParticipantRoleListener}); } static void create_simple_conference_with_audio_only_participant_enabling_video(void) { create_conference_base(ms_time(NULL), -1, FALSE, LinphoneConferenceParticipantListTypeOpen, FALSE, LinphoneMediaEncryptionNone, TRUE, LinphoneConferenceLayoutGrid, FALSE, FALSE, TRUE, FALSE,
281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
FALSE, FALSE, LinphoneMediaDirectionSendRecv, FALSE, LinphoneConferenceSecurityLevelNone, {LinphoneParticipantRoleSpeaker, LinphoneParticipantRoleListener}); } static void create_conference_with_late_participant_addition(void) { create_conference_with_late_participant_addition_base(ms_time(NULL), -1, LinphoneConferenceLayoutGrid, LinphoneConferenceParticipantListTypeClosed, TRUE, TRUE, LinphoneConferenceSecurityLevelNone); } static void create_conference_with_late_participant_addition_declined(void) { create_conference_with_late_participant_addition_base(ms_time(NULL), -1, LinphoneConferenceLayoutActiveSpeaker, LinphoneConferenceParticipantListTypeClosed, FALSE, TRUE, LinphoneConferenceSecurityLevelNone); } static void organizer_schedule_two_conferences(void) { two_overlapping_conferences_base(TRUE, FALSE); } static void two_overlapping_scheduled_conferences_from_different_organizers(void) { two_overlapping_conferences_base(FALSE, FALSE); } static void create_conference_with_audio_only_participants_base(LinphoneConferenceSecurityLevel security_level) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); focus.registerAsParticipantDevice(laure); focus.registerAsParticipantDevice(berthe); setup_conference_info_cbs(marie.getCMgr()); bctbx_list_t *coresList = NULL; for (auto mgr : {focus.getCMgr(), marie.getCMgr(), pauline.getCMgr(), laure.getCMgr(), berthe.getCMgr()}) { LinphoneVideoActivationPolicy *pol = linphone_factory_create_video_activation_policy(linphone_factory_get()); linphone_video_activation_policy_set_automatically_accept(pol, TRUE); linphone_video_activation_policy_set_automatically_initiate(pol, TRUE); linphone_core_set_video_activation_policy(mgr->lc, pol); linphone_video_activation_policy_unref(pol); linphone_core_set_video_device(mgr->lc, liblinphone_tester_mire_id); linphone_core_enable_video_capture(mgr->lc, TRUE); linphone_core_enable_video_display(mgr->lc, TRUE); coresList = bctbx_list_append(coresList, mgr->lc); } linphone_core_set_file_transfer_server(marie.getLc(), file_transfer_url); stats focus_stat = focus.getStats(); std::list<LinphoneCoreManager *> participants{pauline.getCMgr(), laure.getCMgr()}; std::list<LinphoneCoreManager *> conferenceMgrs{focus.getCMgr(), marie.getCMgr(), pauline.getCMgr(), laure.getCMgr()}; std::list<LinphoneCoreManager *> members{marie.getCMgr(), pauline.getCMgr(), laure.getCMgr()}; time_t start_time = ms_time(NULL) + 60; int duration = 30; time_t end_time = (duration <= 0) ? -1 : (start_time + duration * 60); const char *initialSubject = "Test characters: ^ :) ¤ çà @"; const char *description = "Chamrousse Pub";
351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
bctbx_list_t *participants_info = NULL; std::map<LinphoneCoreManager *, LinphoneParticipantInfo *> participantList; LinphoneParticipantRole role = LinphoneParticipantRoleUnknown; for (auto &p : participants) { participantList.insert( std::make_pair(p, add_participant_info_to_list(&participants_info, p->identity, role, -1))); role = (role == LinphoneParticipantRoleListener) ? LinphoneParticipantRoleSpeaker : LinphoneParticipantRoleListener; } participantList.insert(std::make_pair( berthe.getCMgr(), add_participant_info_to_list(&participants_info, berthe.getCMgr()->identity, LinphoneParticipantRoleSpeaker, -1))); LinphoneAddress *confAddr = create_conference_on_server(focus, marie, participantList, start_time, end_time, initialSubject, description, TRUE, security_level); BC_ASSERT_PTR_NOT_NULL(confAddr); char *conference_address_str = (confAddr) ? linphone_address_as_string(confAddr) : ms_strdup("<unknown>"); // Chat room creation to send ICS BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneConferenceStateCreated, 2, liblinphone_tester_sip_timeout)); coresList = bctbx_list_remove(coresList, focus.getLc()); // Restart flexisip focus.reStart(); LinphoneVideoActivationPolicy *pol = linphone_factory_create_video_activation_policy(linphone_factory_get()); linphone_video_activation_policy_set_automatically_accept(pol, TRUE); linphone_video_activation_policy_set_automatically_initiate(pol, TRUE); linphone_core_set_video_activation_policy(focus.getLc(), pol); linphone_video_activation_policy_unref(pol); linphone_core_enable_video_capture(focus.getLc(), TRUE); linphone_core_enable_video_display(focus.getLc(), TRUE); coresList = bctbx_list_append(coresList, focus.getLc()); LinphoneConferenceLayout layout = LinphoneConferenceLayoutGrid; for (auto mgr : members) { LinphoneCallParams *new_params = linphone_core_create_call_params(mgr->lc, nullptr); linphone_call_params_enable_video(new_params, FALSE); linphone_call_params_set_conference_video_layout(new_params, layout); ms_message("%s is calling conference %s", linphone_core_get_identity(mgr->lc), conference_address_str); linphone_core_invite_address_with_params_2(mgr->lc, confAddr, new_params, NULL, nullptr); linphone_call_params_unref(new_params); if (layout == LinphoneConferenceLayoutGrid) { layout = LinphoneConferenceLayoutActiveSpeaker; } else if (layout == LinphoneConferenceLayoutActiveSpeaker) { layout = LinphoneConferenceLayoutGrid; } } for (auto mgr : members) { BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallOutgoingProgress, 1, liblinphone_tester_sip_timeout)); int no_streams_running = 2; BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallUpdating, (no_streams_running - 1), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallStreamsRunning, no_streams_running, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateCreated, ((mgr == marie.getCMgr()) ? 4 : 2), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE( wait_for_list(coresList, &mgr->stat.number_of_LinphoneSubscriptionOutgoingProgress, 1, 5000)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneSubscriptionActive, 1, 5000)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_NotifyFullStateReceived, 1, liblinphone_tester_sip_timeout)); }
421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallIncomingReceived, focus_stat.number_of_LinphoneCallIncomingReceived + 3, liblinphone_tester_sip_timeout)); int focus_no_streams_running = 6; // Update to end ICE negotiations BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallUpdatedByRemote, focus_stat.number_of_LinphoneCallUpdatedByRemote + (focus_no_streams_running - 3), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallStreamsRunning, focus_stat.number_of_LinphoneCallStreamsRunning + focus_no_streams_running, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneConferenceStateCreated, focus_stat.number_of_LinphoneConferenceStateCreated + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneSubscriptionIncomingReceived, focus_stat.number_of_LinphoneSubscriptionIncomingReceived + 3, 5000)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneSubscriptionActive, focus_stat.number_of_LinphoneSubscriptionActive + 3, 5000)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participants_added, focus_stat.number_of_participants_added + 3, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participant_devices_added, focus_stat.number_of_participant_devices_added + 3, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participant_devices_joined, focus_stat.number_of_participant_devices_joined + 3, liblinphone_tester_sip_timeout)); std::map<LinphoneCoreManager *, LinphoneParticipantInfo *> memberList = fill_memmber_list(members, participantList, marie.getCMgr(), participants_info); wait_for_conference_streams({focus, marie, pauline, laure, berthe}, conferenceMgrs, focus.getCMgr(), memberList, confAddr, TRUE); LinphoneConference *fconference = linphone_core_search_conference_2(focus.getLc(), confAddr); BC_ASSERT_PTR_NOT_NULL(fconference); // wait bit more to detect side effect if any CoreManagerAssert({focus, marie, pauline, laure}).waitUntil(chrono::seconds(2), [] { return false; }); for (auto mgr : conferenceMgrs) { LinphoneConference *pconference = linphone_core_search_conference_2(mgr->lc, confAddr); BC_ASSERT_PTR_NOT_NULL(pconference); if (pconference) { const LinphoneConferenceParams *conference_params = linphone_conference_get_current_params(pconference); int no_participants = 0; if (start_time >= 0) { BC_ASSERT_EQUAL((long long)linphone_conference_params_get_start_time(conference_params), (long long)start_time, long long, "%lld"); } BC_ASSERT_EQUAL((long long)linphone_conference_params_get_end_time(conference_params), (long long)end_time, long long, "%lld"); bctbx_list_t *participant_device_list = linphone_conference_get_participant_device_list(pconference); BC_ASSERT_EQUAL(bctbx_list_size(participant_device_list), 3, size_t, "%zu"); bctbx_list_free_with_data(participant_device_list, (void (*)(void *))linphone_participant_device_unref); if (mgr == focus.getCMgr()) { no_participants = 3; BC_ASSERT_FALSE(linphone_conference_is_in(pconference)); } else { no_participants = 2; BC_ASSERT_TRUE(linphone_conference_is_in(pconference)); LinphoneCall *current_call = linphone_core_get_current_call(mgr->lc); BC_ASSERT_PTR_NOT_NULL(current_call); if (current_call) { BC_ASSERT_EQUAL((int)linphone_call_get_state(current_call), (int)LinphoneCallStateStreamsRunning, int, "%0d"); } size_t no_streams_audio = 0;
491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
size_t no_streams_video = 0; size_t no_active_streams_video = 0; size_t no_streams_text = 0; LinphoneCall *pcall = linphone_core_get_call_by_remote_address2(mgr->lc, confAddr); BC_ASSERT_PTR_NOT_NULL(pcall); if (pcall) { no_streams_audio = compute_no_audio_streams(pcall, pconference); _linphone_call_check_nb_streams(pcall, no_streams_audio, no_streams_video, no_streams_text); _linphone_call_check_nb_active_streams(pcall, no_streams_audio, no_active_streams_video, no_streams_text); const LinphoneCallParams *call_lparams = linphone_call_get_params(pcall); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_lparams)); const LinphoneCallParams *call_rparams = linphone_call_get_remote_params(pcall); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_rparams)); const LinphoneCallParams *call_cparams = linphone_call_get_current_params(pcall); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_cparams)); } LinphoneCall *ccall = linphone_core_get_call_by_remote_address2(focus.getLc(), mgr->identity); BC_ASSERT_PTR_NOT_NULL(ccall); if (ccall) { _linphone_call_check_nb_streams(ccall, no_streams_audio, no_streams_video, no_streams_text); _linphone_call_check_nb_active_streams(ccall, no_streams_audio, no_active_streams_video, no_streams_text); const LinphoneCallParams *call_lparams = linphone_call_get_params(ccall); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_lparams)); const LinphoneCallParams *call_rparams = linphone_call_get_remote_params(ccall); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_rparams)); const LinphoneCallParams *call_cparams = linphone_call_get_current_params(ccall); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_cparams)); } } BC_ASSERT_EQUAL(linphone_conference_get_participant_count(pconference), no_participants, int, "%0d"); BC_ASSERT_STRING_EQUAL(linphone_conference_get_subject(pconference), initialSubject); LinphoneParticipant *me = linphone_conference_get_me(pconference); BC_ASSERT_TRUE(linphone_participant_is_admin(me) == ((mgr == marie.getCMgr()) || (mgr == focus.getCMgr()))); BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_participant_get_address(me), mgr->identity)); bctbx_list_t *participants = linphone_conference_get_participant_list(pconference); for (bctbx_list_t *itp = participants; itp; itp = bctbx_list_next(itp)) { LinphoneParticipant *p = (LinphoneParticipant *)bctbx_list_get_data(itp); BC_ASSERT_TRUE( linphone_participant_is_admin(p) == linphone_address_weak_equal(linphone_participant_get_address(p), marie.getCMgr()->identity)); } bctbx_list_free_with_data(participants, (void (*)(void *))linphone_participant_unref); if (mgr != focus.getCMgr()) { check_conference_ssrc(fconference, pconference); } } } focus_stat = focus.getStats(); LinphoneCallParams *new_params = linphone_core_create_call_params(berthe.getCMgr()->lc, nullptr); linphone_call_params_enable_video(new_params, FALSE); linphone_call_params_set_conference_video_layout(new_params, LinphoneConferenceLayoutActiveSpeaker); ms_message("%s is calling conference %s", linphone_core_get_identity(berthe.getCMgr()->lc), conference_address_str); linphone_core_invite_address_with_params_2(berthe.getCMgr()->lc, confAddr, new_params, NULL, nullptr); linphone_call_params_unref(new_params); BC_ASSERT_TRUE(wait_for_list(coresList, &berthe.getCMgr()->stat.number_of_LinphoneCallOutgoingProgress, 1, liblinphone_tester_sip_timeout)); int no_streams_running = 2; BC_ASSERT_TRUE(wait_for_list(coresList, &berthe.getCMgr()->stat.number_of_LinphoneCallUpdating, (no_streams_running - 1), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &berthe.getCMgr()->stat.number_of_LinphoneCallStreamsRunning, no_streams_running, liblinphone_tester_sip_timeout));
561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
// Update to add to conference. // If ICE is enabled, the addition to a conference may go through a resume of the call BC_ASSERT_TRUE(wait_for_list(coresList, &berthe.getCMgr()->stat.number_of_LinphoneConferenceStateCreated, 2, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE( wait_for_list(coresList, &berthe.getCMgr()->stat.number_of_LinphoneSubscriptionOutgoingProgress, 1, 5000)); BC_ASSERT_TRUE(wait_for_list(coresList, &berthe.getCMgr()->stat.number_of_LinphoneSubscriptionActive, 1, 5000)); BC_ASSERT_TRUE(wait_for_list(coresList, &berthe.getCMgr()->stat.number_of_NotifyFullStateReceived, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallIncomingReceived, focus_stat.number_of_LinphoneCallIncomingReceived + 1, liblinphone_tester_sip_timeout)); focus_no_streams_running = 2; // Update to end ICE negotiations BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallUpdatedByRemote, focus_stat.number_of_LinphoneCallUpdatedByRemote + (focus_no_streams_running - 1), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallStreamsRunning, focus_stat.number_of_LinphoneCallStreamsRunning + focus_no_streams_running, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneSubscriptionIncomingReceived, focus_stat.number_of_LinphoneSubscriptionIncomingReceived + 1, 5000)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneSubscriptionActive, focus_stat.number_of_LinphoneSubscriptionActive + 1, 5000)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participants_added, focus_stat.number_of_participants_added + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participant_devices_added, focus_stat.number_of_participant_devices_added + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participant_devices_joined, focus_stat.number_of_participant_devices_joined + 1, liblinphone_tester_sip_timeout)); participants.push_back(berthe.getCMgr()); members.push_back(berthe.getCMgr()); conferenceMgrs.push_back(berthe.getCMgr()); std::map<LinphoneCoreManager *, LinphoneParticipantInfo *> memberList2 = fill_memmber_list(members, participantList, marie.getCMgr(), participants_info); wait_for_conference_streams({focus, marie, pauline, laure, berthe}, conferenceMgrs, focus.getCMgr(), memberList2, confAddr, TRUE); // wait bit more to detect side effect if any CoreManagerAssert({focus, marie, pauline, laure}).waitUntil(chrono::seconds(2), [] { return false; }); for (auto mgr : conferenceMgrs) { LinphoneConference *pconference = linphone_core_search_conference_2(mgr->lc, confAddr); BC_ASSERT_PTR_NOT_NULL(pconference); if (pconference) { const LinphoneConferenceParams *conference_params = linphone_conference_get_current_params(pconference); int no_participants = 0; if (start_time >= 0) { BC_ASSERT_EQUAL((long long)linphone_conference_params_get_start_time(conference_params), (long long)start_time, long long, "%lld"); } BC_ASSERT_EQUAL((long long)linphone_conference_params_get_end_time(conference_params), (long long)end_time, long long, "%lld"); bctbx_list_t *participant_device_list = linphone_conference_get_participant_device_list(pconference); BC_ASSERT_EQUAL(bctbx_list_size(participant_device_list), 4, size_t, "%zu"); bctbx_list_free_with_data(participant_device_list, (void (*)(void *))linphone_participant_device_unref); if (mgr == focus.getCMgr()) { no_participants = 4; BC_ASSERT_FALSE(linphone_conference_is_in(pconference)); } else { no_participants = 3; BC_ASSERT_TRUE(linphone_conference_is_in(pconference)); LinphoneCall *current_call = linphone_core_get_current_call(mgr->lc);
631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
BC_ASSERT_PTR_NOT_NULL(current_call); if (current_call) { BC_ASSERT_EQUAL((int)linphone_call_get_state(current_call), (int)LinphoneCallStateStreamsRunning, int, "%0d"); } size_t no_streams_audio = 0; size_t no_streams_video = 0; size_t no_active_streams_video = 0; size_t no_streams_text = 0; LinphoneCall *pcall = linphone_core_get_call_by_remote_address2(mgr->lc, confAddr); BC_ASSERT_PTR_NOT_NULL(pcall); if (pcall) { no_streams_audio = compute_no_audio_streams(pcall, pconference); _linphone_call_check_nb_streams(pcall, no_streams_audio, no_streams_video, no_streams_text); _linphone_call_check_nb_active_streams(pcall, no_streams_audio, no_active_streams_video, no_streams_text); const LinphoneCallParams *call_lparams = linphone_call_get_params(pcall); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_lparams)); const LinphoneCallParams *call_rparams = linphone_call_get_remote_params(pcall); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_rparams)); const LinphoneCallParams *call_cparams = linphone_call_get_current_params(pcall); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_cparams)); } LinphoneCall *ccall = linphone_core_get_call_by_remote_address2(focus.getLc(), mgr->identity); BC_ASSERT_PTR_NOT_NULL(ccall); if (ccall) { _linphone_call_check_nb_streams(ccall, no_streams_audio, no_streams_video, no_streams_text); _linphone_call_check_nb_active_streams(ccall, no_streams_audio, no_active_streams_video, no_streams_text); const LinphoneCallParams *call_lparams = linphone_call_get_params(ccall); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_lparams)); const LinphoneCallParams *call_rparams = linphone_call_get_remote_params(ccall); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_rparams)); const LinphoneCallParams *call_cparams = linphone_call_get_current_params(ccall); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_cparams)); } } BC_ASSERT_EQUAL(linphone_conference_get_participant_count(pconference), no_participants, int, "%0d"); BC_ASSERT_STRING_EQUAL(linphone_conference_get_subject(pconference), initialSubject); LinphoneParticipant *me = linphone_conference_get_me(pconference); BC_ASSERT_TRUE(linphone_participant_is_admin(me) == ((mgr == marie.getCMgr()) || (mgr == focus.getCMgr()))); BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_participant_get_address(me), mgr->identity)); bctbx_list_t *participants = linphone_conference_get_participant_list(pconference); for (bctbx_list_t *itp = participants; itp; itp = bctbx_list_next(itp)) { LinphoneParticipant *p = (LinphoneParticipant *)bctbx_list_get_data(itp); BC_ASSERT_TRUE( linphone_participant_is_admin(p) == linphone_address_weak_equal(linphone_participant_get_address(p), marie.getCMgr()->identity)); } bctbx_list_free_with_data(participants, (void (*)(void *))linphone_participant_unref); if (mgr != focus.getCMgr()) { check_conference_ssrc(fconference, pconference); } } } // Everybody adds video std::list<LinphoneCoreManager *> withVideo{}; int mCnt = 0; for (auto m : {pauline.getCMgr(), marie.getCMgr()}) { withVideo.push_back(m); int videoDirCnt = 0; std::list<LinphoneMediaDirection> videoDirectionSeq; if ((mCnt % 2) == 1) { videoDirectionSeq.push_back(LinphoneMediaDirectionSendOnly); videoDirectionSeq.push_back(LinphoneMediaDirectionRecvOnly);
701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
videoDirectionSeq.push_back(LinphoneMediaDirectionSendRecv); } else { videoDirectionSeq.push_back(LinphoneMediaDirectionSendRecv); videoDirectionSeq.push_back(LinphoneMediaDirectionSendOnly); videoDirectionSeq.push_back(LinphoneMediaDirectionRecvOnly); } for (auto video_direction : videoDirectionSeq) { std::list<bool_t> enableSeq{TRUE, FALSE}; if ((videoDirCnt % 2) == 1) { enableSeq.push_back(TRUE); } for (auto enable : enableSeq) { set_video_settings_in_conference(focus.getCMgr(), m, members, confAddr, enable, video_direction, enable, video_direction); for (auto mgr : members) { LinphoneAddress *uri = linphone_address_new(linphone_core_get_identity(mgr->lc)); LinphoneConference *pconference = linphone_core_search_conference(mgr->lc, NULL, uri, confAddr, NULL); linphone_address_unref(uri); BC_ASSERT_PTR_NOT_NULL(pconference); if (pconference) { size_t no_streams_audio = 0; size_t no_active_streams_video = 0; size_t no_streams_text = 0; LinphoneCall *pcall = linphone_core_get_call_by_remote_address2(mgr->lc, confAddr); BC_ASSERT_PTR_NOT_NULL(pcall); if (pcall) { no_streams_audio = compute_no_audio_streams(pcall, pconference); no_active_streams_video = static_cast<int>(compute_no_video_streams(enable, pcall, pconference)); _linphone_call_check_nb_active_streams(pcall, no_streams_audio, no_active_streams_video, no_streams_text); } LinphoneCall *ccall = linphone_core_get_call_by_remote_address2(focus.getLc(), mgr->identity); BC_ASSERT_PTR_NOT_NULL(ccall); if (ccall) { _linphone_call_check_nb_active_streams(ccall, no_streams_audio, no_active_streams_video, no_streams_text); } } } } videoDirCnt++; } mCnt++; } const int total_marie_calls = marie.getStats().number_of_LinphoneCallEnd + (int)bctbx_list_size(linphone_core_get_calls(marie.getLc())); const int total_focus_calls = focus.getStats().number_of_LinphoneCallEnd + (int)bctbx_list_size(linphone_core_get_calls(focus.getLc())); const int total_pauline_calls = pauline.getStats().number_of_LinphoneCallEnd + (int)bctbx_list_size(linphone_core_get_calls(pauline.getLc())); const int total_laure_calls = laure.getStats().number_of_LinphoneCallEnd + (int)bctbx_list_size(linphone_core_get_calls(laure.getLc())); const int total_berthe_calls = berthe.getStats().number_of_LinphoneCallEnd + (int)bctbx_list_size(linphone_core_get_calls(berthe.getLc())); linphone_core_terminate_all_calls(pauline.getLc()); linphone_core_terminate_all_calls(laure.getLc()); linphone_core_terminate_all_calls(marie.getLc()); linphone_core_terminate_all_calls(berthe.getLc()); // Wait for calls to be terminated BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneCallEnd, total_marie_calls, 30000)); BC_ASSERT_TRUE( wait_for_list(coresList, &pauline.getStats().number_of_LinphoneCallEnd, total_pauline_calls, 30000)); BC_ASSERT_TRUE(wait_for_list(coresList, &laure.getStats().number_of_LinphoneCallEnd, total_laure_calls, 30000));
771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
BC_ASSERT_TRUE( wait_for_list(coresList, &berthe.getStats().number_of_LinphoneCallEnd, total_berthe_calls, 30000)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallEnd, total_focus_calls, 40000)); BC_ASSERT_TRUE( wait_for_list(coresList, &marie.getStats().number_of_LinphoneCallReleased, total_marie_calls, 30000)); BC_ASSERT_TRUE( wait_for_list(coresList, &pauline.getStats().number_of_LinphoneCallReleased, total_pauline_calls, 30000)); BC_ASSERT_TRUE( wait_for_list(coresList, &laure.getStats().number_of_LinphoneCallReleased, total_laure_calls, 30000)); BC_ASSERT_TRUE( wait_for_list(coresList, &berthe.getStats().number_of_LinphoneCallReleased, total_berthe_calls, 30000)); BC_ASSERT_TRUE( wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallReleased, total_focus_calls, 40000)); if (confAddr && fconference) { linphone_conference_terminate(fconference); } for (auto mgr : {focus.getCMgr(), marie.getCMgr(), pauline.getCMgr(), laure.getCMgr(), berthe.getCMgr()}) { // Wait for all conferences to be terminated BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateTerminationPending, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateTerminated, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateDeleted, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneSubscriptionTerminated, (mgr == focus.getCMgr()) ? 4 : 1, liblinphone_tester_sip_timeout)); if (mgr && (mgr != focus.getCMgr())) { LinphoneCall *participant_call = linphone_core_get_call_by_remote_address2(mgr->lc, focus.getCMgr()->identity); BC_ASSERT_PTR_NULL(participant_call); LinphoneCall *conference_call = linphone_core_get_call_by_remote_address2(focus.getLc(), mgr->identity); BC_ASSERT_PTR_NULL(conference_call); const bctbx_list_t *call_logs = linphone_core_get_call_logs(mgr->lc); BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(call_logs), 1, unsigned int, "%u"); bctbx_list_t *mgr_focus_call_log = linphone_core_get_call_history_2(mgr->lc, focus.getCMgr()->identity, mgr->identity); BC_ASSERT_PTR_NOT_NULL(mgr_focus_call_log); if (mgr_focus_call_log) { BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(mgr_focus_call_log), 1, unsigned int, "%u"); for (bctbx_list_t *it = mgr_focus_call_log; it; it = bctbx_list_next(it)) { LinphoneCallLog *call_log = (LinphoneCallLog *)it->data; BC_ASSERT_TRUE(linphone_call_log_was_conference(call_log)); } bctbx_list_free_with_data(mgr_focus_call_log, (bctbx_list_free_func)linphone_call_log_unref); } } } bctbx_list_free_with_data(participants_info, (bctbx_list_free_func)linphone_participant_info_unref); ms_free(conference_address_str); linphone_address_unref(confAddr); bctbx_list_free(coresList); } } static void create_conference_with_audio_only_participants(void) { create_conference_with_audio_only_participants_base(LinphoneConferenceSecurityLevelNone); } static void create_end_to_end_encryption_conference_with_audio_only_participants(void) { create_conference_with_audio_only_participants_base(LinphoneConferenceSecurityLevelEndToEnd); }
841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910
static void create_conference_with_codec_mismatch_base(bool_t organizer_codec_mismatch) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress()); ClientConference berthe("berthe_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); focus.registerAsParticipantDevice(laure); focus.registerAsParticipantDevice(michelle); focus.registerAsParticipantDevice(berthe); setup_conference_info_cbs(marie.getCMgr()); bctbx_list_t *coresList = NULL; LinphoneConferenceLayout layout = LinphoneConferenceLayoutGrid; for (auto mgr : {focus.getCMgr(), marie.getCMgr(), pauline.getCMgr(), laure.getCMgr(), michelle.getCMgr(), berthe.getCMgr()}) { LinphoneVideoActivationPolicy *pol = linphone_factory_create_video_activation_policy(linphone_factory_get()); linphone_video_activation_policy_set_automatically_accept(pol, TRUE); linphone_video_activation_policy_set_automatically_initiate(pol, TRUE); linphone_core_set_video_activation_policy(mgr->lc, pol); linphone_video_activation_policy_unref(pol); linphone_core_set_video_device(mgr->lc, liblinphone_tester_mire_id); linphone_core_enable_video_capture(mgr->lc, TRUE); linphone_core_enable_video_display(mgr->lc, TRUE); if (mgr != focus.getCMgr()) { linphone_core_set_default_conference_layout(mgr->lc, layout); linphone_core_set_media_encryption(mgr->lc, LinphoneMediaEncryptionSRTP); } enable_stun_in_mgr(mgr, TRUE, TRUE, TRUE, FALSE); if ((organizer_codec_mismatch && (mgr == marie.getCMgr())) || (!organizer_codec_mismatch && (mgr == michelle.getCMgr()))) { disable_all_audio_codecs_except_one(mgr->lc, "pcmu", -1); } else { disable_all_audio_codecs_except_one(mgr->lc, "pcma", -1); } coresList = bctbx_list_append(coresList, mgr->lc); } linphone_core_set_file_transfer_server(marie.getLc(), file_transfer_url); stats focus_stat = focus.getStats(); std::list<LinphoneCoreManager *> participants{pauline.getCMgr(), laure.getCMgr(), michelle.getCMgr(), berthe.getCMgr()}; std::list<LinphoneCoreManager *> conferenceMgrs{focus.getCMgr(), marie.getCMgr(), pauline.getCMgr(), laure.getCMgr(), michelle.getCMgr(), berthe.getCMgr()}; std::list<LinphoneCoreManager *> members{marie.getCMgr(), pauline.getCMgr(), laure.getCMgr(), michelle.getCMgr(), berthe.getCMgr()}; time_t start_time = ms_time(NULL); time_t end_time = -1; const char *initialSubject = "Test characters: ^ :) ¤ çà @"; const char *description = "Paris Baker"; LinphoneConferenceSecurityLevel security_level = LinphoneConferenceSecurityLevelNone; bctbx_list_t *participants_info = NULL;
911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980
std::map<LinphoneCoreManager *, LinphoneParticipantInfo *> participantList; LinphoneParticipantRole role = LinphoneParticipantRoleUnknown; for (auto &p : participants) { participantList.insert( std::make_pair(p, add_participant_info_to_list(&participants_info, p->identity, role, -1))); role = (role == LinphoneParticipantRoleSpeaker) ? LinphoneParticipantRoleListener : LinphoneParticipantRoleSpeaker; } participantList.insert( std::make_pair(marie.getCMgr(), add_participant_info_to_list(&participants_info, marie.getCMgr()->identity, LinphoneParticipantRoleListener, -1))); LinphoneAddress *confAddr = create_conference_on_server(focus, marie, participantList, start_time, end_time, initialSubject, description, TRUE, security_level); BC_ASSERT_PTR_NOT_NULL(confAddr); char *conference_address_str = (confAddr) ? linphone_address_as_string(confAddr) : ms_strdup("<unknown>"); // Chat room creation to send ICS BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneConferenceStateCreated, 2, liblinphone_tester_sip_timeout)); LinphoneMediaEncryption encryption = LinphoneMediaEncryptionNone; for (auto mgr : members) { LinphoneCallParams *new_params = linphone_core_create_call_params(mgr->lc, nullptr); linphone_call_params_set_media_encryption(new_params, encryption); linphone_core_invite_address_with_params_2(mgr->lc, confAddr, new_params, NULL, nullptr); linphone_call_params_unref(new_params); } std::list<LinphoneCoreManager *> codec_mismatch_members; if (organizer_codec_mismatch) { codec_mismatch_members.push_back(marie.getCMgr()); } else { codec_mismatch_members.push_back(michelle.getCMgr()); } for (const auto &m : codec_mismatch_members) { auto itConferenceMgrs = std::find(conferenceMgrs.begin(), conferenceMgrs.end(), m); if (itConferenceMgrs != conferenceMgrs.end()) { conferenceMgrs.erase(itConferenceMgrs); } auto itParticipants = std::find(participants.begin(), participants.end(), m); if (itParticipants != participants.end()) { participants.erase(itParticipants); } auto itMembers = std::find(members.begin(), members.end(), m); if (itMembers != members.end()) { members.erase(itMembers); } participantList.erase(m); } for (auto [mgr, info] : participantList) { BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallOutgoingProgress, 1, liblinphone_tester_sip_timeout)); int no_streams_running = (linphone_participant_info_get_role(info) == LinphoneParticipantRoleSpeaker) ? 3 : 2; BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallUpdating, (no_streams_running - 1), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallStreamsRunning, no_streams_running, liblinphone_tester_sip_timeout)); // Update to add to conference. // If ICE is enabled, the addition to a conference may go through a resume of the call BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateCreated, ((mgr == marie.getCMgr()) ? 3 : 2), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE( wait_for_list(coresList, &mgr->stat.number_of_LinphoneSubscriptionOutgoingProgress, 1, 5000));
981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050
BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneSubscriptionActive, 1, 5000)); BC_ASSERT_TRUE( wait_for_list(coresList, &mgr->stat.number_of_NotifyReceived, 1, liblinphone_tester_sip_timeout)); 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"); } 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"); } } BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallIncomingReceived, focus_stat.number_of_LinphoneCallIncomingReceived + 3, liblinphone_tester_sip_timeout)); int focus_no_streams_running = 9; // Update to end ICE negotiations BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallUpdatedByRemote, focus_stat.number_of_LinphoneCallUpdatedByRemote + (focus_no_streams_running - 3), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallStreamsRunning, focus_stat.number_of_LinphoneCallStreamsRunning + focus_no_streams_running, liblinphone_tester_sip_timeout)); // Update to add to conference. // If ICE is enabled, the addition to a conference may go through a resume of the call BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneConferenceStateCreated, focus_stat.number_of_LinphoneConferenceStateCreated + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneSubscriptionIncomingReceived, focus_stat.number_of_LinphoneSubscriptionIncomingReceived + 3, 5000)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneSubscriptionActive, focus_stat.number_of_LinphoneSubscriptionActive + 3, 5000)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participants_added, focus_stat.number_of_participants_added + 3, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participant_devices_added, focus_stat.number_of_participant_devices_added + 3, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participant_devices_joined, focus_stat.number_of_participant_devices_joined + 3, liblinphone_tester_sip_timeout)); if (organizer_codec_mismatch) { BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participants_removed, focus_stat.number_of_participants_removed + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participant_devices_removed, focus_stat.number_of_participant_devices_removed + 1, liblinphone_tester_sip_timeout)); } std::map<LinphoneCoreManager *, LinphoneParticipantInfo *> memberList = fill_memmber_list(members, participantList, marie.getCMgr(), participants_info); wait_for_conference_streams({focus, marie, pauline, laure, michelle, berthe}, conferenceMgrs, focus.getCMgr(), memberList, confAddr, TRUE); LinphoneConference *fconference = linphone_core_search_conference_2(focus.getLc(), confAddr); BC_ASSERT_PTR_NOT_NULL(fconference); // wait bit more to detect side effect if any CoreManagerAssert({focus, marie, pauline, laure, michelle, berthe}).waitUntil(chrono::seconds(2), [] { return false; });
1051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120
for (auto mgr : conferenceMgrs) { LinphoneConference *pconference = linphone_core_search_conference_2(mgr->lc, confAddr); BC_ASSERT_PTR_NOT_NULL(pconference); if (pconference) { const LinphoneConferenceParams *conference_params = linphone_conference_get_current_params(pconference); int no_participants = 0; if (start_time >= 0) { BC_ASSERT_EQUAL((long long)linphone_conference_params_get_start_time(conference_params), (long long)start_time, long long, "%lld"); } BC_ASSERT_EQUAL((long long)linphone_conference_params_get_end_time(conference_params), (long long)end_time, long long, "%lld"); bctbx_list_t *participant_device_list = linphone_conference_get_participant_device_list(pconference); BC_ASSERT_EQUAL(bctbx_list_size(participant_device_list), members.size(), size_t, "%zu"); for (bctbx_list_t *d_it = participant_device_list; d_it; d_it = bctbx_list_next(d_it)) { LinphoneParticipantDevice *d = (LinphoneParticipantDevice *)bctbx_list_get_data(d_it); BC_ASSERT_PTR_NOT_NULL(d); if (d) { BC_ASSERT_TRUE(!!!linphone_participant_device_get_is_muted(d)); } } bctbx_list_free_with_data(participant_device_list, (void (*)(void *))linphone_participant_device_unref); if (mgr == focus.getCMgr()) { no_participants = static_cast<int>(members.size()); BC_ASSERT_FALSE(linphone_conference_is_in(pconference)); } else { no_participants = static_cast<int>(members.size() - 1); BC_ASSERT_TRUE(linphone_conference_is_in(pconference)); LinphoneCall *current_call = linphone_core_get_current_call(mgr->lc); BC_ASSERT_PTR_NOT_NULL(current_call); if (current_call) { BC_ASSERT_EQUAL((int)linphone_call_get_state(current_call), (int)LinphoneCallStateStreamsRunning, int, "%0d"); } LinphoneParticipantRole role = linphone_participant_get_role(linphone_conference_get_me(pconference)); if ((role != LinphoneParticipantRoleListener) && (layout != LinphoneConferenceLayoutGrid)) { BC_ASSERT_TRUE(check_ice(mgr, focus.getCMgr(), LinphoneIceStateHostConnection)); } LinphoneVideoActivationPolicy *pol = linphone_core_get_video_activation_policy(mgr->lc); bool_t enabled = !!linphone_video_activation_policy_get_automatically_initiate(pol); linphone_video_activation_policy_unref(pol); size_t no_streams_audio = 1; size_t no_active_streams_video = 0; size_t no_streams_text = 0; LinphoneCall *pcall = linphone_core_get_call_by_remote_address2(mgr->lc, confAddr); BC_ASSERT_PTR_NOT_NULL(pcall); if (pcall) { no_active_streams_video = static_cast<int>(compute_no_video_streams(enabled, pcall, pconference)); _linphone_call_check_nb_active_streams(pcall, no_streams_audio, no_active_streams_video, no_streams_text); const LinphoneCallParams *call_lparams = linphone_call_get_params(pcall); BC_ASSERT_EQUAL(linphone_call_params_video_enabled(call_lparams), enabled, int, "%0d"); const LinphoneCallParams *call_rparams = linphone_call_get_remote_params(pcall); BC_ASSERT_EQUAL(linphone_call_params_video_enabled(call_rparams), enabled && (no_active_streams_video > 0), int, "%0d"); const LinphoneCallParams *call_cparams = linphone_call_get_current_params(pcall); BC_ASSERT_EQUAL(linphone_call_params_video_enabled(call_cparams), enabled && (no_active_streams_video > 0), int, "%0d"); } LinphoneCall *ccall = linphone_core_get_call_by_remote_address2(focus.getLc(), mgr->identity); BC_ASSERT_PTR_NOT_NULL(ccall); if (ccall) {
1121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190
_linphone_call_check_nb_active_streams(ccall, no_streams_audio, no_active_streams_video, no_streams_text); const LinphoneCallParams *call_cparams = linphone_call_get_current_params(ccall); BC_ASSERT_EQUAL(linphone_call_params_video_enabled(call_cparams), enabled && (no_active_streams_video > 0), int, "%0d"); } } BC_ASSERT_EQUAL(linphone_conference_get_participant_count(pconference), no_participants, int, "%0d"); BC_ASSERT_STRING_EQUAL(linphone_conference_get_subject(pconference), initialSubject); LinphoneParticipant *me = linphone_conference_get_me(pconference); BC_ASSERT_TRUE(linphone_participant_is_admin(me) == ((mgr == marie.getCMgr()) || (mgr == focus.getCMgr()))); BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_participant_get_address(me), mgr->identity)); bctbx_list_t *participants = linphone_conference_get_participant_list(pconference); for (bctbx_list_t *itp = participants; itp; itp = bctbx_list_next(itp)) { LinphoneParticipant *p = (LinphoneParticipant *)bctbx_list_get_data(itp); BC_ASSERT_TRUE( linphone_participant_is_admin(p) == linphone_address_weak_equal(linphone_participant_get_address(p), marie.getCMgr()->identity)); } bctbx_list_free_with_data(participants, (void (*)(void *))linphone_participant_unref); if (mgr != focus.getCMgr()) { check_conference_ssrc(fconference, pconference); } } } for (auto mgr : members) { LinphoneCall *call = linphone_core_get_current_call(mgr->lc); BC_ASSERT_PTR_NOT_NULL(call); if (call) { linphone_call_terminate(call); BC_ASSERT_TRUE( wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallEnd, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallReleased, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneSubscriptionTerminated, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateTerminationPending, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateTerminated, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateDeleted, 1, liblinphone_tester_sip_timeout)); LinphoneAddress *uri = linphone_address_new(linphone_core_get_identity(mgr->lc)); LinphoneConference *pconference = linphone_core_search_conference(mgr->lc, NULL, uri, confAddr, NULL); BC_ASSERT_PTR_NULL(pconference); linphone_address_unref(uri); } } BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participants_removed, focus_stat.number_of_participants_removed + static_cast<int>(members.size()), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE( wait_for_list(coresList, &focus.getStats().number_of_participant_devices_removed, focus_stat.number_of_participant_devices_removed + static_cast<int>(members.size()), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallEnd, focus_stat.number_of_LinphoneCallEnd + static_cast<int>(members.size()), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallReleased, focus_stat.number_of_LinphoneCallReleased + static_cast<int>(members.size()), liblinphone_tester_sip_timeout)); // wait bit more to detect side effect if any CoreManagerAssert({focus, marie, pauline, laure, michelle, berthe}).waitUntil(chrono::seconds(2), [] {
1191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260
return false; }); BC_ASSERT_EQUAL(focus.getStats().number_of_LinphoneConferenceStateTerminationPending, focus_stat.number_of_LinphoneConferenceStateTerminationPending, int, "%d"); BC_ASSERT_EQUAL(focus.getStats().number_of_LinphoneConferenceStateTerminated, focus_stat.number_of_LinphoneConferenceStateTerminated, int, "%d"); BC_ASSERT_EQUAL(focus.getStats().number_of_LinphoneConferenceStateDeleted, focus_stat.number_of_LinphoneConferenceStateDeleted, int, "%d"); for (auto mgr : members) { const bctbx_list_t *call_logs = linphone_core_get_call_logs(mgr->lc); BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(call_logs), 1, unsigned int, "%u"); bctbx_list_t *mgr_focus_call_log = linphone_core_get_call_history_2(mgr->lc, focus.getCMgr()->identity, mgr->identity); BC_ASSERT_PTR_NOT_NULL(mgr_focus_call_log); if (mgr_focus_call_log) { BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(mgr_focus_call_log), 1, unsigned int, "%u"); for (bctbx_list_t *it = mgr_focus_call_log; it; it = bctbx_list_next(it)) { LinphoneCallLog *call_log = (LinphoneCallLog *)it->data; BC_ASSERT_TRUE(linphone_call_log_was_conference(call_log)); } bctbx_list_free_with_data(mgr_focus_call_log, (bctbx_list_free_func)linphone_call_log_unref); } } // wait bit more to detect side effect if any CoreManagerAssert({focus, marie, pauline, laure, michelle, berthe}).waitUntil(chrono::seconds(2), [] { return false; }); bctbx_list_free_with_data(participants_info, (bctbx_list_free_func)linphone_participant_info_unref); ms_free(conference_address_str); linphone_address_unref(confAddr); bctbx_list_free(coresList); } } static void create_conference_with_organizer_codec_mismatch(void) { create_conference_with_codec_mismatch_base(TRUE); } static void create_conference_with_participant_codec_mismatch(void) { create_conference_with_codec_mismatch_base(FALSE); } static void create_conference_with_server_restart_base(bool_t organizer_first) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); focus.registerAsParticipantDevice(laure); setup_conference_info_cbs(marie.getCMgr()); bctbx_list_t *coresList = NULL; for (auto mgr : {focus.getCMgr(), marie.getCMgr(), pauline.getCMgr(), laure.getCMgr()}) { LinphoneVideoActivationPolicy *pol = linphone_factory_create_video_activation_policy(linphone_factory_get()); linphone_video_activation_policy_set_automatically_accept(pol, TRUE); linphone_video_activation_policy_set_automatically_initiate(pol, TRUE); linphone_core_set_video_activation_policy(mgr->lc, pol); linphone_video_activation_policy_unref(pol);
1261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330
linphone_core_set_video_device(mgr->lc, liblinphone_tester_mire_id); linphone_core_enable_video_capture(mgr->lc, TRUE); linphone_core_enable_video_display(mgr->lc, TRUE); coresList = bctbx_list_append(coresList, mgr->lc); } linphone_core_set_file_transfer_server(marie.getLc(), file_transfer_url); stats focus_stat = focus.getStats(); std::list<LinphoneCoreManager *> participants{pauline.getCMgr(), laure.getCMgr()}; std::list<LinphoneCoreManager *> conferenceMgrs{focus.getCMgr(), marie.getCMgr(), pauline.getCMgr(), laure.getCMgr()}; std::list<LinphoneCoreManager *> members{marie.getCMgr(), pauline.getCMgr(), laure.getCMgr()}; time_t start_time = ms_time(NULL) + 60; int duration = 30; time_t end_time = (duration <= 0) ? -1 : (start_time + duration * 60); const char *initialSubject = "Test characters: ^ :) ¤ çà @"; const char *description = "London Pub"; LinphoneConferenceSecurityLevel security_level = LinphoneConferenceSecurityLevelNone; bctbx_list_t *participants_info = NULL; std::map<LinphoneCoreManager *, LinphoneParticipantInfo *> participantList; LinphoneParticipantRole role = LinphoneParticipantRoleSpeaker; for (auto &p : participants) { participantList.insert( std::make_pair(p, add_participant_info_to_list(&participants_info, p->identity, role, -1))); role = (role == LinphoneParticipantRoleSpeaker) ? LinphoneParticipantRoleListener : LinphoneParticipantRoleSpeaker; } participantList.insert( std::make_pair(marie.getCMgr(), add_participant_info_to_list(&participants_info, marie.getCMgr()->identity, LinphoneParticipantRoleSpeaker, -1))); LinphoneAddress *confAddr = create_conference_on_server(focus, marie, participantList, start_time, end_time, initialSubject, description, TRUE, security_level); BC_ASSERT_PTR_NOT_NULL(confAddr); char *conference_address_str = (confAddr) ? linphone_address_as_string(confAddr) : ms_strdup("<unknown>"); // Chat room creation to send ICS BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneConferenceStateCreated, 2, liblinphone_tester_sip_timeout)); coresList = bctbx_list_remove(coresList, focus.getLc()); // Restart flexisip focus.reStart(); LinphoneVideoActivationPolicy *pol = linphone_factory_create_video_activation_policy(linphone_factory_get()); linphone_video_activation_policy_set_automatically_accept(pol, TRUE); linphone_video_activation_policy_set_automatically_initiate(pol, TRUE); linphone_core_set_video_activation_policy(focus.getLc(), pol); linphone_video_activation_policy_unref(pol); linphone_core_enable_video_capture(focus.getLc(), TRUE); linphone_core_enable_video_display(focus.getLc(), TRUE); coresList = bctbx_list_append(coresList, focus.getLc()); LinphoneCoreManager *first_to_join = NULL; std::list<LinphoneCoreManager *> other_members{pauline.getCMgr()}; if (organizer_first) { first_to_join = marie.getCMgr(); other_members.push_back(laure.getCMgr()); } else { first_to_join = laure.getCMgr(); other_members.push_back(marie.getCMgr()); }
1331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400
ms_message("First participant %s is calling conference %s", linphone_core_get_identity(first_to_join->lc), conference_address_str); LinphoneCallParams *first_part_new_params = linphone_core_create_call_params(first_to_join->lc, nullptr); linphone_core_invite_address_with_params_2(first_to_join->lc, confAddr, first_part_new_params, NULL, nullptr); linphone_call_params_unref(first_part_new_params); BC_ASSERT_TRUE(wait_for_list(coresList, &first_to_join->stat.number_of_LinphoneCallOutgoingProgress, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &first_to_join->stat.number_of_LinphoneCallStreamsRunning, 1, liblinphone_tester_sip_timeout)); for (auto mgr : other_members) { LinphoneCallParams *new_params = linphone_core_create_call_params(mgr->lc, nullptr); ms_message("%s is calling conference %s", linphone_core_get_identity(mgr->lc), conference_address_str); linphone_core_invite_address_with_params_2(mgr->lc, confAddr, new_params, NULL, nullptr); linphone_call_params_unref(new_params); } for (auto mgr : members) { BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallOutgoingProgress, 1, liblinphone_tester_sip_timeout)); int no_streams_running = 2; BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallUpdating, (no_streams_running - 1), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallStreamsRunning, no_streams_running, liblinphone_tester_sip_timeout)); // Update to add to conference. // If ICE is enabled, the addition to a conference may go through a resume of the call BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateCreated, ((mgr == marie.getCMgr()) ? 3 : 2), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE( wait_for_list(coresList, &mgr->stat.number_of_LinphoneSubscriptionOutgoingProgress, 1, 5000)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneSubscriptionActive, 1, 5000)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_NotifyFullStateReceived, 1, liblinphone_tester_sip_timeout)); } BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallIncomingReceived, focus_stat.number_of_LinphoneCallIncomingReceived + 3, liblinphone_tester_sip_timeout)); int focus_no_streams_running = 6; // Update to end ICE negotiations BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallUpdatedByRemote, focus_stat.number_of_LinphoneCallUpdatedByRemote + (focus_no_streams_running - 3), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallStreamsRunning, focus_stat.number_of_LinphoneCallStreamsRunning + focus_no_streams_running, liblinphone_tester_sip_timeout)); // Update to add to conference. // If ICE is enabled, the addition to a conference may go through a resume of the call BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneConferenceStateCreated, focus_stat.number_of_LinphoneConferenceStateCreated + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneSubscriptionIncomingReceived, focus_stat.number_of_LinphoneSubscriptionIncomingReceived + 3, 5000)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneSubscriptionActive, focus_stat.number_of_LinphoneSubscriptionActive + 3, 5000)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participants_added, focus_stat.number_of_participants_added + 3, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participant_devices_added, focus_stat.number_of_participant_devices_added + 3, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participant_devices_joined, focus_stat.number_of_participant_devices_joined + 3, liblinphone_tester_sip_timeout)); std::map<LinphoneCoreManager *, LinphoneParticipantInfo *> memberList = fill_memmber_list(members, participantList, marie.getCMgr(), participants_info); wait_for_conference_streams({focus, marie, pauline, laure}, conferenceMgrs, focus.getCMgr(), memberList,
1401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470
confAddr, TRUE); LinphoneConference *fconference = linphone_core_search_conference_2(focus.getLc(), confAddr); BC_ASSERT_PTR_NOT_NULL(fconference); // wait bit more to detect side effect if any CoreManagerAssert({focus, marie, pauline, laure}).waitUntil(chrono::seconds(2), [] { return false; }); for (auto mgr : conferenceMgrs) { LinphoneConference *pconference = linphone_core_search_conference_2(mgr->lc, confAddr); BC_ASSERT_PTR_NOT_NULL(pconference); if (pconference) { const LinphoneConferenceParams *conference_params = linphone_conference_get_current_params(pconference); int no_participants = 0; if (start_time >= 0) { BC_ASSERT_EQUAL((long long)linphone_conference_params_get_start_time(conference_params), (long long)start_time, long long, "%lld"); } BC_ASSERT_EQUAL((long long)linphone_conference_params_get_end_time(conference_params), (long long)end_time, long long, "%lld"); bctbx_list_t *participant_device_list = linphone_conference_get_participant_device_list(pconference); BC_ASSERT_EQUAL(bctbx_list_size(participant_device_list), 3, size_t, "%zu"); bctbx_list_free_with_data(participant_device_list, (void (*)(void *))linphone_participant_device_unref); if (mgr == focus.getCMgr()) { no_participants = 3; BC_ASSERT_FALSE(linphone_conference_is_in(pconference)); } else { no_participants = 2; BC_ASSERT_TRUE(linphone_conference_is_in(pconference)); LinphoneCall *current_call = linphone_core_get_current_call(mgr->lc); BC_ASSERT_PTR_NOT_NULL(current_call); if (current_call) { BC_ASSERT_EQUAL((int)linphone_call_get_state(current_call), (int)LinphoneCallStateStreamsRunning, int, "%0d"); } LinphoneVideoActivationPolicy *pol = linphone_core_get_video_activation_policy(mgr->lc); bool_t enabled = !!linphone_video_activation_policy_get_automatically_initiate(pol); linphone_video_activation_policy_unref(pol); size_t no_streams_audio = 0; size_t no_streams_video = (enabled) ? 4 : 0; size_t no_active_streams_video = 0; size_t no_streams_text = 0; LinphoneCall *pcall = linphone_core_get_call_by_remote_address2(mgr->lc, confAddr); BC_ASSERT_PTR_NOT_NULL(pcall); if (pcall) { no_streams_audio = compute_no_audio_streams(pcall, pconference); no_active_streams_video = compute_no_video_streams(enabled, pcall, pconference); _linphone_call_check_max_nb_streams(pcall, no_streams_audio, no_streams_video, no_streams_text); _linphone_call_check_nb_active_streams(pcall, no_streams_audio, no_active_streams_video, no_streams_text); const LinphoneCallParams *call_lparams = linphone_call_get_params(pcall); BC_ASSERT_EQUAL(linphone_call_params_video_enabled(call_lparams), enabled, int, "%0d"); const LinphoneCallParams *call_rparams = linphone_call_get_remote_params(pcall); BC_ASSERT_EQUAL(linphone_call_params_video_enabled(call_rparams), enabled, int, "%0d"); const LinphoneCallParams *call_cparams = linphone_call_get_current_params(pcall); BC_ASSERT_EQUAL(linphone_call_params_video_enabled(call_cparams), enabled, int, "%0d"); } LinphoneCall *ccall = linphone_core_get_call_by_remote_address2(focus.getLc(), mgr->identity); BC_ASSERT_PTR_NOT_NULL(ccall); if (ccall) { _linphone_call_check_max_nb_streams(ccall, no_streams_audio, no_streams_video, no_streams_text); _linphone_call_check_nb_active_streams(ccall, no_streams_audio, no_active_streams_video, no_streams_text); const LinphoneCallParams *call_lparams = linphone_call_get_params(ccall); BC_ASSERT_EQUAL(linphone_call_params_video_enabled(call_lparams), enabled, int, "%0d"); const LinphoneCallParams *call_rparams = linphone_call_get_remote_params(ccall);
1471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540
BC_ASSERT_EQUAL(linphone_call_params_video_enabled(call_rparams), enabled, int, "%0d"); const LinphoneCallParams *call_cparams = linphone_call_get_current_params(ccall); BC_ASSERT_EQUAL(linphone_call_params_video_enabled(call_cparams), enabled, int, "%0d"); } } BC_ASSERT_EQUAL(linphone_conference_get_participant_count(pconference), no_participants, int, "%0d"); BC_ASSERT_STRING_EQUAL(linphone_conference_get_subject(pconference), initialSubject); LinphoneParticipant *me = linphone_conference_get_me(pconference); BC_ASSERT_TRUE(linphone_participant_is_admin(me) == ((mgr == marie.getCMgr()) || (mgr == focus.getCMgr()))); BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_participant_get_address(me), mgr->identity)); bctbx_list_t *participants = linphone_conference_get_participant_list(pconference); for (bctbx_list_t *itp = participants; itp; itp = bctbx_list_next(itp)) { LinphoneParticipant *p = (LinphoneParticipant *)bctbx_list_get_data(itp); BC_ASSERT_TRUE( linphone_participant_is_admin(p) == linphone_address_weak_equal(linphone_participant_get_address(p), marie.getCMgr()->identity)); } bctbx_list_free_with_data(participants, (void (*)(void *))linphone_participant_unref); if (mgr != focus.getCMgr()) { check_conference_ssrc(fconference, pconference); } } } const int total_marie_calls = marie.getStats().number_of_LinphoneCallEnd + (int)bctbx_list_size(linphone_core_get_calls(marie.getLc())); const int total_focus_calls = focus.getStats().number_of_LinphoneCallEnd + (int)bctbx_list_size(linphone_core_get_calls(focus.getLc())); const int total_pauline_calls = pauline.getStats().number_of_LinphoneCallEnd + (int)bctbx_list_size(linphone_core_get_calls(pauline.getLc())); const int total_laure_calls = laure.getStats().number_of_LinphoneCallEnd + (int)bctbx_list_size(linphone_core_get_calls(laure.getLc())); linphone_core_terminate_all_calls(pauline.getLc()); linphone_core_terminate_all_calls(laure.getLc()); linphone_core_terminate_all_calls(marie.getLc()); // Wait for calls to be terminated BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneCallEnd, total_marie_calls, 30000)); BC_ASSERT_TRUE( wait_for_list(coresList, &pauline.getStats().number_of_LinphoneCallEnd, total_pauline_calls, 30000)); BC_ASSERT_TRUE(wait_for_list(coresList, &laure.getStats().number_of_LinphoneCallEnd, total_laure_calls, 30000)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallEnd, total_focus_calls, 40000)); BC_ASSERT_TRUE( wait_for_list(coresList, &marie.getStats().number_of_LinphoneCallReleased, total_marie_calls, 30000)); BC_ASSERT_TRUE( wait_for_list(coresList, &pauline.getStats().number_of_LinphoneCallReleased, total_pauline_calls, 30000)); BC_ASSERT_TRUE( wait_for_list(coresList, &laure.getStats().number_of_LinphoneCallReleased, total_laure_calls, 30000)); BC_ASSERT_TRUE( wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallReleased, total_focus_calls, 40000)); if (confAddr && fconference) { linphone_conference_terminate(fconference); } for (auto mgr : {focus.getCMgr(), marie.getCMgr(), pauline.getCMgr(), laure.getCMgr()}) { // Wait for all conferences to be terminated BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateTerminationPending, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateTerminated, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateDeleted, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneSubscriptionTerminated,
1541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610
(mgr == focus.getCMgr()) ? 3 : 1, liblinphone_tester_sip_timeout)); if (mgr && (mgr != focus.getCMgr())) { LinphoneCall *participant_call = linphone_core_get_call_by_remote_address2(mgr->lc, focus.getCMgr()->identity); BC_ASSERT_PTR_NULL(participant_call); LinphoneCall *conference_call = linphone_core_get_call_by_remote_address2(focus.getLc(), mgr->identity); BC_ASSERT_PTR_NULL(conference_call); const bctbx_list_t *call_logs = linphone_core_get_call_logs(mgr->lc); BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(call_logs), 1, unsigned int, "%u"); bctbx_list_t *mgr_focus_call_log = linphone_core_get_call_history_2(mgr->lc, focus.getCMgr()->identity, mgr->identity); BC_ASSERT_PTR_NOT_NULL(mgr_focus_call_log); if (mgr_focus_call_log) { BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(mgr_focus_call_log), 1, unsigned int, "%u"); for (bctbx_list_t *it = mgr_focus_call_log; it; it = bctbx_list_next(it)) { LinphoneCallLog *call_log = (LinphoneCallLog *)it->data; BC_ASSERT_TRUE(linphone_call_log_was_conference(call_log)); } bctbx_list_free_with_data(mgr_focus_call_log, (bctbx_list_free_func)linphone_call_log_unref); } } } bctbx_list_free_with_data(participants_info, (bctbx_list_free_func)linphone_participant_info_unref); ms_free(conference_address_str); linphone_address_unref(confAddr); bctbx_list_free(coresList); } } static void create_conference_with_server_restart_organizer_first(void) { create_conference_with_server_restart_base(TRUE); } static void create_conference_with_server_restart_participant_first(void) { create_conference_with_server_restart_base(FALSE); } static void create_simple_conference_with_update_deferred(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); ClientConference michelle("michelle_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); focus.registerAsParticipantDevice(laure); focus.registerAsParticipantDevice(michelle); setup_conference_info_cbs(marie.getCMgr()); for (auto mgr : {focus.getCMgr(), marie.getCMgr(), pauline.getCMgr(), laure.getCMgr(), michelle.getCMgr()}) { LinphoneVideoActivationPolicy *pol = linphone_factory_create_video_activation_policy(linphone_factory_get()); linphone_video_activation_policy_set_automatically_accept(pol, TRUE); linphone_video_activation_policy_set_automatically_initiate(pol, FALSE); linphone_core_set_video_activation_policy(mgr->lc, pol); linphone_video_activation_policy_unref(pol); linphone_core_set_video_device(mgr->lc, liblinphone_tester_mire_id); linphone_core_enable_video_capture(mgr->lc, TRUE); linphone_core_enable_video_display(mgr->lc, TRUE); if (mgr != focus.getCMgr()) { linphone_core_set_default_conference_layout(mgr->lc, LinphoneConferenceLayoutGrid);
1611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680
} } linphone_core_set_file_transfer_server(marie.getLc(), file_transfer_url); bctbx_list_t *coresList = bctbx_list_append(NULL, focus.getLc()); coresList = bctbx_list_append(coresList, marie.getLc()); coresList = bctbx_list_append(coresList, pauline.getLc()); coresList = bctbx_list_append(coresList, laure.getLc()); coresList = bctbx_list_append(coresList, michelle.getLc()); stats marie_stat = marie.getStats(); stats focus_stat = focus.getStats(); std::list<LinphoneCoreManager *> participants{pauline.getCMgr(), laure.getCMgr()}; std::list<LinphoneCoreManager *> members{marie.getCMgr(), pauline.getCMgr(), laure.getCMgr()}; time_t start_time = ms_time(NULL) + 10; time_t end_time = (start_time + 300); const char *initialSubject = "Test characters: ^ :) ¤ çà @"; const char *description = "Paris Baker"; LinphoneConferenceSecurityLevel security_level = LinphoneConferenceSecurityLevelNone; bctbx_list_t *participants_info = NULL; std::map<LinphoneCoreManager *, LinphoneParticipantInfo *> participantList; LinphoneParticipantRole role = LinphoneParticipantRoleSpeaker; for (auto &p : participants) { participantList.insert( std::make_pair(p, add_participant_info_to_list(&participants_info, p->identity, role, -1))); role = (role == LinphoneParticipantRoleSpeaker) ? LinphoneParticipantRoleListener : LinphoneParticipantRoleSpeaker; } LinphoneAddress *confAddr = create_conference_on_server(focus, marie, participantList, start_time, end_time, initialSubject, description, TRUE, security_level); BC_ASSERT_PTR_NOT_NULL(confAddr); // Chat room creation to send ICS BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneConferenceStateCreated, 2, liblinphone_tester_sip_timeout)); for (auto mgr : members) { LinphoneCallParams *new_params = linphone_core_create_call_params(mgr->lc, nullptr); linphone_core_invite_address_with_params_2(mgr->lc, confAddr, new_params, NULL, nullptr); linphone_call_params_unref(new_params); } for (auto mgr : members) { BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallOutgoingProgress, 1, liblinphone_tester_sip_timeout)); int no_streams_running = 2; BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallUpdating, (no_streams_running - 1), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallStreamsRunning, no_streams_running, liblinphone_tester_sip_timeout)); // Update to add to conference. // If ICE is enabled, the addition to a conference may go through a resume of the call BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateCreated, ((mgr == marie.getCMgr()) ? 3 : 2), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneSubscriptionOutgoingProgress, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneSubscriptionActive, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_NotifyFullStateReceived, 1, liblinphone_tester_sip_timeout)); } BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallIncomingReceived, focus_stat.number_of_LinphoneCallIncomingReceived + 3, liblinphone_tester_sip_timeout)); int focus_no_streams_running = 6;
1681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750
BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallUpdatedByRemote, focus_stat.number_of_LinphoneCallUpdatedByRemote + (focus_no_streams_running - 3), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallStreamsRunning, focus_stat.number_of_LinphoneCallStreamsRunning + focus_no_streams_running, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneConferenceStateCreated, focus_stat.number_of_LinphoneConferenceStateCreated + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneSubscriptionIncomingReceived, focus_stat.number_of_LinphoneSubscriptionIncomingReceived + 3, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneSubscriptionActive, focus_stat.number_of_LinphoneSubscriptionActive + 3, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participants_added, focus_stat.number_of_participants_added + 3, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participant_devices_added, focus_stat.number_of_participant_devices_added + 3, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participant_devices_joined, focus_stat.number_of_participant_devices_joined + 3, liblinphone_tester_sip_timeout)); LinphoneConference *fconference = linphone_core_search_conference_2(focus.getLc(), confAddr); BC_ASSERT_PTR_NOT_NULL(fconference); // wait bit more to detect side effect if any CoreManagerAssert({focus, marie, pauline, laure, michelle}).waitUntil(chrono::seconds(2), [] { return false; }); for (auto mgr : {focus.getCMgr(), marie.getCMgr(), pauline.getCMgr(), laure.getCMgr()}) { LinphoneConference *pconference = linphone_core_search_conference_2(mgr->lc, confAddr); BC_ASSERT_PTR_NOT_NULL(pconference); if (pconference) { const LinphoneConferenceParams *conference_params = linphone_conference_get_current_params(pconference); int no_participants = 0; if (start_time >= 0) { BC_ASSERT_EQUAL((long long)linphone_conference_params_get_start_time(conference_params), (long long)start_time, long long, "%lld"); } BC_ASSERT_EQUAL((long long)linphone_conference_params_get_end_time(conference_params), (long long)end_time, long long, "%lld"); if (mgr == focus.getCMgr()) { no_participants = 3; BC_ASSERT_FALSE(linphone_conference_is_in(pconference)); } else { no_participants = 2; BC_ASSERT_TRUE(linphone_conference_is_in(pconference)); LinphoneCall *current_call = linphone_core_get_current_call(mgr->lc); BC_ASSERT_PTR_NOT_NULL(current_call); if (current_call) { BC_ASSERT_EQUAL((int)linphone_call_get_state(current_call), (int)LinphoneCallStateStreamsRunning, int, "%0d"); } LinphoneVideoActivationPolicy *pol = linphone_core_get_video_activation_policy(mgr->lc); bool_t enabled = !!linphone_video_activation_policy_get_automatically_initiate(pol); LinphoneCall *pcall = linphone_core_get_call_by_remote_address2(mgr->lc, confAddr); BC_ASSERT_PTR_NOT_NULL(pcall); if (pcall) { const LinphoneCallParams *call_lparams = linphone_call_get_params(pcall); BC_ASSERT_EQUAL(linphone_call_params_video_enabled(call_lparams), enabled, int, "%0d"); const LinphoneCallParams *call_rparams = linphone_call_get_remote_params(pcall); BC_ASSERT_EQUAL(linphone_call_params_video_enabled(call_rparams), enabled, int, "%0d"); const LinphoneCallParams *call_cparams = linphone_call_get_current_params(pcall); BC_ASSERT_EQUAL(linphone_call_params_video_enabled(call_cparams), enabled, int, "%0d"); } LinphoneCall *ccall = linphone_core_get_call_by_remote_address2(focus.getLc(), mgr->identity); BC_ASSERT_PTR_NOT_NULL(ccall);
1751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820
if (ccall) { const LinphoneCallParams *call_lparams = linphone_call_get_params(ccall); BC_ASSERT_EQUAL(linphone_call_params_video_enabled(call_lparams), enabled, int, "%0d"); const LinphoneCallParams *call_rparams = linphone_call_get_remote_params(ccall); BC_ASSERT_EQUAL(linphone_call_params_video_enabled(call_rparams), enabled, int, "%0d"); const LinphoneCallParams *call_cparams = linphone_call_get_current_params(ccall); BC_ASSERT_EQUAL(linphone_call_params_video_enabled(call_cparams), enabled, int, "%0d"); } linphone_video_activation_policy_unref(pol); } BC_ASSERT_EQUAL(linphone_conference_get_participant_count(pconference), no_participants, int, "%0d"); bctbx_list_t *devices = linphone_conference_get_participant_device_list(pconference); BC_ASSERT_EQUAL(bctbx_list_size(devices), 3, size_t, "%zu"); if (devices) { bctbx_list_free_with_data(devices, (void (*)(void *))linphone_participant_device_unref); } BC_ASSERT_STRING_EQUAL(linphone_conference_get_subject(pconference), initialSubject); LinphoneParticipant *me = linphone_conference_get_me(pconference); BC_ASSERT_TRUE(linphone_participant_is_admin(me) == ((mgr == marie.getCMgr()) || (mgr == focus.getCMgr()))); BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_participant_get_address(me), mgr->identity)); bctbx_list_t *participants = linphone_conference_get_participant_list(pconference); for (bctbx_list_t *itp = participants; itp; itp = bctbx_list_next(itp)) { LinphoneParticipant *p = (LinphoneParticipant *)bctbx_list_get_data(itp); BC_ASSERT_TRUE( linphone_participant_is_admin(p) == linphone_address_weak_equal(linphone_participant_get_address(p), marie.getCMgr()->identity)); } bctbx_list_free_with_data(participants, (void (*)(void *))linphone_participant_unref); if (mgr != focus.getCMgr()) { check_conference_ssrc(fconference, pconference); } } } // Wait a little bit wait_for_list(coresList, NULL, 0, 3000); LinphoneCall *pauline_call = linphone_core_get_call_by_remote_address2(pauline.getLc(), confAddr); BC_ASSERT_PTR_NOT_NULL(pauline_call); LinphoneVideoActivationPolicy *pol = linphone_core_get_video_activation_policy(pauline.getLc()); bool_t enable = !!!linphone_video_activation_policy_get_automatically_initiate(pol); linphone_video_activation_policy_unref(pol); if (pauline_call) { const LinphoneCallParams *call_lparams = linphone_call_get_params(pauline_call); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_lparams)); const LinphoneCallParams *call_rparams = linphone_call_get_remote_params(pauline_call); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_rparams)); const LinphoneCallParams *call_cparams = linphone_call_get_current_params(pauline_call); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_cparams)); } Address paulineIdentity = pauline.getIdentity(); LinphoneCall *focus_call = linphone_core_get_call_by_remote_address2(focus.getLc(), paulineIdentity.toC()); BC_ASSERT_PTR_NOT_NULL(focus_call); if (focus_call) { const LinphoneCallParams *call_lparams = linphone_call_get_params(focus_call); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_lparams)); const LinphoneCallParams *call_rparams = linphone_call_get_remote_params(focus_call); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_rparams)); const LinphoneCallParams *call_cparams = linphone_call_get_current_params(focus_call); BC_ASSERT_FALSE(linphone_call_params_video_enabled(call_cparams)); } LinphoneAddress *paulineUri = linphone_address_new(linphone_core_get_identity(pauline.getLc())); LinphoneConference *paulineConference = linphone_core_search_conference(pauline.getLc(), NULL, paulineUri, confAddr, NULL); linphone_address_unref(paulineUri);
1821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890
BC_ASSERT_PTR_NOT_NULL(paulineConference); linphone_config_set_int(linphone_core_get_config(focus.getLc()), "sip", "defer_update_default", TRUE); for (int i = 0; i < 4; i++) { set_video_settings_in_conference(focus.getCMgr(), pauline.getCMgr(), members, confAddr, enable, LinphoneMediaDirectionSendRecv, !enable, LinphoneMediaDirectionSendRecv); // Wait a little bit wait_for_list(coresList, NULL, 0, 1000); enable = !enable; } linphone_config_set_int(linphone_core_get_config(focus.getLc()), "sip", "defer_update_default", FALSE); if (paulineConference) { stats focus_stat2 = focus.getStats(); stats marie_stat2 = marie.getStats(); stats pauline_stat2 = pauline.getStats(); stats laure_stat2 = laure.getStats(); LinphoneCall *pcall = linphone_core_get_call_by_remote_address2(pauline.getLc(), confAddr); BC_ASSERT_PTR_NOT_NULL(pcall); bool_t video_enabled = FALSE; if (pcall) { const LinphoneCallParams *call_cparams = linphone_call_get_current_params(pcall); video_enabled = linphone_call_params_video_enabled(call_cparams); } linphone_conference_leave(paulineConference); BC_ASSERT_TRUE(wait_for_list(coresList, &pauline.getStats().number_of_LinphoneCallPausing, pauline_stat2.number_of_LinphoneCallPausing + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &pauline.getStats().number_of_LinphoneCallPaused, pauline_stat2.number_of_LinphoneCallPaused + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallPausedByRemote, focus_stat2.number_of_LinphoneCallPausedByRemote + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participant_devices_on_hold, focus_stat2.number_of_participant_devices_on_hold + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &laure.getStats().number_of_participant_devices_on_hold, laure_stat2.number_of_participant_devices_on_hold + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &laure.getStats().number_of_participant_devices_media_capability_changed, laure_stat2.number_of_participant_devices_media_capability_changed + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_participant_devices_on_hold, marie_stat2.number_of_participant_devices_on_hold + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_participant_devices_media_capability_changed, marie_stat2.number_of_participant_devices_media_capability_changed + 1, liblinphone_tester_sip_timeout)); linphone_conference_enter(paulineConference); BC_ASSERT_TRUE(wait_for_list(coresList, &pauline.getStats().number_of_LinphoneCallResuming, pauline_stat2.number_of_LinphoneCallResuming + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &pauline.getStats().number_of_LinphoneCallStreamsRunning, pauline_stat2.number_of_LinphoneCallStreamsRunning + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallStreamsRunning,
1891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960
focus_stat2.number_of_LinphoneCallStreamsRunning + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participant_devices_joined, focus_stat2.number_of_participant_devices_joined + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &laure.getStats().number_of_participant_devices_joined, laure_stat2.number_of_participant_devices_joined + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &laure.getStats().number_of_participant_devices_media_capability_changed, laure_stat2.number_of_participant_devices_media_capability_changed + 2, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_participant_devices_joined, marie_stat2.number_of_participant_devices_joined + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_participant_devices_media_capability_changed, marie_stat2.number_of_participant_devices_media_capability_changed + 2, liblinphone_tester_sip_timeout)); if (pcall) { const LinphoneCallParams *call_cparams = linphone_call_get_current_params(pcall); BC_ASSERT_EQUAL(linphone_call_params_video_enabled(call_cparams), video_enabled, int, "%0d"); } } std::list<LinphoneCoreManager *> mgrsToRemove{pauline.getCMgr()}; mgrsToRemove.push_back(laure.getCMgr()); for (auto mgr : mgrsToRemove) { LinphoneCall *call = linphone_core_get_current_call(mgr->lc); BC_ASSERT_PTR_NOT_NULL(call); if (call) { linphone_call_terminate(call); BC_ASSERT_TRUE( wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallEnd, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallReleased, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneSubscriptionTerminated, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateTerminationPending, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateTerminated, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateDeleted, 1, liblinphone_tester_sip_timeout)); LinphoneAddress *uri = linphone_address_new(linphone_core_get_identity(mgr->lc)); LinphoneConference *pconference = linphone_core_search_conference(mgr->lc, NULL, uri, confAddr, NULL); BC_ASSERT_PTR_NULL(pconference); linphone_address_unref(uri); } } BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participants_removed, focus_stat.number_of_participants_removed + 2, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participant_devices_removed, focus_stat.number_of_participant_devices_removed + 2, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_participants_removed, marie_stat.number_of_participants_removed + 2, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_participant_devices_removed, marie_stat.number_of_participant_devices_removed + 2, liblinphone_tester_sip_timeout)); // wait bit more to detect side effect if any CoreManagerAssert({focus, marie, pauline, laure}).waitUntil(chrono::seconds(2), [] { return false; });
1961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030
BC_ASSERT_EQUAL(marie.getStats().number_of_LinphoneConferenceStateTerminationPending, marie_stat.number_of_LinphoneConferenceStateTerminationPending, int, "%d"); BC_ASSERT_EQUAL(marie.getStats().number_of_LinphoneConferenceStateTerminated, marie_stat.number_of_LinphoneConferenceStateTerminated, int, "%d"); BC_ASSERT_EQUAL(marie.getStats().number_of_LinphoneConferenceStateDeleted, marie_stat.number_of_LinphoneConferenceStateDeleted, int, "%d"); BC_ASSERT_EQUAL(focus.getStats().number_of_LinphoneConferenceStateTerminationPending, focus_stat.number_of_LinphoneConferenceStateTerminationPending, int, "%d"); BC_ASSERT_EQUAL(focus.getStats().number_of_LinphoneConferenceStateTerminated, focus_stat.number_of_LinphoneConferenceStateTerminated, int, "%d"); BC_ASSERT_EQUAL(focus.getStats().number_of_LinphoneConferenceStateDeleted, focus_stat.number_of_LinphoneConferenceStateDeleted, int, "%d"); for (auto mgr : {focus.getCMgr(), marie.getCMgr()}) { LinphoneConference *pconference = linphone_core_search_conference_2(mgr->lc, confAddr); BC_ASSERT_PTR_NOT_NULL(pconference); if (pconference) { BC_ASSERT_EQUAL(linphone_conference_get_participant_count(pconference), ((mgr == focus.getCMgr()) ? 1 : 0), int, "%0d"); bctbx_list_t *devices = linphone_conference_get_participant_device_list(pconference); BC_ASSERT_EQUAL(bctbx_list_size(devices), 1, size_t, "%zu"); if (devices) { bctbx_list_free_with_data(devices, (void (*)(void *))linphone_participant_device_unref); } BC_ASSERT_STRING_EQUAL(linphone_conference_get_subject(pconference), initialSubject); } } const bctbx_list_t *calls = linphone_core_get_calls(marie.getLc()); BC_ASSERT_EQUAL(bctbx_list_size(calls), 1, size_t, "%zu"); LinphoneCall *call = linphone_core_get_call_by_remote_address2(marie.getLc(), focus.getCMgr()->identity); BC_ASSERT_PTR_NOT_NULL(call); if (call) { linphone_call_terminate(call); BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneCallEnd, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneCallReleased, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneSubscriptionTerminated, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneConferenceStateTerminationPending, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneConferenceStateTerminated, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneConferenceStateDeleted, 1, liblinphone_tester_sip_timeout)); // Explicitely terminate conference as those on server are static by default LinphoneConference *pconference = linphone_core_search_conference_2(focus.getLc(), confAddr); BC_ASSERT_PTR_NOT_NULL(pconference); if (pconference) { linphone_conference_terminate(pconference); } BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneConferenceStateTerminationPending, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneConferenceStateTerminated, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneConferenceStateDeleted, 1, liblinphone_tester_sip_timeout)); } for (auto mgr : {marie.getCMgr(), pauline.getCMgr(), laure.getCMgr()}) { const bctbx_list_t *call_logs = linphone_core_get_call_logs(mgr->lc); BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(call_logs), 1, unsigned int, "%u"); bctbx_list_t *mgr_focus_call_log =
2031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100
linphone_core_get_call_history_2(mgr->lc, focus.getCMgr()->identity, mgr->identity); BC_ASSERT_PTR_NOT_NULL(mgr_focus_call_log); if (mgr_focus_call_log) { BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(mgr_focus_call_log), 1, unsigned int, "%u"); for (bctbx_list_t *it = mgr_focus_call_log; it; it = bctbx_list_next(it)) { LinphoneCallLog *call_log = (LinphoneCallLog *)it->data; BC_ASSERT_TRUE(linphone_call_log_was_conference(call_log)); } bctbx_list_free_with_data(mgr_focus_call_log, (bctbx_list_free_func)linphone_call_log_unref); } } // wait bit more to detect side effect if any CoreManagerAssert({focus, marie, pauline, laure, michelle}).waitUntil(chrono::seconds(2), [] { return false; }); bctbx_list_free_with_data(participants_info, (bctbx_list_free_func)linphone_participant_info_unref); linphone_address_unref(confAddr); bctbx_list_free(coresList); } } static void change_active_speaker(void) { Focus focus("chloe_rc"); { // to make sure focus is destroyed after clients. ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); // audio only ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); setup_conference_info_cbs(marie.getCMgr()); bctbx_list_t *coresList = NULL; std::list<LinphoneCoreManager *> invitesList{pauline.getCMgr(), laure.getCMgr()}; std::list<LinphoneCoreManager *> participantsList{pauline.getCMgr(), laure.getCMgr(), marie.getCMgr()}; std::list<LinphoneCoreManager *> cmgrsList{focus.getCMgr(), marie.getCMgr(), pauline.getCMgr(), laure.getCMgr()}; for (LinphoneCoreManager *mgr : cmgrsList) { if (mgr != pauline.getCMgr()) { LinphoneVideoActivationPolicy *pol = linphone_factory_create_video_activation_policy(linphone_factory_get()); linphone_video_activation_policy_set_automatically_accept(pol, TRUE); linphone_video_activation_policy_set_automatically_initiate(pol, TRUE); linphone_core_set_video_activation_policy(mgr->lc, pol); linphone_video_activation_policy_unref(pol); } disable_all_video_codecs_except_one(mgr->lc, "VP8"); linphone_core_set_video_device(mgr->lc, liblinphone_tester_mire_id); linphone_core_enable_video_capture(mgr->lc, TRUE); linphone_core_enable_video_display(mgr->lc, TRUE); linphone_core_set_video_display_filter(mgr->lc, "MSAnalyseDisplay"); if (mgr != focus.getCMgr()) { linphone_core_set_default_conference_layout(mgr->lc, LinphoneConferenceLayoutActiveSpeaker); } enable_stun_in_mgr(mgr, TRUE, FALSE, TRUE, FALSE); coresList = bctbx_list_append(coresList, mgr->lc); } linphone_core_set_file_transfer_server(marie.getLc(), file_transfer_url); stats focus_stat = focus.getStats(); time_t start_time = ms_time(NULL); int duration = -1; time_t end_time = (duration <= 0) ? -1 : (start_time + duration * 60); const char *initialSubject = "Test group"; const char *description = "hello";
2101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170
LinphoneConferenceSecurityLevel security_level = LinphoneConferenceSecurityLevelNone; bctbx_list_t *participants_info = NULL; std::map<LinphoneCoreManager *, LinphoneParticipantInfo *> participantList; LinphoneParticipantRole role = LinphoneParticipantRoleSpeaker; for (auto &p : invitesList) { participantList.insert( std::make_pair(p, add_participant_info_to_list(&participants_info, p->identity, role, -1))); } LinphoneAddress *confAddr = create_conference_on_server(focus, marie, participantList, start_time, end_time, initialSubject, description, TRUE, security_level); BC_ASSERT_PTR_NOT_NULL(confAddr); // Chat room creation to send ICS BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneConferenceStateCreated, 2, liblinphone_tester_sip_timeout)); for (LinphoneCoreManager *mgr : participantsList) { LinphoneCallParams *new_params = linphone_core_create_call_params(mgr->lc, nullptr); linphone_call_params_set_video_direction(new_params, LinphoneMediaDirectionSendRecv); if (mgr != pauline.getCMgr()) { linphone_call_params_enable_video(new_params, TRUE); } linphone_core_invite_address_with_params_2(mgr->lc, confAddr, new_params, NULL, nullptr); linphone_call_params_unref(new_params); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallOutgoingProgress, 1, liblinphone_tester_sip_timeout)); int nbStreamsRunning = 2; BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallUpdating, (nbStreamsRunning - 1), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallStreamsRunning, nbStreamsRunning, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateCreated, ((mgr == marie.getCMgr()) ? 3 : 2), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneSubscriptionOutgoingProgress, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneSubscriptionActive, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_NotifyFullStateReceived, 1, liblinphone_tester_sip_timeout)); } { BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallIncomingReceived, focus_stat.number_of_LinphoneCallIncomingReceived + 3, liblinphone_tester_sip_timeout)); int focusNbStreamsRunning = 2; BC_ASSERT_TRUE( wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallUpdatedByRemote, focus_stat.number_of_LinphoneCallUpdatedByRemote + 3 * (focusNbStreamsRunning - 1), liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneCallStreamsRunning, focus_stat.number_of_LinphoneCallStreamsRunning + 3 * focusNbStreamsRunning, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneConferenceStateCreated, focus_stat.number_of_LinphoneConferenceStateCreated + 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneSubscriptionIncomingReceived, focus_stat.number_of_LinphoneSubscriptionIncomingReceived + 3, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneSubscriptionActive, focus_stat.number_of_LinphoneSubscriptionActive + 3, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participants_added, focus_stat.number_of_participants_added + 3, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participant_devices_added, focus_stat.number_of_participant_devices_added + 3, liblinphone_tester_sip_timeout));
2171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240
BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_participant_devices_joined, focus_stat.number_of_participant_devices_joined + 3, liblinphone_tester_sip_timeout)); } LinphoneConference *fconference = linphone_core_search_conference_2(focus.getLc(), confAddr); BC_ASSERT_PTR_NOT_NULL(fconference); // wait bit more to detect side effect if any CoreManagerAssert({focus, marie, pauline, laure}).waitUntil(chrono::seconds(2), [] { return false; }); int nbStreamsAudio = 1; int nbStreamsVideo = 0; int nbStreamsText = 0; for (LinphoneCoreManager *mgr : cmgrsList) { nbStreamsVideo = ((mgr != pauline.getCMgr()) ? 3 : 0); LinphoneConference *pconference = linphone_core_search_conference_2(mgr->lc, confAddr); BC_ASSERT_PTR_NOT_NULL(pconference); if (pconference) { const LinphoneConferenceParams *conference_params = linphone_conference_get_current_params(pconference); int nbParticipants = 0; if (start_time >= 0) { BC_ASSERT_EQUAL((long long)linphone_conference_params_get_start_time(conference_params), (long long)start_time, long long, "%lld"); } BC_ASSERT_EQUAL((long long)linphone_conference_params_get_end_time(conference_params), (long long)end_time, long long, "%lld"); if (mgr == focus.getCMgr()) { nbParticipants = 3; BC_ASSERT_FALSE(linphone_conference_is_in(pconference)); } else { nbParticipants = 2; BC_ASSERT_TRUE(linphone_conference_is_in(pconference)); LinphoneCall *current_call = linphone_core_get_current_call(mgr->lc); BC_ASSERT_PTR_NOT_NULL(current_call); if (current_call) { BC_ASSERT_EQUAL((int)linphone_call_get_state(current_call), (int)LinphoneCallStateStreamsRunning, int, "%0d"); } LinphoneCall *pcall = linphone_core_get_call_by_remote_address2(mgr->lc, confAddr); BC_ASSERT_PTR_NOT_NULL(pcall); if (pcall) { _linphone_call_check_max_nb_streams( pcall, nbStreamsAudio, (mgr != pauline.getCMgr() ? nbStreamsVideo : 0), nbStreamsText); } LinphoneCall *ccall = linphone_core_get_call_by_remote_address2(focus.getLc(), mgr->identity); BC_ASSERT_PTR_NOT_NULL(ccall); if (ccall) { _linphone_call_check_max_nb_streams( ccall, nbStreamsAudio, (mgr != pauline.getCMgr() ? nbStreamsVideo : 0), nbStreamsText); } } BC_ASSERT_EQUAL(linphone_conference_get_participant_count(pconference), nbParticipants, int, "%0d"); bctbx_list_t *devices = linphone_conference_get_participant_device_list(pconference); BC_ASSERT_EQUAL(bctbx_list_size(devices), 3, size_t, "%zu"); if (devices) { bctbx_list_free_with_data(devices, (void (*)(void *))linphone_participant_device_unref); } BC_ASSERT_STRING_EQUAL(linphone_conference_get_subject(pconference), initialSubject); LinphoneParticipant *me = linphone_conference_get_me(pconference); BC_ASSERT_TRUE(linphone_participant_is_admin(me) == ((mgr == marie.getCMgr()) || (mgr == focus.getCMgr()))); BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_participant_get_address(me), mgr->identity)); bctbx_list_t *participants = linphone_conference_get_participant_list(pconference); for (bctbx_list_t *itp = participants; itp; itp = bctbx_list_next(itp)) { LinphoneParticipant *p = (LinphoneParticipant *)bctbx_list_get_data(itp); BC_ASSERT_TRUE( linphone_participant_is_admin(p) ==
2241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310
linphone_address_weak_equal(linphone_participant_get_address(p), marie.getCMgr()->identity)); } bctbx_list_free_with_data(participants, (void (*)(void *))linphone_participant_unref); if (mgr != focus.getCMgr()) { check_conference_ssrc(fconference, pconference); } } } // need time to decode video wait_for_list(coresList, NULL, 1, liblinphone_tester_sip_timeout); _linphone_conference_video_change(coresList, marie.getCMgr(), pauline.getCMgr(), laure.getCMgr()); // end for (LinphoneCoreManager *mgr : participantsList) { LinphoneCall *call = linphone_core_get_call_by_remote_address2(mgr->lc, focus.getCMgr()->identity); BC_ASSERT_PTR_NOT_NULL(call); if (call) { linphone_call_terminate(call); BC_ASSERT_TRUE( wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallEnd, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallReleased, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneSubscriptionTerminated, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateTerminationPending, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateTerminated, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneConferenceStateDeleted, 1, liblinphone_tester_sip_timeout)); } } // Explicitely terminate conference as those on server are static by default LinphoneConference *pconference = linphone_core_search_conference_2(focus.getLc(), confAddr); BC_ASSERT_PTR_NOT_NULL(pconference); if (pconference) { linphone_conference_terminate(pconference); } BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneConferenceStateTerminationPending, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneConferenceStateTerminated, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &focus.getStats().number_of_LinphoneConferenceStateDeleted, 1, liblinphone_tester_sip_timeout)); for (auto mgr : cmgrsList) { BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneSubscriptionTerminated, 1, liblinphone_tester_sip_timeout)); if (mgr && (mgr != focus.getCMgr())) { LinphoneCall *participant_call = linphone_core_get_call_by_remote_address2(mgr->lc, focus.getCMgr()->identity); BC_ASSERT_PTR_NULL(participant_call); LinphoneCall *conference_call = linphone_core_get_call_by_remote_address2(focus.getLc(), mgr->identity); BC_ASSERT_PTR_NULL(conference_call); const bctbx_list_t *call_logs = linphone_core_get_call_logs(mgr->lc); BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(call_logs), 1, unsigned int, "%u"); bctbx_list_t *mgr_focus_call_log = linphone_core_get_call_history_2(mgr->lc, focus.getCMgr()->identity, mgr->identity); BC_ASSERT_PTR_NOT_NULL(mgr_focus_call_log); if (mgr_focus_call_log) { BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(mgr_focus_call_log), 1, unsigned int, "%u"); for (bctbx_list_t *it = mgr_focus_call_log; it; it = bctbx_list_next(it)) { LinphoneCallLog *call_log = (LinphoneCallLog *)it->data; BC_ASSERT_TRUE(linphone_call_log_was_conference(call_log));
2311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380
} bctbx_list_free_with_data(mgr_focus_call_log, (bctbx_list_free_func)linphone_call_log_unref); } } } bctbx_list_free_with_data(participants_info, (bctbx_list_free_func)linphone_participant_info_unref); linphone_address_unref(confAddr); bctbx_list_free(coresList); } } static void one_participant_conference_toggles_video_grid(void) { create_one_participant_conference_toggle_video_base(LinphoneConferenceLayoutGrid, FALSE, FALSE); } static void one_participant_conference_toggles_video_active_speaker(void) { create_one_participant_conference_toggle_video_base(LinphoneConferenceLayoutActiveSpeaker, FALSE, FALSE); } static void create_scheduled_conference_with_active_call(void) { create_conference_with_active_call_base(FALSE); } #if 0 static void conference_with_participant_added_outside_valid_time_slot (bool_t before_start) { Focus focus("chloe_rc"); {//to make sure focus is destroyed after clients. ClientConference marie("marie_rc", focus.getConferenceFactoryAddress()); ClientConference pauline("pauline_rc", focus.getConferenceFactoryAddress()); ClientConference laure("laure_tcp_rc", focus.getConferenceFactoryAddress()); focus.registerAsParticipantDevice(marie); focus.registerAsParticipantDevice(pauline); focus.registerAsParticipantDevice(laure); setup_conference_info_cbs(marie.getCMgr()); linphone_core_set_file_transfer_server(marie.getLc(), file_transfer_url); linphone_core_set_conference_participant_list_type(focus.getLc(), LinphoneConferenceParticipantListTypeOpen); bctbx_list_t * coresList = bctbx_list_append(NULL, focus.getLc()); coresList = bctbx_list_append(coresList, marie.getLc()); coresList = bctbx_list_append(coresList, pauline.getLc()); coresList = bctbx_list_append(coresList, laure.getLc()); std::list<LinphoneCoreManager *> participants{pauline.getCMgr(), laure.getCMgr()}; time_t start_time = (time_t)-1; time_t end_time = (time_t)-1; if (before_start) { start_time = ms_time(NULL) + 600; } else { start_time = ms_time(NULL) - 60; } end_time = start_time + 60; const char *initialSubject = "Colleagues"; const char *description = "Tom Black"; bctbx_list_t *participants_info = NULL; std::map<LinphoneCoreManager *, LinphoneParticipantInfo*> participantList; LinphoneParticipantRole role = LinphoneParticipantRoleSpeaker; for (auto &p : participants) { participantList.insert(std::make_pair(p, add_participant_info_to_list(&participants_info, p->identity, role, -1))); role = (role == LinphoneParticipantRoleSpeaker) ? LinphoneParticipantRoleListener : LinphoneParticipantRoleSpeaker; } LinphoneAddress* confAddr = create_conference_on_server(focus, marie, participantList, start_time, end_time, initialSubject, description, TRUE, security_level); BC_ASSERT_PTR_NOT_NULL(confAddr); // Chat room creation to send ICS BC_ASSERT_TRUE(wait_for_list(coresList, &marie.getStats().number_of_LinphoneConferenceStateCreated, 2, liblinphone_tester_sip_timeout));
2381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450
for (auto mgr : {marie.getCMgr(), pauline.getCMgr(), laure.getCMgr()}) { LinphoneCallParams *new_params = linphone_core_create_call_params(mgr->lc, nullptr); linphone_core_invite_address_with_params_2(mgr->lc, confAddr, new_params, NULL, nullptr); linphone_call_params_unref(new_params); } for (auto mgr : {marie.getCMgr(), pauline.getCMgr(), laure.getCMgr()}) { BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallOutgoingProgress, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallStreamsRunning, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallEnd, 1, liblinphone_tester_sip_timeout)); BC_ASSERT_TRUE(wait_for_list(coresList, &mgr->stat.number_of_LinphoneCallReleased, 1, liblinphone_tester_sip_timeout)); } //wait bit more to detect side effect if any CoreManagerAssert({focus,marie,pauline,laure}).waitUntil(chrono::seconds(2),[] { return false; }); bctbx_list_free_with_data(participants_info, (bctbx_list_free_func)linphone_participant_info_unref); linphone_address_unref(confAddr); bctbx_list_free(coresList); } } static void conference_with_participants_added_after_end (void) { conference_with_participant_added_outside_valid_time_slot(FALSE); } static void conference_with_participants_added_before_start (void) { conference_with_participant_added_outside_valid_time_slot(TRUE); } #endif } // namespace LinphoneTest static test_t local_conference_scheduled_conference_basic_tests[] = { TEST_NO_TAG("Call to inexisting conference address", LinphoneTest::call_to_inexisting_conference_address), TEST_NO_TAG("Create conference on unresponsive server", LinphoneTest::create_conference_on_unresponsive_server), TEST_NO_TAG("Create simple conference", LinphoneTest::create_simple_conference), // TEST_NO_TAG("Create conference with only listeners and uninvited participant", // LinphoneTest::create_conference_with_only_listeners_and_uninvited_participant), TEST_NO_TAG("Create conference with only speakers and uninvited participant", LinphoneTest::create_conference_with_only_speakers_and_uninvited_participant), TEST_NO_TAG("Create conference with uninvited participant", LinphoneTest::create_conference_with_uninvited_participant), TEST_NO_TAG("Create simple conference with server restart", LinphoneTest::create_simple_conference_with_server_restart), TEST_NO_TAG("Create simple conference with client restart", LinphoneTest::create_simple_conference_with_client_restart), TEST_NO_TAG("Create conference with late participant addition", LinphoneTest::create_conference_with_late_participant_addition), TEST_NO_TAG("Organizer schedules 2 conferences", LinphoneTest::organizer_schedule_two_conferences), TEST_NO_TAG("Create simple point-to-point encrypted conference", LinphoneTest::create_simple_point_to_point_encrypted_conference), TEST_NO_TAG("Create simple end-to-end encrypted conference", LinphoneTest::create_simple_end_to_end_encrypted_conference), TEST_NO_TAG("Create conference starting immediately", LinphoneTest::create_conference_starting_immediately), TEST_NO_TAG("Create conference starting in the past", LinphoneTest::create_conference_starting_in_the_past), TEST_NO_TAG("Create conference with participant codec mismatch", LinphoneTest::create_conference_with_participant_codec_mismatch), TEST_NO_TAG("Create conference with organizer codec mismatch", LinphoneTest::create_conference_with_organizer_codec_mismatch)}; static test_t local_conference_scheduled_conference_advanced_tests[] = { TEST_NO_TAG("Create simple SRTP conference", LinphoneTest::create_simple_srtp_conference), TEST_NO_TAG("Create simple ZRTP conference", LinphoneTest::create_simple_zrtp_conference), TEST_NO_TAG("Create simple DTLS conference", LinphoneTest::create_simple_dtls_conference), TEST_NO_TAG("Create conference with server restart (participant first)",
24512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518
LinphoneTest::create_conference_with_server_restart_participant_first), TEST_NO_TAG("Create conference with server restart (organizer first)", LinphoneTest::create_conference_with_server_restart_organizer_first), TEST_NO_TAG("Create simple conference with update deferred", LinphoneTest::create_simple_conference_with_update_deferred), TEST_NO_TAG("Create conference with uninvited participant not allowed", LinphoneTest::create_conference_with_uninvited_participant_not_allowed), TEST_NO_TAG("Create conference with late participant addition declined", LinphoneTest::create_conference_with_late_participant_addition_declined), #if 0 TEST_NO_TAG("Conference with participants added after conference end", LinphoneTest::conference_with_participants_added_after_end), TEST_NO_TAG("Conference with participants added before conference start", LinphoneTest::conference_with_participants_added_before_start), #endif TEST_NO_TAG("Create one participant conference toggles video in grid layout", LinphoneTest::one_participant_conference_toggles_video_grid), TEST_NO_TAG("Create one participant conference toggles video in active speaker layout", LinphoneTest::one_participant_conference_toggles_video_active_speaker), TEST_NO_TAG("2 overlapping conferences from different organizers", LinphoneTest::two_overlapping_scheduled_conferences_from_different_organizers), TEST_NO_TAG("Create scheduled conference with active call", LinphoneTest::create_scheduled_conference_with_active_call), TEST_NO_TAG("Change active speaker", LinphoneTest::change_active_speaker)}; static test_t local_conference_scheduled_conference_audio_only_participant_tests[] = { TEST_NO_TAG("Create end-to-end encrypted conference with audio only participants", LinphoneTest::create_end_to_end_encryption_conference_with_audio_only_participants), TEST_NO_TAG("Create conference with audio only and uninvited participant", LinphoneTest::create_conference_with_audio_only_and_uninvited_participant), TEST_NO_TAG("Create simple conference with audio only participant enabling video", LinphoneTest::create_simple_conference_with_audio_only_participant_enabling_video), TEST_NO_TAG("Create simple conference with audio only participant", LinphoneTest::create_simple_conference_with_audio_only_participant), TEST_NO_TAG("Create conference with audio only participants", LinphoneTest::create_conference_with_audio_only_participants)}; test_suite_t local_conference_test_suite_scheduled_conference_basic = { "Local conference tester (Scheduled Conference Basic)", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(local_conference_scheduled_conference_basic_tests) / sizeof(local_conference_scheduled_conference_basic_tests[0]), local_conference_scheduled_conference_basic_tests, 0}; test_suite_t local_conference_test_suite_scheduled_conference_advanced = { "Local conference tester (Scheduled Conference Advanced)", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(local_conference_scheduled_conference_advanced_tests) / sizeof(local_conference_scheduled_conference_advanced_tests[0]), local_conference_scheduled_conference_advanced_tests, 0}; test_suite_t local_conference_test_suite_scheduled_conference_audio_only_participant = { "Local conference tester (Audio only participants)", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, sizeof(local_conference_scheduled_conference_audio_only_participant_tests) / sizeof(local_conference_scheduled_conference_audio_only_participant_tests[0]), local_conference_scheduled_conference_audio_only_participant_tests, 0};