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.
meow-7.2.2
Roxie Linden 2024-04-04 11:32:51 -07:00
parent c826aea079
commit 3ff1f0f951
3 changed files with 40 additions and 5 deletions

View File

@ -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

View File

@ -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();
}

View File

@ -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();
}