Commit a76f1227 authored by Simon Morlat's avatar Simon Morlat

Fix group chat, accidentally broken while repairing basic chat in commit...

Fix group chat, accidentally broken while repairing basic chat in commit aae65f05.
Also, repair "secure group chat" suite broken by commit c2706c77.
Fix a few unreliable tests and memory leaks.
parent 06f7ca6a
......@@ -82,10 +82,13 @@ public:
return;
}
migrationRealTime = currentRealTime;
char *tmp = linphone_address_as_string(linphone_proxy_config_get_contact(proxy)); //get the gruu address
IdentityAddress localAddress(tmp);
bctbx_free(tmp);
clientGroupChatRoom = static_pointer_cast<ClientGroupChatRoom>(
//make sure to have a one2one chatroom
chatRoom->getCore()->getPrivate()->createChatRoom(
ChatRoomParams::create(chatRoom->getCapabilities() & ChatRoom::Capabilities::Encrypted, false, ChatRoomParams::ChatRoomBackend::FlexisipChat), chatRoom->getLocalAddress(), chatRoom->getSubject(), {Address(chatRoom->getPeerAddress())}
ChatRoomParams::create(chatRoom->getCapabilities() & ChatRoom::Capabilities::Encrypted, false, ChatRoomParams::ChatRoomBackend::FlexisipChat), localAddress, chatRoom->getSubject(), {Address(chatRoom->getPeerAddress())}
)
);
clientGroupChatRoom->getPrivate()->setCallSessionListener(this);
......
......@@ -680,13 +680,8 @@ void ClientGroupChatRoom::onFirstNotifyReceived (const IdentityAddress &addr) {
if (chatRoom) {
auto capabilities = chatRoom->getCapabilities();
bool migrationEnabled = !!linphone_config_get_int(
linphone_core_get_config(getCore()->getCCore()),
"misc",
"enable_basic_to_client_group_chat_room_migration",
FALSE
);
if (migrationEnabled && (capabilities & ChatRoom::Capabilities::Basic) && (capabilities & ChatRoom::Capabilities::Migratable)) {
if (getCore()->getPrivate()->basicToFlexisipChatroomMigrationEnabled() && (capabilities & ChatRoom::Capabilities::Basic) && (capabilities & ChatRoom::Capabilities::Migratable)) {
performMigration = true;
}
}
......
......@@ -47,8 +47,13 @@ LINPHONE_BEGIN_NAMESPACE
// Helpers.
// -----------------------------------------------------------------------------
// Return the better local address to talk with peer address. Result address must contain gru
static IdentityAddress getDefaultLocalAddress(const shared_ptr<Core> &core, const IdentityAddress *peerAddress) {
/*
* Returns the best local address to talk with peer address.
* If peerAddress is not defined, returns the local address of the default proxy config.
* If withGruu is true, returns the local address with its gruu parameter. FlexisipChat kind of chatroom (also refered as ClientGroupChatRoom)
* require a local address with gruu, unlike basic chatrooms.
*/
static IdentityAddress getDefaultLocalAddress(const shared_ptr<Core> &core, const IdentityAddress *peerAddress, bool withGruu) {
LinphoneCore *cCore = core->getCCore();
LinphoneProxyConfig *proxy = nullptr;
......@@ -62,7 +67,8 @@ static IdentityAddress getDefaultLocalAddress(const shared_ptr<Core> &core, cons
IdentityAddress localAddress;
if (proxy) {
char *identity = linphone_address_as_string(linphone_proxy_config_get_identity_address(proxy));
char *identity = linphone_address_as_string(
withGruu ? linphone_proxy_config_get_contact(proxy) : linphone_proxy_config_get_identity_address(proxy));
localAddress = IdentityAddress(identity);
bctbx_free(identity);
} else
......@@ -105,6 +111,10 @@ shared_ptr<AbstractChatRoom> CorePrivate::createClientGroupChatRoom (
lWarning() << "Invalid chat room parameters given for client group chat room creation";
return nullptr;
}
if (!conferenceId.getLocalAddress().hasGruu()){
lError() << "createClientGroupChatRoom(): local address must have a gruu.";
return nullptr;
}
shared_ptr<ClientGroupChatRoom> clientGroupChatRoom(new ClientGroupChatRoom(q->getSharedFromThis(),
conferenceFactoryUri,
conferenceId,
......@@ -158,7 +168,7 @@ shared_ptr<AbstractChatRoom> CorePrivate::createClientGroupChatRoom (
shared_ptr<AbstractChatRoom> CorePrivate::createClientGroupChatRoom(const string &subject, bool fallback, bool encrypted) {
L_Q();
IdentityAddress defaultLocalAddress = getDefaultLocalAddress(q->getSharedFromThis(), nullptr);
IdentityAddress defaultLocalAddress = getDefaultLocalAddress(q->getSharedFromThis(), nullptr, true);
IdentityAddress conferenceFactoryUri(getConferenceFactoryUri(q->getSharedFromThis(), defaultLocalAddress));
shared_ptr<ChatRoomParams> params = ChatRoomParams::create(encrypted, !fallback, ChatRoomParams::ChatRoomBackend::FlexisipChat);
......@@ -178,7 +188,7 @@ shared_ptr<AbstractChatRoom> CorePrivate::createBasicChatRoom (
else {
BasicChatRoom *basicChatRoom = new BasicChatRoom(q->getSharedFromThis(), conferenceId, params);
string conferenceFactoryUri = getConferenceFactoryUri(q->getSharedFromThis(), conferenceId.getLocalAddress());
if (basicToFlexisipChatroomMigrationEnabled) {
if (basicToFlexisipChatroomMigrationEnabled()) {
capabilities.set(ChatRoom::Capabilities::Migratable);
}else{
capabilities.unset(ChatRoom::Capabilities::Migratable);
......@@ -210,7 +220,7 @@ shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const shared_ptr<ChatRo
lWarning() << "Trying to create chat room with invalid parameters " << params->toString();
return nullptr;
}
shared_ptr<AbstractChatRoom> chatRoom;
if (params->getChatRoomBackend() == ChatRoomParams::ChatRoomBackend::FlexisipChat) {
string conferenceFactoryUri = getConferenceFactoryUri(q->getSharedFromThis(), localAddr);
......@@ -245,16 +255,14 @@ shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const shared_ptr<ChatRo
shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const shared_ptr<ChatRoomParams> &params, const std::string &subject, const std::list<IdentityAddress> &participants) {
L_Q();
IdentityAddress defaultLocalAddress = getDefaultLocalAddress(q->getSharedFromThis(), nullptr);
IdentityAddress defaultLocalAddress = getDefaultLocalAddress(q->getSharedFromThis(), nullptr,
params->getChatRoomBackend() == ChatRoomParams::ChatRoomBackend::FlexisipChat);
return createChatRoom(params, defaultLocalAddress, subject, participants);
}
shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const std::string &subject, const std::list<IdentityAddress> &participants) {
L_Q();
IdentityAddress defaultLocalAddress = getDefaultLocalAddress(q->getSharedFromThis(), nullptr);
shared_ptr<ChatRoomParams> params = ChatRoomParams::getDefaults(q->getSharedFromThis());
if (participants.size() > 1) {
//Try to infer chat room type based on requested participants number
......@@ -262,6 +270,8 @@ shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const std::string &subj
} else {
params->setChatRoomBackend(ChatRoomParams::ChatRoomBackend::Basic);
}
IdentityAddress defaultLocalAddress = getDefaultLocalAddress(q->getSharedFromThis(), nullptr,
params->getChatRoomBackend() == ChatRoomParams::ChatRoomBackend::FlexisipChat);
return createChatRoom(params, defaultLocalAddress, subject, participants);
}
......@@ -413,7 +423,7 @@ shared_ptr<AbstractChatRoom> Core::getOrCreateBasicChatRoom (const ConferenceId
if (isRtt) {
capabilities |= ChatRoom::Capabilities::RealTimeText;
}
if (!!linphone_config_get_bool(linphone_core_get_config(getCCore()), "misc", "enable_basic_to_client_group_chat_room_migration", FALSE)) {
if (d->basicToFlexisipChatroomMigrationEnabled()) {
capabilities |= ChatRoom::Capabilities::Migratable;
}
chatRoom = d->createBasicChatRoom(conferenceId, capabilities, ChatRoomParams::fromCapabilities(capabilities));
......@@ -440,11 +450,11 @@ shared_ptr<AbstractChatRoom> Core::getOrCreateBasicChatRoom (const IdentityAddre
if (isRtt) {
capabilities |= ChatRoom::Capabilities::RealTimeText;
}
if (!!linphone_config_get_bool(linphone_core_get_config(getCCore()), "misc", "enable_basic_to_client_group_chat_room_migration", FALSE)) {
if (d->basicToFlexisipChatroomMigrationEnabled()) {
capabilities |= ChatRoom::Capabilities::Migratable;
}
shared_ptr<AbstractChatRoom> chatRoom = d->createBasicChatRoom(
ConferenceId(peerAddress, getDefaultLocalAddress(getSharedFromThis(), &peerAddress)),
ConferenceId(peerAddress, getDefaultLocalAddress(getSharedFromThis(), &peerAddress, false)),
capabilities,
ChatRoomParams::fromCapabilities(capabilities)
);
......
......@@ -107,8 +107,7 @@ public:
void replaceChatRoom (const std::shared_ptr<AbstractChatRoom> &replacedChatRoom, const std::shared_ptr<AbstractChatRoom> &newChatRoom);
void doLater(const std::function<void ()> &something);
belle_sip_main_loop_t *getMainLoop();
bool basicToFlexisipChatroomMigrationEnabled()const;
std::unique_ptr<MainDb> mainDb;
std::unique_ptr<RemoteConferenceListEventHandler> remoteListEventHandler;
std::unique_ptr<LocalConferenceListEventHandler> localListEventHandler;
......@@ -116,7 +115,6 @@ public:
private:
bool isInBackground = false;
bool isFriendListSubscriptionEnabled = false;
bool basicToFlexisipChatroomMigrationEnabled;
std::list<CoreListener *> listeners;
......
......@@ -56,8 +56,6 @@ void CorePrivate::init () {
mainDb.reset(new MainDb(q->getSharedFromThis()));
remoteListEventHandler = makeUnique<RemoteConferenceListEventHandler>(q->getSharedFromThis());
localListEventHandler = makeUnique<LocalConferenceListEventHandler>(q->getSharedFromThis());
basicToFlexisipChatroomMigrationEnabled = linphone_config_get_bool(linphone_core_get_config(q->getCCore()), "misc", "enable_basic_to_client_group_chat_room_migration", FALSE);
AbstractDb::Backend backend;
string uri = L_C_TO_STRING(lp_config_get_string(linphone_core_get_config(L_GET_C_BACK_PTR(q)), "storage", "uri", nullptr));
......@@ -189,6 +187,12 @@ void CorePrivate::enableFriendListsSubscription(bool enable) {
}
}
bool CorePrivate::basicToFlexisipChatroomMigrationEnabled()const{
L_Q();
return linphone_config_get_bool(linphone_core_get_config(q->getCCore()), "misc", "enable_basic_to_client_group_chat_room_migration", FALSE);
}
// =============================================================================
Core::Core () : Object(*new CorePrivate) {
......
......@@ -105,7 +105,7 @@ static void subscribe_test_with_args(bool_t terminated_by_subscriber, RefreshTes
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionActive,1,1000));
/*make sure marie receives first notification before terminating*/
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,5000));
if (refresh_type==AutoRefresh){
wait_for_list(lcs,NULL,0,6000);
......@@ -116,7 +116,7 @@ static void subscribe_test_with_args(bool_t terminated_by_subscriber, RefreshTes
}else if (refresh_type==ManualRefresh){
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionExpiring,1,4000));
linphone_event_update_subscribe(lev,NULL);
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,2,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,2,5000));
}
if (terminated_by_subscriber){
......@@ -126,8 +126,8 @@ static void subscribe_test_with_args(bool_t terminated_by_subscriber, RefreshTes
linphone_event_terminate(pauline->lev);
}
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,5000));
bctbx_list_free(lcs);
linphone_event_unref(lev);
......
......@@ -1649,17 +1649,19 @@ void sequential_forking(void) {
/*marie accepts the call on its second device*/
linphone_call_accept(call);
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,10000));
/*second device should have received nothing*/
BC_ASSERT_EQUAL(marie2->stat.number_of_LinphoneCallEnd, 0, int, "%d");
linphone_call_terminate(linphone_core_get_current_call(pauline->lc));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallReleased,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallReleased,1,5000));
end:
linphone_core_manager_destroy(pauline);
......@@ -1716,17 +1718,20 @@ void sequential_forking_with_timeout_for_highest_priority(void) {
/*marie accepts the call on her third device*/
linphone_call_accept(call);
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallConnected,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallStreamsRunning,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallConnected,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallStreamsRunning,1,10000));
/*second device should stop ringing*/
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,10000));
linphone_call_terminate(linphone_core_get_current_call(pauline->lc));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallReleased,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallReleased,1,10000));
/*first device should have received nothing*/
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallEnd, 0, int, "%d");
......@@ -1780,17 +1785,19 @@ void sequential_forking_with_no_response_for_highest_priority(void) {
/*marie accepts the call on her second device*/
linphone_call_accept(call);
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallConnected,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallStreamsRunning,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallConnected,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallStreamsRunning,1,10000));
/*the first device should finish*/
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd, 1, 3000));
linphone_call_terminate(linphone_core_get_current_call(pauline->lc));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallReleased,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallReleased,1,1000));
end:
linphone_core_manager_destroy(pauline);
......@@ -1851,11 +1858,13 @@ void sequential_forking_with_insertion_of_higher_priority(void) {
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallStreamsRunning,1,1000));
/*second device should stop ringing*/
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,3000));
linphone_call_terminate(linphone_core_get_current_call(pauline->lc));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallReleased,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallReleased,1,5000));
/*first device should have received nothing*/
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallEnd, 0, int, "%d");
......@@ -1927,8 +1936,10 @@ void sequential_forking_with_fallback_route(void) {
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000));
linphone_call_terminate(linphone_core_get_current_call(marie->lc));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallReleased,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallReleased,1,3000));
/*first device should have received nothing*/
BC_ASSERT_EQUAL(pauline2->stat.number_of_LinphoneCallEnd, 0, int, "%d");
......
......@@ -387,6 +387,7 @@ static void lime_x3dh_message_test (bool_t with_composing, bool_t with_response,
coresManagerList = bctbx_list_append(coresManagerList, marie);
coresManagerList = bctbx_list_append(coresManagerList, pauline);
int dummy = 0;
LinphoneChatMessage* msg;
bctbx_list_t *coresList = init_core_for_conference(coresManagerList);
start_core_for_conference(coresManagerList);
......@@ -417,7 +418,8 @@ static void lime_x3dh_message_test (bool_t with_composing, bool_t with_response,
// Marie sends the message
const char *marieMessage = "Hey ! What's up ?";
_send_message(marieCr, marieMessage);
msg = _send_message(marieCr, marieMessage);
linphone_chat_message_unref(msg);
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 10000));
LinphoneChatMessage *paulineLastMsg = pauline->stat.last_received_chat_message;
if (!BC_ASSERT_PTR_NOT_NULL(paulineLastMsg))
......@@ -438,7 +440,8 @@ static void lime_x3dh_message_test (bool_t with_composing, bool_t with_response,
// Pauline sends the response
const char *paulineMessage = "I'm fine thank you ! And you ?";
_send_message(paulineCr, paulineMessage);
msg = _send_message(paulineCr, paulineMessage);
linphone_chat_message_unref(msg);
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageReceived, initialMarieStats.number_of_LinphoneMessageReceived + 1, 10000));
LinphoneChatMessage *marieLastMsg = marie->stat.last_received_chat_message;
if (!BC_ASSERT_PTR_NOT_NULL(marieLastMsg))
......@@ -457,7 +460,7 @@ static void lime_x3dh_message_test (bool_t with_composing, bool_t with_response,
if (sal_error) {
sal_set_send_error(linphone_core_get_sal(marie->lc), -1);
LinphoneChatMessage* msg = _send_message(marieCr, "Bli bli bli");
msg = _send_message(marieCr, "Bli bli bli");
const char *message_id = linphone_chat_message_get_message_id(msg);
BC_ASSERT_STRING_NOT_EQUAL(message_id, "");
......@@ -470,6 +473,9 @@ static void lime_x3dh_message_test (bool_t with_composing, bool_t with_response,
BC_ASSERT_STRING_EQUAL(message_id, message_id_2);
wait_for_list(coresList, NULL, 0, 1000);
linphone_core_refresh_registers(marie->lc);
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneRegistrationOk, initialMarieStats.number_of_LinphoneRegistrationOk + 1, 10000));
linphone_chat_message_unref(msg);
}
......@@ -2551,11 +2557,11 @@ test_t secure_group_chat_tests[] = {
TEST_TWO_TAGS("LIME X3DH change server url", group_chat_lime_x3dh_change_server_url, "LimeX3DH", "LeaksMemory"),
TEST_TWO_TAGS("LIME X3DH encrypted chatrooms", group_chat_lime_x3dh_encrypted_chatrooms, "LimeX3DH", "LeaksMemory"),
TEST_TWO_TAGS("LIME X3DH basic chatrooms", group_chat_lime_x3dh_basic_chat_rooms, "LimeX3DH", "LeaksMemory"),
TEST_TWO_TAGS("LIME X3DH message", group_chat_lime_x3dh_send_encrypted_message, "LimeX3DH", "LeaksMemory"),
TEST_TWO_TAGS("LIME X3DH message with error", group_chat_lime_x3dh_send_encrypted_message_with_error, "LimeX3DH", "LeaksMemory"),
TEST_TWO_TAGS("LIME X3DH message with composing", group_chat_lime_x3dh_send_encrypted_message_with_composing, "LimeX3DH", "LeaksMemory"),
TEST_TWO_TAGS("LIME X3DH message with response", group_chat_lime_x3dh_send_encrypted_message_with_response, "LimeX3DH", "LeaksMemory"),
TEST_TWO_TAGS("LIME X3DH message with response and composing", group_chat_lime_x3dh_send_encrypted_message_with_response_and_composing, "LimeX3DH", "LeaksMemory"),
TEST_ONE_TAG("LIME X3DH message", group_chat_lime_x3dh_send_encrypted_message, "LimeX3DH"),
TEST_ONE_TAG("LIME X3DH message with error", group_chat_lime_x3dh_send_encrypted_message_with_error, "LimeX3DH"),
TEST_ONE_TAG("LIME X3DH message with composing", group_chat_lime_x3dh_send_encrypted_message_with_composing, "LimeX3DH"),
TEST_ONE_TAG("LIME X3DH message with response", group_chat_lime_x3dh_send_encrypted_message_with_response, "LimeX3DH"),
TEST_ONE_TAG("LIME X3DH message with response and composing", group_chat_lime_x3dh_send_encrypted_message_with_response_and_composing, "LimeX3DH"),
TEST_TWO_TAGS("LIME X3DH message to devices with and without keys on server", group_chat_lime_x3dh_encrypted_message_to_devices_with_and_without_keys, "LimeX3DH", "LeaksMemory"),
TEST_ONE_TAG("LIME X3DH send encrypted file", group_chat_lime_x3dh_send_encrypted_file, "LimeX3DH"),
TEST_ONE_TAG("LIME X3DH send encrypted file + text", group_chat_lime_x3dh_send_encrypted_file_plus_text, "LimeX3DH"),
......
......@@ -2678,8 +2678,8 @@ static void group_chat_room_migrate_from_basic_chat_room (void) {
bctbx_list_t *tmpCoresList = init_core_for_conference(tmpCoresManagerList);
bctbx_list_free(tmpCoresManagerList);
coresList = bctbx_list_concat(coresList, tmpCoresList);
linphone_core_manager_start(marie, TRUE);
lp_config_set_int(linphone_core_get_config(marie->lc), "misc", "enable_basic_to_client_group_chat_room_migration", 1);
linphone_core_manager_start(marie, TRUE);
marieCr = linphone_core_get_chat_room(marie->lc, paulineAddr);
/* // Enable chat room migration and restart core for Pauline */
......@@ -2690,9 +2690,9 @@ static void group_chat_room_migrate_from_basic_chat_room (void) {
tmpCoresList = init_core_for_conference(tmpCoresManagerList);
bctbx_list_free(tmpCoresManagerList);
coresList = bctbx_list_concat(coresList, tmpCoresList);
linphone_core_manager_start(pauline, TRUE);
lp_config_set_int(linphone_core_get_config(pauline->lc), "misc", "enable_basic_to_client_group_chat_room_migration", 1);
linphone_core_manager_start(pauline, TRUE);
paulineCr = linphone_core_get_chat_room(pauline->lc, linphone_chat_room_get_local_address(marieCr));
// Send a new message to initiate chat room migration
......@@ -2804,11 +2804,11 @@ static void group_chat_room_migrate_from_basic_to_client_fail (void) {
bctbx_list_t *tmpCoresList = init_core_for_conference(tmpCoresManagerList);
bctbx_list_free(tmpCoresManagerList);
coresList = bctbx_list_concat(coresList, tmpCoresList);
linphone_core_manager_start(marie, TRUE);
// Send a new message to initiate chat room migration
lp_config_set_int(linphone_core_get_config(marie->lc), "misc", "enable_basic_to_client_group_chat_room_migration", 1);
lp_config_set_int(linphone_core_get_config(marie->lc), "misc", "basic_to_client_group_chat_room_migration_timer", 5);
linphone_core_manager_start(marie, TRUE);
LinphoneAddress *paulineAddr = linphone_address_new(linphone_core_get_identity(pauline->lc));
marieCr = linphone_core_get_chat_room(marie->lc, paulineAddr);
linphone_address_unref(paulineAddr);
......
......@@ -329,6 +329,7 @@ static void quality_reporting_session_report_if_video_stopped (void) {
linphone_call_params_enable_video(pauline_params, FALSE);
linphone_call_update(call_pauline, pauline_params);
linphone_call_params_unref(pauline_params);
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2, 10000));
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &marie->stat.number_of_LinphonePublishProgress, 1, 10000));
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &marie->stat.number_of_LinphonePublishOk, 1, 10000));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment