From 3ff1f0f9518c7b2faf1f9ea5e3f2eb42539ba2e5 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Thu, 4 Apr 2024 11:32:51 -0700 Subject: An explicit "decline" message for P2P When declining a P2P voice call for webrtc, instead of relying on vivox to stop "ringing," we need to send an explicit decline message from the peer through the server infrastructure. --- indra/newview/llimview.cpp | 41 ++++++++++++++++++++++++++++++++++++++--- indra/newview/llvoicevivox.cpp | 2 +- indra/newview/llvoicewebrtc.cpp | 2 +- 3 files changed, 40 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 215cc4103b..2f2a6041ad 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -103,6 +103,7 @@ enum EMultiAgentChatSessionType void startConferenceCoro(std::string url, LLUUID tempSessionId, LLUUID creatorId, LLUUID otherParticipantId, LLSD agents); void startP2PCoro(std::string url, LLUUID tempSessionId, LLUUID creatorId, LLUUID otherParticipantId); +void declineP2PCoro(std::string url, LLUUID sessionID); void chatterBoxInvitationCoro(std::string url, LLUUID sessionId, LLIMMgr::EInvitationType invitationType); void chatterBoxHistoryCoro(std::string url, LLUUID sessionId, std::string from, std::string message, U32 timestamp); @@ -488,6 +489,27 @@ void startP2PCoro(std::string url, LLUUID sessionID, LLUUID creatorId, LLUUID ot } } +void declineP2PCoro(std::string url, LLUUID sessionID) +{ + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("ConferenceChatStart", httpPolicy)); + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + + LLSD postData; + postData["method"] = "decline p2p"; + postData["session-id"] = sessionID; + + LLSD result = httpAdapter->postAndSuspend(httpRequest, url, postData); + + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); + + if (!status) + { + LL_WARNS("LLIMModel") << "Failed to decline p2p session:" << postData << "->" << result << LL_ENDL; + } +} + void chatterBoxInvitationCoro(std::string url, LLUUID sessionId, LLIMMgr::EInvitationType invitationType) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); @@ -3005,10 +3027,23 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload { if (type == IM_SESSION_P2P_INVITE) { - LLVoiceP2PIncomingCallInterfacePtr call = LLVoiceClient::getInstance()->getIncomingCallInterface(payload["voice_session_info"]); - if (call) + // create a normal IM session + LLVoiceP2PIncomingCallInterfacePtr call = LLVoiceClient::getInstance()->getIncomingCallInterface(payload["voice_channel_info"]); + if (call) + { + call->declineInvite(); + } + else { - call->declineInvite(); + // webrtc-style decline. + LLViewerRegion *region = gAgent.getRegion(); + if (region) + { + std::string url = region->getCapability("ChatSessionRequest"); + LLCoros::instance().launch("declineP2P", + boost::bind(&declineP2PCoro, url, session_id)); + } + } } else diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index f5c9e3aa98..be9e055203 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -5089,7 +5089,7 @@ bool LLVivoxVoiceClient::isCurrentChannel(const LLSD &channelInfo) } if (mAudioSession) { - if (!channelInfo["sessionHandle"].asString().empty()) + if (!channelInfo["session_handle"].asString().empty()) { return mAudioSession->mHandle == channelInfo["session_handle"].asString(); } diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 3cc4aa113c..dbfc28c44f 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -1360,7 +1360,7 @@ bool LLWebRTCVoiceClient::isCurrentChannel(const LLSD &channelInfo) if (mSession) { - if (!channelInfo["sessionHandle"].asString().empty()) + if (!channelInfo["session_handle"].asString().empty()) { return mSession->mHandle == channelInfo["session_handle"].asString(); } -- cgit v1.2.3