From b59ff9edc085f74add1b228fe849ad7e7c31f65f Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Fri, 19 Apr 2024 18:52:32 -0700 Subject: For p2p/adhoc/group calls, prefer voice server type based on what's running on the region --- indra/newview/app_settings/settings.xml | 4 ++-- indra/newview/llimview.cpp | 18 ++++++++++++++++-- indra/newview/llvoicechannel.cpp | 9 ++++++++- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0de6db0d65..3ac1844f8e 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -15155,13 +15155,13 @@ VoiceServerType Comment - The type of voice server to connect to. + The type of voice server to use for group, conference, and p2p calls. Persist 0 Type String Value - webrtc + WLSkyDetail diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 9c8fcd3283..b590c462fa 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -425,7 +425,14 @@ void startConferenceCoro(std::string url, postData["session-id"] = tempSessionId; postData["params"] = agents; LLSD altParams; - altParams["voice_server_type"] = gSavedSettings.getString("VoiceServerType"); + std::string voice_server_type = gSavedSettings.getString("VoiceServerType"); + if (voice_server_type.empty()) + { + // default to the server type associated with the region we're on. + LLVoiceVersionInfo versionInfo = LLVoiceClient::getInstance()->getVersion(); + voice_server_type = versionInfo.internalVoiceServerType; + } + altParams["voice_server_type"] = voice_server_type; postData["alt_params"] = altParams; LLSD result = httpAdapter->postAndSuspend(httpRequest, url, postData); @@ -467,7 +474,14 @@ void startP2PVoiceCoro(std::string url, LLUUID sessionID, LLUUID creatorId, LLUU postData["session-id"] = sessionID; postData["params"] = otherParticipantId; LLSD altParams; - altParams["voice_server_type"] = gSavedSettings.getString("VoiceServerType"); + std::string voice_server_type = gSavedSettings.getString("VoiceServerType"); + if (voice_server_type.empty()) + { + // default to the server type associated with the region we're on. + LLVoiceVersionInfo versionInfo = LLVoiceClient::getInstance()->getVersion(); + voice_server_type = versionInfo.internalVoiceServerType; + } + altParams["voice_server_type"] = voice_server_type; postData["alt_params"] = altParams; LLSD result = httpAdapter->postAndSuspend(httpRequest, url, postData); diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index f6658bbaab..92b00fe854 100644 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -594,7 +594,14 @@ void LLVoiceChannelGroup::voiceCallCapCoro(std::string url) postData["method"] = "call"; postData["session-id"] = mSessionID; LLSD altParams; - altParams["preferred_voice_server_type"] = gSavedSettings.getString("VoiceServerType"); + std::string preferred_voice_server_type = gSavedSettings.getString("VoiceServerType"); + if (preferred_voice_server_type.empty()) + { + // default to the server type associated with the region we're on. + LLVoiceVersionInfo versionInfo = LLVoiceClient::getInstance()->getVersion(); + preferred_voice_server_type = versionInfo.internalVoiceServerType; + } + altParams["preferred_voice_server_type"] = preferred_voice_server_type; postData["alt_params"] = altParams; LL_INFOS("Voice", "voiceCallCapCoro") << "Generic POST for " << url << LL_ENDL; -- cgit v1.2.3 From 784dae7e6a085577df91845466c910b2bcbf7d81 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Sat, 20 Apr 2024 00:19:55 -0700 Subject: re-enabling vivox voice didn't bring it back as it thought it was still in the region and parcel. --- indra/newview/llvoicevivox.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index be9e055203..6ff81760b2 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -5456,6 +5456,8 @@ void LLVivoxVoiceClient::setVoiceEnabled(bool enabled) LLVoiceChannel::getCurrentVoiceChannel()->deactivate(); gAgent.setVoiceConnected(false); status = LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED; + mCurrentParcelLocalID = -1; + mCurrentRegionName.clear(); } notifyStatusObservers(status); -- cgit v1.2.3 From 1a1af1ce2989d384c5dabf4dce9bc150a69b02c1 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Sat, 20 Apr 2024 00:26:39 -0700 Subject: Adjust logic for determine what voice server type to use. --- indra/newview/llimview.cpp | 24 +----------------------- indra/newview/llvoiceclient.cpp | 12 +++++++++--- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index b590c462fa..efa8bd2109 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -424,17 +424,6 @@ void startConferenceCoro(std::string url, postData["method"] = "start conference"; postData["session-id"] = tempSessionId; postData["params"] = agents; - LLSD altParams; - std::string voice_server_type = gSavedSettings.getString("VoiceServerType"); - if (voice_server_type.empty()) - { - // default to the server type associated with the region we're on. - LLVoiceVersionInfo versionInfo = LLVoiceClient::getInstance()->getVersion(); - voice_server_type = versionInfo.internalVoiceServerType; - } - altParams["voice_server_type"] = voice_server_type; - postData["alt_params"] = altParams; - LLSD result = httpAdapter->postAndSuspend(httpRequest, url, postData); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; @@ -473,17 +462,6 @@ void startP2PVoiceCoro(std::string url, LLUUID sessionID, LLUUID creatorId, LLUU postData["method"] = "start p2p voice"; postData["session-id"] = sessionID; postData["params"] = otherParticipantId; - LLSD altParams; - std::string voice_server_type = gSavedSettings.getString("VoiceServerType"); - if (voice_server_type.empty()) - { - // default to the server type associated with the region we're on. - LLVoiceVersionInfo versionInfo = LLVoiceClient::getInstance()->getVersion(); - voice_server_type = versionInfo.internalVoiceServerType; - } - altParams["voice_server_type"] = voice_server_type; - postData["alt_params"] = altParams; - LLSD result = httpAdapter->postAndSuspend(httpRequest, url, postData); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; @@ -2133,7 +2111,7 @@ bool LLIMModel::sendStartSession( //we also need to wait for reply from the server in case of ad-hoc chat (we'll get new session id) return true; } - else if ((dialog == IM_SESSION_P2P_INVITE) || (dialog == IM_NOTHING_SPECIAL)) + else if (p2p_as_adhoc_call && ((dialog == IM_SESSION_P2P_INVITE) || (dialog == IM_NOTHING_SPECIAL))) { LLViewerRegion *region = gAgent.getRegion(); if (region) diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 9dbf469ca8..6eadc3892e 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -538,12 +538,18 @@ LLVoiceP2PIncomingCallInterfacePtr LLVoiceClient::getIncomingCallInterface(const // outgoing calls LLVoiceP2POutgoingCallInterface *LLVoiceClient::getOutgoingCallInterface(const LLSD& voiceChannelInfo) { - std::string voiceServerType = gSavedSettings.getString("VoiceServerType"); + std::string voice_server_type = gSavedSettings.getString("VoiceServerType"); + if (voice_server_type.empty()) + { + // default to the server type associated with the region we're on. + LLVoiceVersionInfo versionInfo = LLVoiceClient::getInstance()->getVersion(); + voice_server_type = versionInfo.internalVoiceServerType; + } if (voiceChannelInfo.has("voice_server_type")) { - voiceServerType = voiceChannelInfo["voice_server_type"].asString(); + voice_server_type = voiceChannelInfo["voice_server_type"].asString(); } - LLVoiceModuleInterface *module = getVoiceModule(voiceServerType); + LLVoiceModuleInterface *module = getVoiceModule(voice_server_type); return dynamic_cast(module); } -- cgit v1.2.3 From 07d7779d87552133e98df835bfdcb0a1fb5b10ca Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Sat, 20 Apr 2024 17:34:27 -0700 Subject: Vivox wasn't ren-enabling voice after ending a p2p call --- indra/newview/llvoicevivox.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 6ff81760b2..88fc40e565 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -4952,6 +4952,7 @@ bool LLVivoxVoiceClient::setSpatialChannel(const LLSD& channelInfo) void LLVivoxVoiceClient::callUser(const LLUUID &uuid) { std::string userURI = sipURIFromID(uuid); + mProcessChannels = true; switchChannel(userURI, false, true, true); } @@ -4974,7 +4975,7 @@ bool LLVivoxVoiceClient::answerInvite(const std::string &sessionHandle) session->mIsSpatial = false; session->mReconnect = false; session->mIsP2P = true; - + mProcessChannels = true; joinSession(session); return true; } @@ -5078,7 +5079,9 @@ void LLVivoxVoiceClient::leaveNonSpatialChannel() void LLVivoxVoiceClient::processChannels(bool process) { - mProcessChannels = process; + mCurrentParcelLocalID = -1; + mCurrentRegionName.clear(); + mProcessChannels = process; } bool LLVivoxVoiceClient::isCurrentChannel(const LLSD &channelInfo) -- cgit v1.2.3 From 98322d5f070b260f1e46eb5d9fcd54fa43151329 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Sun, 21 Apr 2024 21:12:06 -0700 Subject: Reconnect when parcel voice params change. When parcel voice permissions and region/parcel-only voice settings change, a callback will be made to the viewer with new voice credential information. For webrtc, this means either just the uuid of the voice channel, or nothing if voice is disabled. This change looks at that callback and the channel id, and sets the appropriate flags on the parcel/region as needed which will cause voice to be renegotiated. Also, there was a race condition if the voice connect attempt was made before caps were retrieved, which would have resulted in full renegotiate attempts. Now, just wait until the cap comes in and continue. --- indra/llwebrtc/llwebrtc.cpp | 4 ++++ indra/newview/llvoicewebrtc.cpp | 40 ++++++++++++++++++++++++++++++++++++---- indra/newview/llvoicewebrtc.h | 7 +------ 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp index eb9bb65e67..e08ace12c5 100644 --- a/indra/llwebrtc/llwebrtc.cpp +++ b/indra/llwebrtc/llwebrtc.cpp @@ -735,6 +735,10 @@ bool LLWebRTCPeerConnectionImpl::initializeConnection(const LLWebRTCPeerConnecti else { RTC_LOG(LS_ERROR) << __FUNCTION__ << "Error creating peer connection: " << error_or_peer_connection.error().message(); + for (auto &observer : mSignalingObserverList) + { + observer->OnRenegotiationNeeded(); + } return; } diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 7743d6362a..c6e9d3d1ec 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -1269,6 +1269,35 @@ BOOL LLWebRTCVoiceClient::isSessionCallBackPossible(const LLUUID &session_id) } // Channel Management + +bool LLWebRTCVoiceClient::setSpatialChannel(const LLSD &channelInfo) +{ + LL_INFOS("Voice") << "SetSpatialChannel " << channelInfo << LL_ENDL; + LLViewerRegion *regionp = gAgent.getRegion(); + if (!regionp) + { + return false; + } + LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + + // we don't really have credentials for a spatial channel in webrtc, + // it's all handled by the sim. + if (channelInfo.isMap() && channelInfo.has("channel_uri")) + { + bool allow_voice = !channelInfo["channel_uri"].asString().empty(); + if (parcel) + { + parcel->setParcelFlag(PF_ALLOW_VOICE_CHAT, allow_voice); + parcel->setParcelFlag(PF_USE_ESTATE_VOICE_CHAN, channelInfo["channel_uri"].asUUID() == regionp->getRegionID()); + } + else + { + regionp->setRegionFlag(REGION_FLAGS_ALLOW_VOICE, allow_voice); + } + } + return true; +} + void LLWebRTCVoiceClient::leaveNonSpatialChannel() { LL_DEBUGS("Voice") << "Request to leave non-spatial channel." << LL_ENDL; @@ -2116,7 +2145,7 @@ void LLVoiceWebRTCConnection::OnIceCandidate(const llwebrtc::LLWebRTCIceCandidat void LLVoiceWebRTCConnection::processIceUpdates() { mOutstandingRequests++; - LLCoros::getInstance()->launch("LLVoiceWebRTCConnection::requestVoiceConnectionCoro", + LLCoros::getInstance()->launch("LLVoiceWebRTCConnection::processIceUpdatesCoro", boost::bind(&LLVoiceWebRTCConnection::processIceUpdatesCoro, this)); } @@ -2436,7 +2465,9 @@ void LLVoiceWebRTCSpatialConnection::requestVoiceConnection() if (!regionp || !regionp->capabilitiesReceived()) { LL_DEBUGS("Voice") << "no capabilities for voice provisioning; waiting " << LL_ENDL; - setVoiceConnectionState(VOICE_STATE_SESSION_RETRY); + + // try again. + setVoiceConnectionState(VOICE_STATE_REQUEST_CONNECTION); return; } @@ -2988,8 +3019,9 @@ void LLVoiceWebRTCAdHocConnection::requestVoiceConnection() LL_DEBUGS("Voice") << "Requesting voice connection." << LL_ENDL; if (!regionp || !regionp->capabilitiesReceived()) { - LL_DEBUGS("Voice") << "no capabilities for voice provisioning; waiting " << LL_ENDL; - setVoiceConnectionState(VOICE_STATE_SESSION_RETRY); + LL_DEBUGS("Voice") << "no capabilities for voice provisioning; retrying " << LL_ENDL; + // try again. + setVoiceConnectionState(VOICE_STATE_REQUEST_CONNECTION); return; } diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h index aa3298ec1b..67e4a4ea6f 100644 --- a/indra/newview/llvoicewebrtc.h +++ b/indra/newview/llvoicewebrtc.h @@ -144,12 +144,7 @@ public: startAdHocSession(channelInfo, notify_on_first_join, hangup_on_last_leave); } - bool setSpatialChannel(const LLSD &channelInfo) override - { - // we don't really have credentials for a spatial channel in webrtc, - // it's all handled by the sim. - return true; - } + bool setSpatialChannel(const LLSD &channelInfo) override; void leaveNonSpatialChannel() override; -- cgit v1.2.3