Skip to content

Commit

Permalink
viewer-private#255 p2p outgoing calls did not work correctly #2
Browse files Browse the repository at this point in the history
  • Loading branch information
akleshchev committed Jul 30, 2024
1 parent 7b119c0 commit f75735d
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 21 deletions.
14 changes: 2 additions & 12 deletions indra/newview/llvoicechannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)
Expand Down
18 changes: 17 additions & 1 deletion indra/newview/llvoiceclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions indra/newview/llvoiceclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ class LLVoiceModuleInterface
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;
//@}

};
Expand Down Expand Up @@ -488,7 +489,8 @@ class LLVoiceClient: public LLParamSingleton<LLVoiceClient>
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
Expand Down
12 changes: 10 additions & 2 deletions indra/newview/llvoicevivox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:";
Expand All @@ -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;
Expand All @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions indra/newview/llvoicevivox.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ class LLVivoxVoiceClient : public LLSingleton<LLVivoxVoiceClient>,
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
Expand Down Expand Up @@ -747,7 +748,7 @@ class LLVivoxVoiceClient : public LLSingleton<LLVivoxVoiceClient>,
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);
Expand Down
7 changes: 6 additions & 1 deletion indra/newview/llvoicewebrtc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion indra/newview/llvoicewebrtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ class LLWebRTCVoiceClient : public LLSingleton<LLWebRTCVoiceClient>,
// 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
Expand Down

0 comments on commit f75735d

Please sign in to comment.