summaryrefslogtreecommitdiff
path: root/indra/newview/llimview.cpp
diff options
context:
space:
mode:
authorRoxie Linden <roxie@lindenlab.com>2024-03-03 15:50:35 -0800
committerRoxie Linden <roxie@lindenlab.com>2024-03-03 15:50:35 -0800
commit2117f8c4ba4565eef33f139a8c38b81f3c79648f (patch)
treea636c6b9e8e14afae4bac638f755e3aa28530ed9 /indra/newview/llimview.cpp
parentf9d0a54fdf85510e563858412c6c6ced9b06e096 (diff)
Refactor for vivox spatial and p2p
General refactoring to improve vivox spacial and p2p voice including generalizing voice info instead of just using sip uri and credentials. Voice server type is also passed around in the generalized voice info blob.
Diffstat (limited to 'indra/newview/llimview.cpp')
-rw-r--r--indra/newview/llimview.cpp258
1 files changed, 74 insertions, 184 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 1c8cdfd641..a675c44274 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -111,7 +111,7 @@ BOOL LLSessionTimeoutTimer::tick()
{
gIMMgr->showSessionStartError("session_initialization_timed_out_error", mSessionId);
}
- return TRUE;
+ return TRUE;
}
@@ -140,7 +140,7 @@ void process_dnd_im(const LLSD& notification)
name,
IM_NOTHING_SPECIAL,
fromID,
- false,
+ LLSD(),
false); //will need slight refactor to retrieve whether offline message or not (assume online for now)
}
@@ -411,6 +411,9 @@ void startConferenceCoro(std::string url,
postData["method"] = "start conference";
postData["session-id"] = tempSessionId;
postData["params"] = agents;
+ LLSD altParams;
+ altParams["voice_server_type"] = gSavedSettings.getString("VoiceServerType");
+ postData["alt_params"] = altParams;
LLSD result = httpAdapter->postAndSuspend(httpRequest, url, postData);
@@ -450,6 +453,9 @@ void startP2PCoro(std::string url, LLUUID sessionID, LLUUID creatorId, LLUUID ot
postData["method"] = "start p2p";
postData["session-id"] = sessionID;
postData["params"] = otherParticipantId;
+ LLSD altParams;
+ altParams["voice_server_type"] = gSavedSettings.getString("VoiceServerType");
+ postData["alt_params"] = altParams;
LLSD result = httpAdapter->postAndSuspend(httpRequest, url, postData);
@@ -458,7 +464,7 @@ void startP2PCoro(std::string url, LLUUID sessionID, LLUUID creatorId, LLUUID ot
if (!status)
{
- LL_WARNS("LLIMModel") << "Failed to start conference" << LL_ENDL;
+ LL_WARNS("LLIMModel") << "Failed to start conference:" << postData << "->" << result << LL_ENDL;
// try an "old school" way.
// *TODO: What about other error status codes? 4xx 5xx?
if (status == LLCore::HttpStatus(HTTP_BAD_REQUEST))
@@ -675,7 +681,13 @@ LLIMModel::LLIMModel()
LLCallDialogManager::instance();
}
-LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice, bool has_offline_msg)
+LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id,
+ const std::string& name,
+ const EInstantMessage& type,
+ const LLUUID& other_participant_id,
+ const uuid_vec_t& ids,
+ const LLSD& voiceChannelInfo,
+ bool has_offline_msg)
: mSessionID(session_id),
mName(name),
mType(type),
@@ -690,24 +702,30 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
mCallBackEnabled(true),
mTextIMPossible(true),
mStartCallOnInitialize(false),
- mStartedAsIMCall(voice),
+ mStartedAsIMCall(!voiceChannelInfo.isUndefined()),
mIsDNDsend(false),
mAvatarNameCacheConnection()
{
// set P2P type by default
- mSessionType = P2P_SESSION;
+ mSessionType = P2P_SESSION;
+ bool p2pAsAdhocCall = false;
if (IM_NOTHING_SPECIAL == mType || IM_SESSION_P2P_INVITE == mType)
{
- if (LLVoiceClient::getInstance()->hasP2PInterface())
+ LLVoiceP2POutgoingCallInterface *outgoingInterface =
+ LLVoiceClient::getInstance()->getOutgoingCallInterface(voiceChannelInfo);
+
+ if (outgoingInterface)
{
// only use LLVoiceChannelP2P if the provider can handle the special P2P interface,
// which uses the voice server to relay calls and invites. Otherwise,
// we use the group voice provider.
- mVoiceChannel = new LLVoiceChannelP2P(session_id, name, other_participant_id);
+ mVoiceChannel = new LLVoiceChannelP2P(session_id, name, other_participant_id, outgoingInterface);
+ mVoiceChannel->setChannelInfo(voiceChannelInfo);
}
else
{
+ p2pAsAdhocCall = true;
mVoiceChannel = new LLVoiceChannelGroup(session_id, name, true);
}
}
@@ -741,8 +759,7 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
//we need to wait for session initialization for outgoing ad-hoc and group chat session
//correct session id for initiated ad-hoc chat will be received from the server
- if (!LLIMModel::getInstance()->sendStartSession(mSessionID, mOtherParticipantID,
- mInitialTargetIDs, mType))
+ if (!LLIMModel::getInstance()->sendStartSession(mSessionID, mOtherParticipantID, mInitialTargetIDs, mType, p2pAsAdhocCall))
{
//we don't need to wait for any responses
//so we're already initialized
@@ -891,22 +908,6 @@ LLIMModel::LLIMSession::~LLIMSession()
delete mSpeakers;
mSpeakers = NULL;
- // End the text IM session if necessary
- if(LLVoiceClient::getInstance() && mOtherParticipantID.notNull())
- {
- switch(mType)
- {
- case IM_NOTHING_SPECIAL:
- case IM_SESSION_P2P_INVITE:
- LLVoiceClient::getInstance()->endUserIMSession(mOtherParticipantID);
- break;
-
- default:
- // Appease the linux compiler
- break;
- }
- }
-
mVoiceChannelStateChangeConnection.disconnect();
// HAVE to do this here -- if it happens in the LLVoiceChannel destructor it will call the wrong version (since the object's partially deconstructed at that point).
@@ -1481,7 +1482,7 @@ void LLIMModel::testMessages()
//session name should not be empty
bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type,
- const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice, bool has_offline_msg)
+ const LLUUID& other_participant_id, const uuid_vec_t& ids, const LLSD& voiceChannelInfo, bool has_offline_msg)
{
if (name.empty())
{
@@ -1495,7 +1496,7 @@ bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, co
return false;
}
- LLIMSession* session = new LLIMSession(session_id, name, type, other_participant_id, ids, voice, has_offline_msg);
+ LLIMSession* session = new LLIMSession(session_id, name, type, other_participant_id, ids, voiceChannelInfo, has_offline_msg);
mId2SessionMap[session_id] = session;
// When notifying observer, name of session is used instead of "name", because they may not be the
@@ -1507,11 +1508,11 @@ bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, co
}
-bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, bool voice, bool has_offline_msg)
+bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const LLSD& voiceChannelInfo, bool has_offline_msg)
{
uuid_vec_t ids;
ids.push_back(other_participant_id);
- return newSession(session_id, name, type, other_participant_id, ids, voice, has_offline_msg);
+ return newSession(session_id, name, type, other_participant_id, ids, voiceChannelInfo, has_offline_msg);
}
bool LLIMModel::clearSession(const LLUUID& session_id)
@@ -2060,7 +2061,8 @@ bool LLIMModel::sendStartSession(
const LLUUID& temp_session_id,
const LLUUID& other_participant_id,
const uuid_vec_t& ids,
- EInstantMessage dialog)
+ EInstantMessage dialog,
+ bool p2p_as_adhoc_call)
{
if ( dialog == IM_SESSION_GROUP_START )
{
@@ -2076,7 +2078,7 @@ bool LLIMModel::sendStartSession(
return true;
}
- else if (dialog == IM_SESSION_CONFERENCE_START )
+ else if ((dialog == IM_SESSION_CONFERENCE_START ) || p2p_as_adhoc_call)
{
LLSD agents;
for (int i = 0; i < (S32) ids.size(); i++)
@@ -2107,27 +2109,16 @@ 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)) && !LLVoiceClient::getInstance()->hasP2PInterface())
+ else if ((dialog == IM_SESSION_P2P_INVITE) || (dialog == IM_NOTHING_SPECIAL))
{
- LLSD agents;
- for (int i = 0; i < (S32) ids.size(); i++)
- {
- agents.append(ids[i]);
- }
-
- // we have a new way of starting conference calls now
LLViewerRegion *region = gAgent.getRegion();
if (region)
{
std::string url = region->getCapability("ChatSessionRequest");
-
- LLCoros::instance().launch(
- "startP2P",
- boost::bind(&startP2PCoro, url, temp_session_id, gAgent.getID(), other_participant_id));
+ LLCoros::instance().launch("startP2P", boost::bind(&startP2PCoro, url, temp_session_id, gAgent.getID(), other_participant_id));
}
return true;
}
-
return false;
}
@@ -2720,21 +2711,21 @@ mAvatarNameCacheConnection()
void LLIncomingCallDialog::onLifetimeExpired()
{
- std::string session_handle = mPayload["session_handle"].asString();
- if (LLVoiceClient::getInstance()->isValidChannel(session_handle))
- {
- // restart notification's timer if call is still valid
- mLifetimeTimer.start();
- }
- else
- {
- // close invitation if call is already not valid
- mLifetimeTimer.stop();
- LLUUID session_id = mPayload["session_id"].asUUID();
- gIMMgr->clearPendingAgentListUpdates(session_id);
- gIMMgr->clearPendingInvitation(session_id);
- closeFloater();
- }
+ LLVoiceP2PIncomingCallInterfacePtr call = LLVoiceClient::getInstance()->getIncomingCallInterface(mPayload["voice_session_info"]);
+ if (call)
+ {
+ // restart notification's timer if call is still valid
+ mLifetimeTimer.start();
+ }
+ else
+ {
+ // close invitation if call is already not valid
+ mLifetimeTimer.stop();
+ LLUUID session_id = mPayload["session_id"].asUUID();
+ gIMMgr->clearPendingAgentListUpdates(session_id);
+ gIMMgr->clearPendingInvitation(session_id);
+ closeFloater();
+ }
}
BOOL LLIncomingCallDialog::postBuild()
@@ -2914,10 +2905,7 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload
{
// create a normal IM session
session_id = gIMMgr->addP2PSession(
- session_name,
- caller_id,
- payload["session_handle"].asString(),
- payload["session_uri"].asString());
+ session_name, caller_id, payload["voice_channel_info"]);
if (voice)
{
@@ -2997,11 +2985,11 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload
{
if (type == IM_SESSION_P2P_INVITE)
{
- if(LLVoiceClient::getInstance())
- {
- std::string s = payload["session_handle"].asString();
- LLVoiceClient::getInstance()->declineInvite(s);
- }
+ LLVoiceP2PIncomingCallInterfacePtr call = LLVoiceClient::getInstance()->getIncomingCallInterface(payload["voice_session_info"]);
+ if (call)
+ {
+ call->declineInvite();
+ }
}
else
{
@@ -3023,90 +3011,6 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload
}
}
-bool inviteUserResponse(const LLSD& notification, const LLSD& response)
-{
- if (!gIMMgr)
- return false;
-
- const LLSD& payload = notification["payload"];
- LLUUID session_id = payload["session_id"].asUUID();
- EInstantMessage type = (EInstantMessage)payload["type"].asInteger();
- LLIMMgr::EInvitationType inv_type = (LLIMMgr::EInvitationType)payload["inv_type"].asInteger();
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- switch(option)
- {
- case 0: // accept
- {
- if (type == IM_SESSION_P2P_INVITE)
- {
- // create a normal IM session
- session_id = gIMMgr->addP2PSession(
- payload["session_name"].asString(),
- payload["caller_id"].asUUID(),
- payload["session_handle"].asString(),
- payload["session_uri"].asString());
-
- gIMMgr->startCall(session_id);
-
- gIMMgr->clearPendingAgentListUpdates(session_id);
- gIMMgr->clearPendingInvitation(session_id);
- }
- else
- {
- gIMMgr->addSession(
- payload["session_name"].asString(),
- type,
- session_id, true);
-
- std::string url = gAgent.getRegion()->getCapability(
- "ChatSessionRequest");
-
- LLCoros::instance().launch("chatterBoxInvitationCoro",
- boost::bind(&chatterBoxInvitationCoro, url,
- session_id, inv_type));
- }
- }
- break;
- case 2: // mute (also implies ignore, so this falls through to the "ignore" case below)
- {
- // mute the sender of this invite
- if (!LLMuteList::getInstance()->isMuted(payload["caller_id"].asUUID()))
- {
- LLMute mute(payload["caller_id"].asUUID(), payload["caller_name"].asString(), LLMute::AGENT);
- LLMuteList::getInstance()->add(mute);
- }
- }
- /* FALLTHROUGH */
-
- case 1: // decline
- {
- if (type == IM_SESSION_P2P_INVITE)
- {
- std::string s = payload["session_handle"].asString();
- LLVoiceClient::getInstance()->declineInvite(s);
- }
- else
- {
- std::string url = gAgent.getRegion()->getCapability(
- "ChatSessionRequest");
-
- LLSD data;
- data["method"] = "decline invitation";
- data["session-id"] = session_id;
- LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, data,
- "Invitation declined.",
- "Invitation decline failed.");
- }
- }
-
- gIMMgr->clearPendingAgentListUpdates(session_id);
- gIMMgr->clearPendingInvitation(session_id);
- break;
- }
-
- return false;
-}
-
//
// Member Functions
//
@@ -3178,7 +3082,7 @@ void LLIMMgr::addMessage(
{
fixed_session_name = av_name.getDisplayName();
}
- LLIMModel::getInstance()->newSession(new_session_id, fixed_session_name, dialog, other_participant_id, false, is_offline_msg);
+ LLIMModel::getInstance()->newSession(new_session_id, fixed_session_name, dialog, other_participant_id, LLSD(), is_offline_msg);
LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(new_session_id);
if (session)
@@ -3338,22 +3242,11 @@ void LLIMMgr::autoStartCallOnStartup(const LLUUID& session_id)
}
LLUUID LLIMMgr::addP2PSession(const std::string& name,
- const LLUUID& other_participant_id,
- const std::string& voice_session_handle,
- const std::string& caller_uri)
+ const LLUUID& other_participant_id,
+ const LLSD& voice_channel_info)
{
- LLUUID session_id = addSession(name, IM_NOTHING_SPECIAL, other_participant_id, true);
-
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id);
- if (speaker_mgr)
- {
- LLVoiceChannelP2P* voice_channel = dynamic_cast<LLVoiceChannelP2P*>(speaker_mgr->getVoiceChannel());
- if (voice_channel)
- {
- voice_channel->setSessionHandle(voice_session_handle, caller_uri);
- }
- }
- return session_id;
+ LL_WARNS("Voice") << "ADD P2P VOICE CHANNEL INFO: " << voice_channel_info << LL_ENDL;
+ return addSession(name, IM_NOTHING_SPECIAL, other_participant_id, voice_channel_info);
}
// This adds a session to the talk view. The name is the local name of
@@ -3363,11 +3256,12 @@ LLUUID LLIMMgr::addP2PSession(const std::string& name,
LLUUID LLIMMgr::addSession(
const std::string& name,
EInstantMessage dialog,
- const LLUUID& other_participant_id, bool voice)
+ const LLUUID& other_participant_id,
+ const LLSD& voiceChannelInfo)
{
std::vector<LLUUID> ids;
ids.push_back(other_participant_id);
- LLUUID session_id = addSession(name, dialog, other_participant_id, ids, voice);
+ LLUUID session_id = addSession(name, dialog, other_participant_id, ids, voiceChannelInfo);
return session_id;
}
@@ -3377,7 +3271,8 @@ LLUUID LLIMMgr::addSession(
const std::string& name,
EInstantMessage dialog,
const LLUUID& other_participant_id,
- const std::vector<LLUUID>& ids, bool voice,
+ const std::vector<LLUUID>& ids,
+ const LLSD& voiceChannelInfo,
const LLUUID& floater_id)
{
if (ids.empty())
@@ -3423,7 +3318,7 @@ LLUUID LLIMMgr::addSession(
//Notify observers that a session was added
if (new_session)
{
- LLIMModel::getInstance()->newSession(session_id, name, dialog, other_participant_id, ids, voice);
+ LLIMModel::getInstance()->newSession(session_id, name, dialog, other_participant_id, ids, voiceChannelInfo);
}
//Notifies observers that the session was already added
else
@@ -3484,9 +3379,7 @@ void LLIMMgr::inviteToSession(
const std::string& caller_name,
EInstantMessage type,
EInvitationType inv_type,
- const std::string& session_handle,
- const std::string& session_uri,
- const std::string& voice_server_type)
+ const LLSD& voice_channel_info)
{
std::string notify_box_type;
// voice invite question is different from default only for group call (EXT-7118)
@@ -3528,11 +3421,12 @@ void LLIMMgr::inviteToSession(
payload["caller_name"] = caller_name;
payload["type"] = type;
payload["inv_type"] = inv_type;
- payload["session_handle"] = session_handle;
- payload["session_uri"] = session_uri;
+ payload["voice_channel_info"] = voice_channel_info;
payload["notify_box_type"] = notify_box_type;
payload["question_type"] = question_type;
+ LL_WARNS("Voice") << "INVITE PAYLOAD: " << payload << LL_ENDL;
+
//ignore invites from muted residents
if (!is_linden)
{
@@ -3581,7 +3475,7 @@ void LLIMMgr::inviteToSession(
fixed_session_name = av_name.getDisplayName();
}
}
- LLIMModel::getInstance()->newSession(session_id, fixed_session_name, IM_NOTHING_SPECIAL, caller_id, false, false);
+ LLIMModel::getInstance()->newSession(session_id, fixed_session_name, IM_NOTHING_SPECIAL, caller_id, LLSD(), false);
}
LLSD args;
@@ -3810,7 +3704,6 @@ bool LLIMMgr::startCall(const LLUUID& session_id, LLVoiceChannel::EDirection dir
{
LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(session_id);
if (!voice_channel) return false;
-
voice_channel->setCallDirection(direction);
voice_channel->activate();
return true;
@@ -4207,7 +4100,6 @@ public:
return;
}
- std::string voice_server_type = input["body"]["voice"].get("voice_server_type").asString();
BOOL session_type_p2p = input["body"]["voice"].get("p2p").asBoolean();
gIMMgr->inviteToSession(
@@ -4217,9 +4109,7 @@ public:
input["body"]["from_name"].asString(),
session_type_p2p ? IM_SESSION_P2P_INVITE : IM_SESSION_INVITE,
LLIMMgr::INVITATION_TYPE_VOICE,
- LLStringUtil::null, // session_handle
- LLStringUtil::null,
- voice_server_type);
+ input["body"]["voice"]);
}
else if ( input["body"].has("immediate") )
{