diff --git a/src/call.cpp b/src/call.cpp index 18d5239d1ad179d208fa6983a945c7ffe530ee5e..5b568d5b9a581d622c7eae640538090c5a210c5a 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -691,7 +691,32 @@ Call::sendConfOrder(const Json::Value& root) wbuilder["commentStyle"] = "None"; wbuilder["indentation"] = ""; messages["application/confOrder+json"] = Json::writeString(wbuilder, root); - sendTextMessage(messages, getPeerDisplayName()); + + auto w = getAccount(); + auto account = w.lock(); + if (account) + sendTextMessage(messages, account->getFromUri()); +} + +void +Call::sendConfInfo(const std::string& json) +{ + std::map<std::string, std::string> messages; + Json::StreamWriterBuilder wbuilder; + wbuilder["commentStyle"] = "None"; + wbuilder["indentation"] = ""; + messages["application/confInfo+json"] = json; + + auto w = getAccount(); + auto account = w.lock(); + if (account) + sendTextMessage(messages, account->getFromUri()); +} + +void +Call::resetConfInfo() +{ + sendConfInfo("{}"); } } // namespace jami diff --git a/src/call.h b/src/call.h index 9ddf1c6ac9624dc775998ac743b41465f8b2cbc7..b4e5440d6d850518cff008ed72cbf1686755e16d 100644 --- a/src/call.h +++ b/src/call.h @@ -347,6 +347,8 @@ public: // media management std::unique_ptr<AudioDeviceGuard> audioGuard; void sendConfOrder(const Json::Value& root); + void sendConfInfo(const std::string& json); + void resetConfInfo(); protected: virtual void merge(Call& scall); diff --git a/src/conference.cpp b/src/conference.cpp index 4c527b684d42d195ddf3c81fc1df04052a9d4196..ffd65c338a791d5c5a85383491260251187ef282 100644 --- a/src/conference.cpp +++ b/src/conference.cpp @@ -143,14 +143,7 @@ Conference::~Conference() if (auto call = getCall(participant_id)) { call->exitConference(); // Reset distant callInfo - auto w = call->getAccount(); - auto account = w.lock(); - if (!account) - continue; - call->sendTextMessage(std::map<std::string, std::string> {{"application/confInfo+json", - "[]"}}, - account->getFromUri()); - + call->resetConfInfo(); // Trigger the SIP negotiation to update the resolution for the remaining call // ideally this sould be done without renegotiation call->switchInput( @@ -398,9 +391,8 @@ Conference::sendConferenceInfos() dht::ThreadPool::io().run([call, confInfo = getConfInfoHostUri(account->getUsername() + "@ring.dht", - call->getPeerNumber()), - from = account->getFromUri()] { - call->sendTextMessage({{"application/confInfo+json", confInfo.toString()}}, from); + call->getPeerNumber())] { + call->sendConfInfo(confInfo.toString()); }); } } diff --git a/src/manager.cpp b/src/manager.cpp index 1a28aec0ae0704dcf208c0e088f7bd5d961abc5c..da43df0206b027b8d5c6cb8decad20bf554b452e 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -1098,8 +1098,13 @@ Manager::hangupConference(const std::string& id) JAMI_DBG("Hangup conference %s", id.c_str()); if (auto conf = getConferenceFromID(id)) { ParticipantSet participants(conf->getParticipantList()); - for (const auto& item : participants) - hangupCall(item); + for (const auto& callId : participants) { + if (auto call = getCallFromCallID(callId)) { + call->resetConfInfo(); + call->exitConference(); + } + hangupCall(callId); + } pimpl_->unsetCurrentCall(); return true; }