viewer-private#255 p2p outgoing calls did not work correctly #2

meow-7.2.2
Andrey Kleshchev 2024-07-26 19:28:40 +03:00 committed by Andrey Kleshchev
parent 7b119c01e0
commit f75735d741
7 changed files with 45 additions and 21 deletions

View File

@ -122,13 +122,7 @@ void LLVoiceChannel::onChange(EStatusType type, const LLSD& channelInfo, bool pr
{
LL_DEBUGS("Voice") << "Incoming channel info: " << channelInfo << LL_ENDL;
LL_DEBUGS("Voice") << "Current channel info: " << mChannelInfo << LL_ENDL;
if (mChannelInfo.has("channel_uri")
&& (!channelInfo.has("channel_uri") || mChannelInfo["channel_uri"] != channelInfo["channel_uri"]))
{
return;
}
if (mChannelInfo.isUndefined()
|| (mChannelInfo.isMap() && mChannelInfo.size() <= 1)) // p2p will have uri beforehand
if (mChannelInfo.isUndefined() || (mChannelInfo.isMap() && mChannelInfo.size() == 0))
{
mChannelInfo = channelInfo;
}
@ -774,11 +768,7 @@ LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID &session_id,
mReceivedCall(FALSE),
mOutgoingCallInterface(outgoing_call_interface)
{
std::string sip_uri = LLVoiceClient::getInstance()->sipURIFromID(other_user_id);
if (!sip_uri.empty())
{
mChannelInfo["channel_uri"] = sip_uri;
}
mChannelInfo = LLVoiceClient::getInstance()->getP2PChannelInfoTemplate(other_user_id);
}
void LLVoiceChannelP2P::handleStatusChange(EStatusType type)

View File

@ -826,7 +826,7 @@ void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
LLWebRTCVoiceClient::getInstance()->removeObserver(observer);
}
std::string LLVoiceClient::sipURIFromID(const LLUUID &id)
std::string LLVoiceClient::sipURIFromID(const LLUUID &id) const
{
if (mNonSpatialVoiceModule)
{
@ -842,6 +842,22 @@ std::string LLVoiceClient::sipURIFromID(const LLUUID &id)
}
}
LLSD LLVoiceClient::getP2PChannelInfoTemplate(const LLUUID& id) const
{
if (mNonSpatialVoiceModule)
{
return mNonSpatialVoiceModule->getP2PChannelInfoTemplate(id);
}
else if (mSpatialVoiceModule)
{
return mSpatialVoiceModule->getP2PChannelInfoTemplate(id);
}
else
{
return LLSD();
}
}
LLVoiceEffectInterface* LLVoiceClient::getVoiceEffectInterface() const
{
return NULL;

View File

@ -281,7 +281,8 @@ public:
virtual void removeObserver(LLVoiceClientParticipantObserver* observer)=0;
//@}
virtual std::string sipURIFromID(const LLUUID &id)=0;
virtual std::string sipURIFromID(const LLUUID &id) const=0;
virtual LLSD getP2PChannelInfoTemplate(const LLUUID& id) const=0;
//@}
};
@ -488,7 +489,8 @@ public:
void addObserver(LLVoiceClientParticipantObserver* observer);
void removeObserver(LLVoiceClientParticipantObserver* observer);
std::string sipURIFromID(const LLUUID &id);
std::string sipURIFromID(const LLUUID &id) const;
LLSD getP2PChannelInfoTemplate(const LLUUID& id) const;
//////////////////////////
/// @name Voice effects

View File

@ -5138,7 +5138,7 @@ bool LLVivoxVoiceClient::inProximalChannel()
return result;
}
std::string LLVivoxVoiceClient::sipURIFromID(const LLUUID &id)
std::string LLVivoxVoiceClient::sipURIFromID(const LLUUID &id) const
{
std::string result;
result = "sip:";
@ -5149,6 +5149,14 @@ std::string LLVivoxVoiceClient::sipURIFromID(const LLUUID &id)
return result;
}
LLSD LLVivoxVoiceClient::getP2PChannelInfoTemplate(const LLUUID& id) const
{
LLSD result;
result["channel_uri"] = sipURIFromID(id);
result["voice_server_type"] = VIVOX_VOICE_SERVER_TYPE;
return result;
}
std::string LLVivoxVoiceClient::sipURIFromAvatar(LLVOAvatar *avatar)
{
std::string result;
@ -5163,7 +5171,7 @@ std::string LLVivoxVoiceClient::sipURIFromAvatar(LLVOAvatar *avatar)
return result;
}
std::string LLVivoxVoiceClient::nameFromID(const LLUUID &uuid)
std::string LLVivoxVoiceClient::nameFromID(const LLUUID &uuid) const
{
std::string result;

View File

@ -221,7 +221,8 @@ public:
void removeObserver(LLVoiceClientParticipantObserver* observer) override;
//@}
std::string sipURIFromID(const LLUUID &id) override;
std::string sipURIFromID(const LLUUID &id) const override;
LLSD getP2PChannelInfoTemplate(const LLUUID& id) const override;
//@}
/// @name LLVoiceEffectInterface virtual implementations
@ -747,7 +748,7 @@ private:
bool switchChannel(std::string uri = std::string(), bool spatial = true, bool no_reconnect = false, bool is_p2p = false, std::string hash = "");
void joinSession(const sessionStatePtr_t &session);
std::string nameFromID(const LLUUID &id);
std::string nameFromID(const LLUUID &id) const;
bool IDFromName(const std::string name, LLUUID &uuid);
std::string sipURIFromAvatar(LLVOAvatar *avatar);
std::string sipURIFromName(std::string &name);

View File

@ -2066,11 +2066,16 @@ void LLWebRTCVoiceClient::avatarNameResolved(const LLUUID &id, const std::string
}
// Leftover from vivox PTSN
std::string LLWebRTCVoiceClient::sipURIFromID(const LLUUID& id)
std::string LLWebRTCVoiceClient::sipURIFromID(const LLUUID& id) const
{
return id.asString();
}
LLSD LLWebRTCVoiceClient::getP2PChannelInfoTemplate(const LLUUID& id) const
{
return LLSD();
}
/////////////////////////////
// LLVoiceWebRTCConnection

View File

@ -84,7 +84,9 @@ public:
// Returns true if WebRTC has successfully logged in and is not in error state
bool isVoiceWorking() const override;
std::string sipURIFromID(const LLUUID &id) override;
std::string sipURIFromID(const LLUUID &id) const override;
LLSD getP2PChannelInfoTemplate(const LLUUID& id) const override;
/////////////////////
/// @name Tuning