Commit a30050c8 authored by Ghislain MARY's avatar Ghislain MARY

Correct handling of client group chat room joining after it has been left.

parent d7f31689
......@@ -797,7 +797,9 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
return;
}
} else {
LinphoneChatRoom *cr = _linphone_client_group_chat_room_new(lc, addr.asString().c_str(), nullptr);
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(lc->cppCore->findChatRoom(addr));
if (!cr)
cr = _linphone_client_group_chat_room_new(lc, addr.asString().c_str(), nullptr);
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->join();
/* The following causes a crash because chat room hasn't yet a peer address.
The above call to join() will create a CallSession which will call onConferenceCreated when it'll reach the Connected state.
......
......@@ -163,7 +163,7 @@ void ClientGroupChatRoom::join () {
L_D_T(RemoteConference, dConference);
shared_ptr<CallSession> session = dConference->focus->getPrivate()->getSession();
if (!session && d->state == ChatRoom::State::Instantiated) {
if (!session && ((d->state == ChatRoom::State::Instantiated) || (d->state == ChatRoom::State::Terminated))) {
session = d->createSession();
session->startInvite(nullptr, "", nullptr);
d->setState(ChatRoom::State::CreationPending);
......@@ -266,6 +266,8 @@ void ClientGroupChatRoom::onConferenceCreated (const Address &addr) {
void ClientGroupChatRoom::onConferenceTerminated (const Address &addr) {
L_D();
L_D_T(RemoteConference, dConference);
dConference->eventHandler->resetLastNotify();
d->setState(ChatRoom::State::Terminated);
}
......@@ -446,9 +448,9 @@ void ClientGroupChatRoom::onCallSessionStateChanged (
dConference->eventHandler->subscribe(getConferenceAddress());
} else if (d->state == ChatRoom::State::TerminationPending)
dConference->focus->getPrivate()->getSession()->terminate();
} else if (state == LinphoneCallReleased && d->state == ChatRoom::State::TerminationPending) {
} else if ((state == LinphoneCallReleased) && (d->state == ChatRoom::State::TerminationPending)) {
onConferenceTerminated(getConferenceAddress());
} else if (state == LinphoneCallError && d->state == ChatRoom::State::CreationPending) {
} else if ((state == LinphoneCallError) && (d->state == ChatRoom::State::CreationPending)) {
d->setState(ChatRoom::State::CreationFailed);
}
}
......
......@@ -207,4 +207,9 @@ unsigned int RemoteConferenceEventHandler::getLastNotify () const {
return d->lastNotify;
};
void RemoteConferenceEventHandler::resetLastNotify () {
L_D();
d->lastNotify = 0;
}
LINPHONE_END_NAMESPACE
......@@ -40,6 +40,7 @@ class RemoteConferenceEventHandler : public Object {
const Address &getConfAddress () const;
unsigned int getLastNotify () const;
void resetLastNotify ();
private:
L_DECLARE_PRIVATE(RemoteConferenceEventHandler);
......
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