Commit 7771a1cb authored by Adrien Béraud's avatar Adrien Béraud Committed by Guillaume Roguez

manager: avoid using disabled account to place DHT calls

Refs #69037

Change-Id: I028a0e808f3a8c75cc8c6a9727717d9b9b15eb84
parent 084e2717
......@@ -2825,15 +2825,18 @@ std::shared_ptr<Call>
ManagerImpl::newOutgoingCall(const std::string& toUrl,
const std::string& preferredAccountId)
std::shared_ptr<Account> account = Manager::instance().getIP2IPAccount();
auto account = Manager::instance().getIP2IPAccount();
auto preferred = getAccount(preferredAccountId);
std::string finalToUrl = toUrl;
if (toUrl.find("ring:") != std::string::npos) {
RING_WARN("Ring DHT call detected");
if (preferred && preferred->getAccountType() == RingAccount::ACCOUNT_TYPE)
return preferred->newOutgoingCall(finalToUrl);
auto dhtAcc = getAllAccounts<RingAccount>();
if (not dhtAcc.empty())
return dhtAcc.front()->newOutgoingCall(finalToUrl);
for (const auto& acc : dhtAcc)
if (acc->isEnabled())
return acc->newOutgoingCall(finalToUrl);
......@@ -2841,7 +2844,7 @@ ManagerImpl::newOutgoingCall(const std::string& toUrl,
if (!IpAddr::isValid(finalToUrl)) {
account = getAccount(preferredAccountId);
account = preferred;
if (account)
finalToUrl = toUrl;
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