Tell the user the peer has declined and shut down voice channel

When the server sends up a notification that a peer is not doing
voice in adhoc-style p2p chat, shut down the voice call and
notify the user the peer has declined.
meow-7.2.2
Roxie Linden 2024-04-06 21:58:17 -07:00
parent b6f4cec7d5
commit 4ecf050439
2 changed files with 9 additions and 3 deletions

View File

@ -3595,17 +3595,21 @@ void LLIMMgr::processAgentListUpdates(const LLUUID& session_id, const LLSD& body
LLSD::map_const_iterator update_it;
for (update_it = body["agent_updates"].beginMap(); update_it != body["agent_updates"].endMap(); ++update_it)
{
LLUUID agent_id(update_it->first);
LLSD agent_data = update_it->second;
if (agent_data.isMap())
if (agent_data.isMap() && agent_data.has("info") && agent_data["info"].isMap())
{
// Is one of the participants leaving a P2P Chat?
if (agent_data.has("transition") && agent_data["transition"].asString() == "LEAVE")
if (agent_data["info"].has("can_voice_chat") && !agent_data["info"]["can_voice_chat"].asBoolean())
{
LLVoiceChannelGroup *channelp = dynamic_cast < LLVoiceChannelGroup*>(LLVoiceChannel::getChannelByID(session_id));
if (channelp && channelp->isP2P())
{
// it's an adhoc-style P2P channel, and voice is disabled / declined. notify the user
// and shut down the voice channel.
LLSD notifyArgs = LLSD::emptyMap();
notifyArgs["VOICE_CHANNEL_NAME"] = channelp->getSessionName();
LLNotificationsUtil::add("P2PCallDeclined", notifyArgs);
endCall(session_id);
break;
}

View File

@ -2368,12 +2368,14 @@ void LLVoiceWebRTCConnection::breakVoiceConnectionCoro()
if (!regionp || !regionp->capabilitiesReceived())
{
LL_DEBUGS("Voice") << "no capabilities for voice provisioning; waiting " << LL_ENDL;
setVoiceConnectionState(VOICE_STATE_SESSION_RETRY);
return;
}
std::string url = regionp->getCapability("ProvisionVoiceAccountRequest");
if (url.empty())
{
setVoiceConnectionState(VOICE_STATE_SESSION_RETRY);
return;
}