...
 
Commits (2)
......@@ -26,6 +26,13 @@
// =============================================================================
/*
* The purpose of this class seems to be able to manipulate flag values that are declared as part of an enum.
* The C++ compiler forbids OR/AND operator on enums, however this can be easily workaround by either not using enum for mask but constexpr
* or by doing a basic cast to unsigned int.
* There are below 130 hardly readable lines of code for class doing this, but ~operator doesn't work as expected.
* (just try a &= EnumValue; to convince). TODO: question the interest of keeping this class and switch to simple const unsigned int.
*/
LINPHONE_BEGIN_NAMESPACE
template<typename T>
......@@ -58,7 +65,7 @@ public:
}
inline EnumMask &unset (T value) {
*this &= ~value;
*this &= ~StorageType(value);
return *this;
}
......
......@@ -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,6 +188,12 @@ shared_ptr<AbstractChatRoom> CorePrivate::createBasicChatRoom (
else {
BasicChatRoom *basicChatRoom = new BasicChatRoom(q->getSharedFromThis(), conferenceId, params);
string conferenceFactoryUri = getConferenceFactoryUri(q->getSharedFromThis(), conferenceId.getLocalAddress());
if (basicToFlexisipChatroomMigrationEnabled()) {
capabilities.set(ChatRoom::Capabilities::Migratable);
}else{
capabilities.unset(ChatRoom::Capabilities::Migratable);
}
if ((capabilities & ChatRoom::Capabilities::Migratable) && !conferenceFactoryUri.empty()) {
chatRoom.reset(new BasicToClientGroupChatRoom(shared_ptr<BasicChatRoom>(basicChatRoom)));
}
......@@ -192,6 +208,7 @@ shared_ptr<AbstractChatRoom> CorePrivate::createBasicChatRoom (
return chatRoom;
}
shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const shared_ptr<ChatRoomParams> &params, const IdentityAddress &localAddr, const std::string &subject, const std::list<IdentityAddress> &participants) {
L_Q();
......@@ -203,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);
......@@ -226,9 +243,7 @@ shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const shared_ptr<ChatRo
return nullptr;
}
ChatRoom::CapabilitiesMask capabilities = ChatRoomParams::toCapabilities(params);
if (!!linphone_config_get_bool(linphone_core_get_config(q->getCCore()), "misc", "enable_basic_to_client_group_chat_room_migration", FALSE)) {
capabilities |= ChatRoom::Capabilities::Migratable;
}
chatRoom = createBasicChatRoom(ConferenceId(IdentityAddress(participants.front()), localAddr),
capabilities,
params);
......@@ -240,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
......@@ -257,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);
}
......@@ -408,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));
......@@ -435,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)
);
......
......@@ -103,11 +103,11 @@ public:
const std::list<IdentityAddress> &participants);
std::shared_ptr<AbstractChatRoom> createChatRoom(const std::shared_ptr<ChatRoomParams> &params, const IdentityAddress &localAddr, const IdentityAddress &participant);
std::shared_ptr<AbstractChatRoom> createChatRoom(const IdentityAddress &participant);
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;
......
......@@ -187,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) {
......
......@@ -1931,7 +1931,7 @@ int MainDb::getEventCount (FilterMask mask) const {
mask
);
DurationLogger durationLogger("Get event count with mask=" + Utils::toString(mask) + ".");
//DurationLogger durationLogger("Get event count with mask=" + Utils::toString(mask) + ".");
return L_DB_TRANSACTION {
L_D();
......@@ -1979,11 +1979,13 @@ list<shared_ptr<EventLog>> MainDb::getConferenceNotifiedEvents (
const string query = Statements::get(Statements::SelectConferenceEvents) +
string(" AND notify_id > :lastNotifyId");
/*
DurationLogger durationLogger(
"Get conference notified events of: (peer=" + conferenceId.getPeerAddress().asString() +
", local=" + conferenceId.getLocalAddress().asString() +
", lastNotifyId=" + Utils::toString(lastNotifyId) + ")."
);
*/
return L_DB_TRANSACTION {
L_D();
......@@ -2001,10 +2003,12 @@ list<shared_ptr<EventLog>> MainDb::getConferenceNotifiedEvents (
}
int MainDb::getChatMessageCount (const ConferenceId &conferenceId) const {
/*
DurationLogger durationLogger(
"Get chat messages count of: (peer=" + conferenceId.getPeerAddress().asString() +
", local=" + conferenceId.getLocalAddress().asString() + ")."
);
*/
return L_DB_TRANSACTION {
L_D();
......@@ -2045,10 +2049,12 @@ int MainDb::getUnreadChatMessageCount (const ConferenceId &conferenceId) const {
query += " direction = " + Utils::toString(int(ChatMessage::Direction::Incoming)) +
+ " AND state <> " + Utils::toString(int(ChatMessage::State::Displayed));
/*
DurationLogger durationLogger(
"Get unread chat messages count of: (peer=" + conferenceId.getPeerAddress().asString() +
", local=" + conferenceId.getLocalAddress().asString() + ")."
);
*/
return L_DB_TRANSACTION {
int count = 0;
......@@ -2077,10 +2083,12 @@ void MainDb::markChatMessagesAsRead (const ConferenceId &conferenceId) const {
" SELECT event_id FROM conference_event WHERE chat_room_id = :chatRoomId"
") AND direction = " + Utils::toString(int(ChatMessage::Direction::Incoming));
/*
DurationLogger durationLogger(
"Mark chat messages as read of: (peer=" + conferenceId.getPeerAddress().asString() +
", local=" + conferenceId.getLocalAddress().asString() + ")."
);
*/
L_DB_TRANSACTION {
L_D();
......@@ -2230,11 +2238,12 @@ list<shared_ptr<ChatMessage>> MainDb::findChatMessages (
static const string query = Statements::get(Statements::SelectConferenceEvents) +
string(" AND imdn_message_id = :imdnMessageId");
/*
DurationLogger durationLogger(
"Find chat messages: (peer=" + conferenceId.getPeerAddress().asString() +
", local=" + conferenceId.getLocalAddress().asString() + ")."
);
*/
return L_DB_TRANSACTION {
L_D();
......@@ -2265,10 +2274,12 @@ list<shared_ptr<ChatMessage>> MainDb::findChatMessagesToBeNotifiedAsDelivered (
static const string query = Statements::get(Statements::SelectConferenceEvents) +
string(" AND direction = :direction AND delivery_notification_required <> 0");
/*
DurationLogger durationLogger(
"Find chat messages to be notified as delivered: (peer=" + conferenceId.getPeerAddress().asString() +
", local=" + conferenceId.getLocalAddress().asString() + ")."
);
*/
return L_DB_TRANSACTION {
L_D();
......@@ -2329,11 +2340,13 @@ list<shared_ptr<EventLog>> MainDb::getHistoryRange (
if (begin > 0)
query += " OFFSET " + Utils::toString(begin);
/*
DurationLogger durationLogger(
"Get history range of: (peer=" + conferenceId.getPeerAddress().asString() +
", local=" + conferenceId.getLocalAddress().asString() +
", begin=" + Utils::toString(begin) + ", end=" + Utils::toString(end) + ")."
);
*/
return L_DB_TRANSACTION {
L_D();
......@@ -2379,11 +2392,13 @@ void MainDb::cleanHistory (const ConferenceId &conferenceId, FilterMask mask) {
ConferenceCallFilter, ConferenceChatMessageFilter, ConferenceInfoFilter, ConferenceInfoNoDeviceFilter
}, mask);
/*
DurationLogger durationLogger(
"Clean history of: (peer=" + conferenceId.getPeerAddress().asString() +
", local=" + conferenceId.getLocalAddress().asString() +
", mask=" + Utils::toString(mask) + ")."
);
*/
L_DB_TRANSACTION {
L_D();
......
......@@ -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));
......