For webrtc, 'calling' dialog should remain up, disappearing when peer connects (p2p)

meow-7.2.2
Roxie Linden 2024-03-05 11:05:31 -08:00
parent f4c1e2e795
commit 6d5304bd92
9 changed files with 61 additions and 24 deletions

View File

@ -474,7 +474,7 @@ void startP2PCoro(std::string url, LLUUID sessionID, LLUUID creatorId, LLUUID ot
if (!status)
{
LL_WARNS("LLIMModel") << "Failed to start conference:" << postData << "->" << result << LL_ENDL;
LL_WARNS("LLIMModel") << "Failed to start p2p session:" << 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))
@ -736,7 +736,7 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id,
else
{
p2pAsAdhocCall = true;
mVoiceChannel = new LLVoiceChannelGroup(session_id, name, true);
mVoiceChannel = new LLVoiceChannelGroup(session_id, name, true, true);
}
}
else
@ -745,12 +745,12 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id,
if (gAgent.isInGroup(mSessionID))
{
mSessionType = GROUP_SESSION;
mVoiceChannel = new LLVoiceChannelGroup(session_id, name, false);
mVoiceChannel = new LLVoiceChannelGroup(session_id, name, false, false);
}
else
{
mSessionType = ADHOC_SESSION;
mVoiceChannel = new LLVoiceChannelGroup(session_id, name, true);
mVoiceChannel = new LLVoiceChannelGroup(session_id, name, false, true);
}
}
@ -2750,7 +2750,7 @@ BOOL LLIncomingCallDialog::postBuild()
LLUUID session_id = mPayload["session_id"].asUUID();
LLSD caller_id = mPayload["caller_id"];
std::string caller_name = mPayload["caller_name"].asString();
std::string caller_name = mPayload["caller_name"].asString();
if (session_id.isNull() && caller_id.asUUID().isNull())
{
@ -2899,6 +2899,10 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload
LLUUID session_id = payload["session_id"].asUUID();
LLUUID caller_id = payload["caller_id"].asUUID();
std::string session_name = payload["session_name"].asString();
if (session_name.empty())
{
session_name = payload["caller_name"].asString();
}
EInstantMessage type = (EInstantMessage)payload["type"].asInteger();
LLIMMgr::EInvitationType inv_type = (LLIMMgr::EInvitationType)payload["inv_type"].asInteger();
bool voice = true;
@ -3315,7 +3319,9 @@ LLUUID LLIMMgr::addSession(
bool new_session = (LLIMModel::getInstance()->findIMSession(session_id) == NULL);
//works only for outgoing ad-hoc sessions
if (new_session && IM_SESSION_CONFERENCE_START == dialog && ids.size())
if (new_session &&
((IM_NOTHING_SPECIAL == dialog) || (IM_SESSION_P2P_INVITE == dialog) || (IM_SESSION_CONFERENCE_START == dialog)) &&
ids.size())
{
LLIMModel::LLIMSession* ad_hoc_found = LLIMModel::getInstance()->findAdHocIMSession(ids);
if (ad_hoc_found)
@ -4111,7 +4117,7 @@ public:
}
BOOL session_type_p2p = input["body"]["voice"].get("invitation_type").asInteger() == EMultiAgentChatSessionType::P2P_CHAT_SESSION;
LL_WARNS("Voice") << "VOICE DATA: " << input["body"]["voice"] << LL_ENDL;
LL_WARNS("Voice") << "VOICE DATA: " << input["body"]<< LL_ENDL;
gIMMgr->inviteToSession(
input["body"]["session_id"].asUUID(),
input["body"]["session_name"].asString(),

View File

@ -381,8 +381,12 @@ boost::signals2::connection LLVoiceChannel::setCurrentVoiceChannelChangedCallbac
// LLVoiceChannelGroup
//
LLVoiceChannelGroup::LLVoiceChannelGroup(const LLUUID& session_id, const std::string& session_name, BOOL hangup_on_last_leave) :
LLVoiceChannel(session_id, session_name),
LLVoiceChannelGroup::LLVoiceChannelGroup(const LLUUID &session_id,
const std::string &session_name,
bool notify_on_first_join,
bool hangup_on_last_leave) :
LLVoiceChannel(session_id, session_name),
mNotifyOnFirstJoin(notify_on_first_join),
mHangupOnLastLeave(hangup_on_last_leave)
{
mRetries = DEFAULT_RETRIES_COUNT;
@ -408,6 +412,7 @@ void LLVoiceChannelGroup::activate()
{
// we have the channel info, just need to use it now
LLVoiceClient::getInstance()->setNonSpatialChannel(mChannelInfo,
mNotifyOnFirstJoin,
mHangupOnLastLeave);
if (!gAgent.isInGroup(mSessionID)) // ad-hoc channel
@ -484,6 +489,7 @@ void LLVoiceChannelGroup::setChannelInfo(const LLSD& channelInfo)
{
// we have the channel info, just need to use it now
LLVoiceClient::getInstance()->setNonSpatialChannel(channelInfo,
mNotifyOnFirstJoin,
mHangupOnLastLeave);
}
}
@ -734,7 +740,7 @@ LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID &session_id,
const std::string &session_name,
const LLUUID &other_user_id,
LLVoiceP2POutgoingCallInterface* outgoing_call_interface) :
LLVoiceChannelGroup(session_id, session_name, true),
LLVoiceChannelGroup(session_id, session_name, true, true),
mOtherUserID(other_user_id),
mReceivedCall(FALSE),
mOutgoingCallInterface(outgoing_call_interface)

View File

@ -136,7 +136,7 @@ private:
class LLVoiceChannelGroup : public LLVoiceChannel
{
public:
LLVoiceChannelGroup(const LLUUID& session_id, const std::string& session_name, BOOL hangup_on_last_leave);
LLVoiceChannelGroup(const LLUUID& session_id, const std::string& session_name, bool notify_on_first_join, bool hangup_on_last_leave);
void handleStatusChange(EStatusType status) override;
void handleError(EStatusType status) override;
@ -153,7 +153,8 @@ private:
U32 mRetries;
BOOL mIsRetrying;
BOOL mHangupOnLastLeave;
bool mHangupOnLastLeave;
bool mNotifyOnFirstJoin;
};
class LLVoiceChannelProximal : public LLVoiceChannel, public LLSingleton<LLVoiceChannelProximal>

View File

@ -427,6 +427,7 @@ bool LLVoiceClient::inProximalChannel()
void LLVoiceClient::setNonSpatialChannel(
const LLSD& channelInfo,
bool notify_on_first_join,
bool hangup_on_last_leave)
{
setNonSpatialVoiceModule(channelInfo["voice_server_type"].asString());
@ -436,7 +437,7 @@ void LLVoiceClient::setNonSpatialChannel(
}
if (mNonSpatialVoiceModule)
{
mNonSpatialVoiceModule->setNonSpatialChannel(channelInfo, hangup_on_last_leave);
mNonSpatialVoiceModule->setNonSpatialChannel(channelInfo, notify_on_first_join, hangup_on_last_leave);
mNonSpatialVoiceModule->processChannels(true);
}
}

View File

@ -205,7 +205,8 @@ public:
virtual bool inProximalChannel()=0;
virtual void setNonSpatialChannel(const LLSD& channelInfo,
bool hangup_on_last_leave = false)=0;
bool notify_on_first_join,
bool hangup_on_last_leave)=0;
virtual bool setSpatialChannel(const LLSD& channelInfo)=0;
@ -407,7 +408,8 @@ public:
bool inProximalChannel();
void setNonSpatialChannel(const LLSD& channelInfo,
bool hangup_on_last_leave = false);
bool notify_on_first_join,
bool hangup_on_last_leave);
void setSpatialChannel(const LLSD &channelInfo);

View File

@ -4917,7 +4917,7 @@ void LLVivoxVoiceClient::joinSession(const sessionStatePtr_t &session)
}
}
void LLVivoxVoiceClient::setNonSpatialChannel(const LLSD& channelInfo, bool hangup_on_last_leave)
void LLVivoxVoiceClient::setNonSpatialChannel(const LLSD& channelInfo, bool notify_on_first_join, bool hangup_on_last_leave)
{
switchChannel(channelInfo["channel_uri"].asString(), false, false, false, channelInfo["channel_credentials"].asString());
}

View File

@ -147,6 +147,7 @@ public:
bool inProximalChannel() override;
void setNonSpatialChannel(const LLSD& channelInfo,
bool notify_on_first_join,
bool hangup_on_last_leave) override;
bool setSpatialChannel(const LLSD& channelInfo) override;

View File

@ -423,7 +423,10 @@ void LLWebRTCVoiceClient::OnConnectionEstablished(const std::string& channelID,
if (mSession && mSession->mChannelID == channelID)
{
LLWebRTCVoiceClient::getInstance()->notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LOGGED_IN);
LLWebRTCVoiceClient::getInstance()->notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINED);
if (!mSession->mNotifyOnFirstJoin)
{
LLWebRTCVoiceClient::getInstance()->notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINED);
}
}
}
}
@ -488,6 +491,7 @@ bool LLWebRTCVoiceClient::sessionState::processConnectionStates()
LLWebRTCVoiceClient::estateSessionState::estateSessionState()
{
mHangupOnLastLeave = false;
mNotifyOnFirstJoin = false;
mChannelID = "Estate";
LLUUID region_id = gAgent.getRegion()->getRegionID();
@ -497,15 +501,20 @@ LLWebRTCVoiceClient::estateSessionState::estateSessionState()
LLWebRTCVoiceClient::parcelSessionState::parcelSessionState(const std::string &channelID, S32 parcel_local_id)
{
mHangupOnLastLeave = false;
mNotifyOnFirstJoin = false;
LLUUID region_id = gAgent.getRegion()->getRegionID();
mChannelID = channelID;
mWebRTCConnections.emplace_back(new LLVoiceWebRTCSpatialConnection(region_id, parcel_local_id, channelID));
}
LLWebRTCVoiceClient::adhocSessionState::adhocSessionState(const std::string &channelID, const std::string& credentials, bool hangup_on_last_leave) :
LLWebRTCVoiceClient::adhocSessionState::adhocSessionState(const std::string &channelID,
const std::string& credentials,
bool notify_on_first_join,
bool hangup_on_last_leave) :
mCredentials(credentials)
{
mHangupOnLastLeave = hangup_on_last_leave;
mNotifyOnFirstJoin = notify_on_first_join;
LLUUID region_id = gAgent.getRegion()->getRegionID();
mChannelID = channelID;
mWebRTCConnections.emplace_back(new LLVoiceWebRTCAdHocConnection(region_id, channelID, credentials));
@ -1231,6 +1240,10 @@ LLWebRTCVoiceClient::participantStatePtr_t LLWebRTCVoiceClient::addParticipantBy
if (session)
{
result = session->addParticipant(id);
if (session->mNotifyOnFirstJoin && (id != gAgentID))
{
notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINED);
}
}
return result;
}
@ -1269,13 +1282,16 @@ bool LLWebRTCVoiceClient::startParcelSession(const std::string &channelID, S32 p
return true;
}
bool LLWebRTCVoiceClient::startAdHocSession(const LLSD& channelInfo, bool hangup_on_last_leave)
bool LLWebRTCVoiceClient::startAdHocSession(const LLSD& channelInfo, bool notify_on_first_join, bool hangup_on_last_leave)
{
leaveChannel(false);
LL_WARNS("Voice") << "Start AdHoc Session " << channelInfo << LL_ENDL;
std::string channelID = channelInfo["channel_uri"];
std::string credentials = channelInfo["channel_credentials"];
mNextSession = addSession(channelID, sessionState::ptr_t(new adhocSessionState(channelID, credentials, hangup_on_last_leave)));
mNextSession = addSession(channelID, sessionState::ptr_t(new adhocSessionState(channelID,
credentials,
notify_on_first_join,
hangup_on_last_leave)));
return true;
}

View File

@ -143,9 +143,9 @@ public:
// Note that gestures should only fire if this returns true.
bool inProximalChannel() override;
void setNonSpatialChannel(const LLSD& channelInfo, bool hangup_on_last_leave) override
void setNonSpatialChannel(const LLSD& channelInfo, bool notify_on_first_join, bool hangup_on_last_leave) override
{
startAdHocSession(channelInfo, hangup_on_last_leave);
startAdHocSession(channelInfo, notify_on_first_join, hangup_on_last_leave);
}
bool setSpatialChannel(const LLSD &channelInfo) override
@ -388,6 +388,7 @@ public:
{ return mSessions.find(sessionID) != mSessions.end(); }
bool mHangupOnLastLeave;
bool mNotifyOnFirstJoin;
protected:
sessionState();
@ -429,7 +430,10 @@ public:
class adhocSessionState : public sessionState
{
public:
adhocSessionState(const std::string &channelID, const std::string& credentials, bool hangup_on_last_leave);
adhocSessionState(const std::string &channelID,
const std::string& credentials,
bool notify_on_first_join,
bool hangup_on_last_leave);
bool isSpatial() override { return false; }
bool isEstate() override { return false; }
@ -603,7 +607,7 @@ private:
bool startEstateSession();
bool startParcelSession(const std::string& channelID, S32 parcelID);
bool startAdHocSession(const LLSD &channelInfo, bool hangup_on_last_leave);
bool startAdHocSession(const LLSD &channelInfo, bool notify_on_first_join, bool hangup_on_last_leave);
std::string nameFromID(const LLUUID &id);
bool IDFromName(const std::string name, LLUUID &uuid);