[Voice Update] Minor update to llvoicechannel class
Incompatible things left in from upstream are commented out Just need to wrap things up to a point.
This commit is contained in:
@@ -39,6 +39,7 @@ LLVoiceChannel::voice_channel_map_t LLVoiceChannel::sVoiceChannelMap;
|
|||||||
LLVoiceChannel::voice_channel_map_uri_t LLVoiceChannel::sVoiceChannelURIMap;
|
LLVoiceChannel::voice_channel_map_uri_t LLVoiceChannel::sVoiceChannelURIMap;
|
||||||
LLVoiceChannel* LLVoiceChannel::sCurrentVoiceChannel = NULL;
|
LLVoiceChannel* LLVoiceChannel::sCurrentVoiceChannel = NULL;
|
||||||
LLVoiceChannel* LLVoiceChannel::sSuspendedVoiceChannel = NULL;
|
LLVoiceChannel* LLVoiceChannel::sSuspendedVoiceChannel = NULL;
|
||||||
|
LLVoiceChannel::channel_changed_signal_t LLVoiceChannel::sCurrentVoiceChannelChangedSignal;
|
||||||
|
|
||||||
BOOL LLVoiceChannel::sSuspended = FALSE;
|
BOOL LLVoiceChannel::sSuspended = FALSE;
|
||||||
|
|
||||||
@@ -65,7 +66,7 @@ private:
|
|||||||
|
|
||||||
void LLVoiceCallCapResponder::error(U32 status, const std::string& reason)
|
void LLVoiceCallCapResponder::error(U32 status, const std::string& reason)
|
||||||
{
|
{
|
||||||
LL_WARNS("Voice") << "LLVoiceCallCapResponder::error [status:"
|
LL_WARNS("Voice") << "LLVoiceCallCapResponder error [status:"
|
||||||
<< status << "]: " << reason << LL_ENDL;
|
<< status << "]: " << reason << LL_ENDL;
|
||||||
LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(mSessionID);
|
LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(mSessionID);
|
||||||
if ( channelp )
|
if ( channelp )
|
||||||
@@ -113,7 +114,9 @@ LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const std::string& sess
|
|||||||
mSessionID(session_id),
|
mSessionID(session_id),
|
||||||
mState(STATE_NO_CHANNEL_INFO),
|
mState(STATE_NO_CHANNEL_INFO),
|
||||||
mSessionName(session_name),
|
mSessionName(session_name),
|
||||||
mIgnoreNextSessionLeave(FALSE)
|
mCallDirection(OUTGOING_CALL),
|
||||||
|
mIgnoreNextSessionLeave(FALSE),
|
||||||
|
mCallEndedByAgent(false)
|
||||||
{
|
{
|
||||||
mNotifyArgs["VOICE_CHANNEL_NAME"] = mSessionName;
|
mNotifyArgs["VOICE_CHANNEL_NAME"] = mSessionName;
|
||||||
|
|
||||||
@@ -123,8 +126,6 @@ LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const std::string& sess
|
|||||||
// the end result should simply be the failure to make voice calls
|
// the end result should simply be the failure to make voice calls
|
||||||
LL_WARNS("Voice") << "Duplicate voice channels registered for session_id " << session_id << LL_ENDL;
|
LL_WARNS("Voice") << "Duplicate voice channels registered for session_id " << session_id << LL_ENDL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVoiceClient::getInstance()->addObserver(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVoiceChannel::~LLVoiceChannel()
|
LLVoiceChannel::~LLVoiceChannel()
|
||||||
@@ -280,6 +281,7 @@ void LLVoiceChannel::deactivate()
|
|||||||
LLVoiceClient::getInstance()->inputUserControlState(true);
|
LLVoiceClient::getInstance()->inputUserControlState(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
LLVoiceClient::getInstance()->removeObserver(this);
|
||||||
|
|
||||||
if (sCurrentVoiceChannel == this)
|
if (sCurrentVoiceChannel == this)
|
||||||
{
|
{
|
||||||
@@ -303,8 +305,10 @@ void LLVoiceChannel::activate()
|
|||||||
// activating the proximal channel between IM calls
|
// activating the proximal channel between IM calls
|
||||||
LLVoiceChannel* old_channel = sCurrentVoiceChannel;
|
LLVoiceChannel* old_channel = sCurrentVoiceChannel;
|
||||||
sCurrentVoiceChannel = this;
|
sCurrentVoiceChannel = this;
|
||||||
|
//mCallDialogPayload["old_channel_name"] = "";
|
||||||
if (old_channel)
|
if (old_channel)
|
||||||
{
|
{
|
||||||
|
//mCallDialogPayload["old_channel_name"] = old_channel->getSessionName();
|
||||||
old_channel->deactivate();
|
old_channel->deactivate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -319,6 +323,10 @@ void LLVoiceChannel::activate()
|
|||||||
setState(STATE_CALL_STARTED);
|
setState(STATE_CALL_STARTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLVoiceClient::getInstance()->addObserver(this);
|
||||||
|
|
||||||
|
//do not send earlier, channel should be initialized, should not be in STATE_NO_CHANNEL_INFO state
|
||||||
|
sCurrentVoiceChannelChangedSignal(this->mSessionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLVoiceChannel::getChannelInfo()
|
void LLVoiceChannel::getChannelInfo()
|
||||||
@@ -394,7 +402,16 @@ void LLVoiceChannel::setState(EState state)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mState = state;
|
doSetState(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLVoiceChannel::doSetState(const EState& new_state)
|
||||||
|
{
|
||||||
|
EState old_state = mState;
|
||||||
|
mState = new_state;
|
||||||
|
|
||||||
|
if (!mStateChangedCallback.empty())
|
||||||
|
mStateChangedCallback(old_state, mState, mCallDirection, mCallEndedByAgent);
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
//static
|
||||||
@@ -433,6 +450,18 @@ void LLVoiceChannel::resume()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::signals2::connection LLVoiceChannel::setCurrentVoiceChannelChangedCallback(channel_changed_callback_t cb, bool at_front)
|
||||||
|
{
|
||||||
|
if (at_front)
|
||||||
|
{
|
||||||
|
return sCurrentVoiceChannelChangedSignal.connect(cb, boost::signals2::at_front);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return sCurrentVoiceChannelChangedSignal.connect(cb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// LLVoiceChannelGroup
|
// LLVoiceChannelGroup
|
||||||
//
|
//
|
||||||
@@ -466,11 +495,37 @@ void LLVoiceChannelGroup::activate()
|
|||||||
mURI,
|
mURI,
|
||||||
mCredentials);
|
mCredentials);
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (!gAgent.isInGroup(mSessionID)) // ad-hoc channel
|
||||||
|
{
|
||||||
|
LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionID);
|
||||||
|
// Adding ad-hoc call participants to Recent People List.
|
||||||
|
// If it's an outgoing ad-hoc, we can use mInitialTargetIDs that holds IDs of people we
|
||||||
|
// called(both online and offline) as source to get people for recent (STORM-210).
|
||||||
|
if (session->isOutgoingAdHoc())
|
||||||
|
{
|
||||||
|
for (uuid_vec_t::iterator it = session->mInitialTargetIDs.begin();
|
||||||
|
it!=session->mInitialTargetIDs.end();++it)
|
||||||
|
{
|
||||||
|
const LLUUID id = *it;
|
||||||
|
LLRecentPeople::instance().add(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If this ad-hoc is incoming then trying to get ids of people from mInitialTargetIDs
|
||||||
|
// would lead to EXT-8246. So in this case we get them from speakers list.
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LLIMModel::addSpeakersToRecent(mSessionID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//Mic default state is OFF on initiating/joining Ad-Hoc/Group calls
|
//Mic default state is OFF on initiating/joining Ad-Hoc/Group calls
|
||||||
if (LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
|
if (LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
|
||||||
{
|
{
|
||||||
LLVoiceClient::getInstance()->inputUserControlState(true);
|
LLVoiceClient::getInstance()->inputUserControlState(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,7 +655,7 @@ void LLVoiceChannelGroup::setState(EState state)
|
|||||||
gIMMgr->addSystemMessage(mSessionID, "ringing", mNotifyArgs);
|
gIMMgr->addSystemMessage(mSessionID, "ringing", mNotifyArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
mState = state;
|
doSetState(state);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LLVoiceChannel::setState(state);
|
LLVoiceChannel::setState(state);
|
||||||
@@ -613,7 +668,6 @@ void LLVoiceChannelGroup::setState(EState state)
|
|||||||
LLVoiceChannelProximal::LLVoiceChannelProximal() :
|
LLVoiceChannelProximal::LLVoiceChannelProximal() :
|
||||||
LLVoiceChannel(LLUUID::null, LLStringUtil::null)
|
LLVoiceChannel(LLUUID::null, LLStringUtil::null)
|
||||||
{
|
{
|
||||||
activate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLVoiceChannelProximal::isActive()
|
BOOL LLVoiceChannelProximal::isActive()
|
||||||
@@ -625,13 +679,13 @@ void LLVoiceChannelProximal::activate()
|
|||||||
{
|
{
|
||||||
if (callStarted()) return;
|
if (callStarted()) return;
|
||||||
|
|
||||||
LLVoiceChannel::activate();
|
if((LLVoiceChannel::sCurrentVoiceChannel != this) && (LLVoiceChannel::getState() == STATE_CONNECTED))
|
||||||
|
|
||||||
if (callStarted())
|
|
||||||
{
|
{
|
||||||
// this implicitly puts you back in the spatial channel
|
// we're connected to a non-spatial channel, so disconnect.
|
||||||
LLVoiceClient::getInstance()->leaveNonSpatialChannel();
|
LLVoiceClient::getInstance()->leaveNonSpatialChannel();
|
||||||
}
|
}
|
||||||
|
LLVoiceChannel::activate();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLVoiceChannelProximal::onChange(EStatusType type, const std::string &channelURI, bool proximal)
|
void LLVoiceChannelProximal::onChange(EStatusType type, const std::string &channelURI, bool proximal)
|
||||||
@@ -738,6 +792,7 @@ void LLVoiceChannelP2P::handleStatusChange(EStatusType type)
|
|||||||
{
|
{
|
||||||
// other user hung up, so we didn't end the call
|
// other user hung up, so we didn't end the call
|
||||||
LLNotificationsUtil::add("VoiceChannelDisconnectedP2P", mNotifyArgs);
|
LLNotificationsUtil::add("VoiceChannelDisconnectedP2P", mNotifyArgs);
|
||||||
|
mCallEndedByAgent = false;
|
||||||
}
|
}
|
||||||
deactivate();
|
deactivate();
|
||||||
}
|
}
|
||||||
@@ -774,6 +829,9 @@ void LLVoiceChannelP2P::activate()
|
|||||||
{
|
{
|
||||||
if (callStarted()) return;
|
if (callStarted()) return;
|
||||||
|
|
||||||
|
//call will be counted as ended by user unless this variable is changed in handleStatusChange()
|
||||||
|
mCallEndedByAgent = true;
|
||||||
|
|
||||||
LLVoiceChannel::activate();
|
LLVoiceChannel::activate();
|
||||||
|
|
||||||
if (callStarted())
|
if (callStarted())
|
||||||
@@ -789,15 +847,18 @@ void LLVoiceChannelP2P::activate()
|
|||||||
{
|
{
|
||||||
if (!LLVoiceClient::getInstance()->answerInvite(mSessionHandle))
|
if (!LLVoiceClient::getInstance()->answerInvite(mSessionHandle))
|
||||||
{
|
{
|
||||||
|
mCallEndedByAgent = false;
|
||||||
mSessionHandle.clear();
|
mSessionHandle.clear();
|
||||||
handleError(ERROR_UNKNOWN);
|
handleError(ERROR_UNKNOWN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// using the session handle invalidates it. Clear it out here so we can't reuse it by accident.
|
// using the session handle invalidates it. Clear it out here so we can't reuse it by accident.
|
||||||
mSessionHandle.clear();
|
mSessionHandle.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add the party to the list of people with which we've recently interacted.
|
||||||
|
//addToTheRecentPeopleList();
|
||||||
|
|
||||||
//Default mic is ON on initiating/joining P2P calls
|
//Default mic is ON on initiating/joining P2P calls
|
||||||
if (!LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
|
if (!LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
|
||||||
{
|
{
|
||||||
@@ -873,10 +934,33 @@ void LLVoiceChannelP2P::setState(EState state)
|
|||||||
if (mReceivedCall && state == STATE_RINGING)
|
if (mReceivedCall && state == STATE_RINGING)
|
||||||
{
|
{
|
||||||
gIMMgr->addSystemMessage(mSessionID, "answering", mNotifyArgs);
|
gIMMgr->addSystemMessage(mSessionID, "answering", mNotifyArgs);
|
||||||
mState = state;
|
doSetState(state);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVoiceChannel::setState(state);
|
LLVoiceChannel::setState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*void LLVoiceChannelP2P::addToTheRecentPeopleList()
|
||||||
|
{
|
||||||
|
bool avaline_call = LLIMModel::getInstance()->findIMSession(mSessionID)->isAvalineSessionType();
|
||||||
|
|
||||||
|
if (avaline_call)
|
||||||
|
{
|
||||||
|
LLSD call_data;
|
||||||
|
std::string call_number = LLVoiceChannel::getSessionName();
|
||||||
|
|
||||||
|
call_data["avaline_call"] = true;
|
||||||
|
call_data["session_id"] = mSessionID;
|
||||||
|
call_data["call_number"] = call_number;
|
||||||
|
call_data["date"] = LLDate::now();
|
||||||
|
|
||||||
|
LLRecentPeople::instance().add(mOtherUserID, call_data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LLRecentPeople::instance().add(mOtherUserID);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,21 @@ public:
|
|||||||
STATE_CONNECTED
|
STATE_CONNECTED
|
||||||
} EState;
|
} EState;
|
||||||
|
|
||||||
|
typedef enum e_voice_channel_direction
|
||||||
|
{
|
||||||
|
INCOMING_CALL,
|
||||||
|
OUTGOING_CALL
|
||||||
|
} EDirection;
|
||||||
|
|
||||||
|
typedef boost::signals2::signal<void(const EState& old_state, const EState& new_state, const EDirection& direction, bool ended_by_agent)> state_changed_signal_t;
|
||||||
|
|
||||||
|
// on current channel changed signal
|
||||||
|
typedef boost::function<void(const LLUUID& session_id)> channel_changed_callback_t;
|
||||||
|
typedef boost::signals2::signal<void(const LLUUID& session_id)> channel_changed_signal_t;
|
||||||
|
static channel_changed_signal_t sCurrentVoiceChannelChangedSignal;
|
||||||
|
static boost::signals2::connection setCurrentVoiceChannelChangedCallback(channel_changed_callback_t cb, bool at_front = false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LLVoiceChannel(const LLUUID& session_id, const std::string& session_name);
|
LLVoiceChannel(const LLUUID& session_id, const std::string& session_name);
|
||||||
virtual ~LLVoiceChannel();
|
virtual ~LLVoiceChannel();
|
||||||
@@ -60,12 +75,22 @@ public:
|
|||||||
virtual BOOL isActive();
|
virtual BOOL isActive();
|
||||||
virtual BOOL callStarted();
|
virtual BOOL callStarted();
|
||||||
|
|
||||||
|
// Session name is a UI label used for feedback about which person,
|
||||||
|
// group, or phone number you are talking to
|
||||||
|
const std::string& getSessionName() const { return mSessionName; }
|
||||||
|
|
||||||
|
boost::signals2::connection setStateChangedCallback(const state_changed_signal_t::slot_type& callback)
|
||||||
|
{ return mStateChangedCallback.connect(callback); }
|
||||||
|
|
||||||
const LLUUID getSessionID() { return mSessionID; }
|
const LLUUID getSessionID() { return mSessionID; }
|
||||||
EState getState() { return mState; }
|
EState getState() { return mState; }
|
||||||
|
|
||||||
void updateSessionID(const LLUUID& new_session_id);
|
void updateSessionID(const LLUUID& new_session_id);
|
||||||
const LLSD& getNotifyArgs() { return mNotifyArgs; }
|
const LLSD& getNotifyArgs() { return mNotifyArgs; }
|
||||||
|
|
||||||
|
void setCallDirection(EDirection direction) {mCallDirection = direction;}
|
||||||
|
EDirection getCallDirection() {return mCallDirection;}
|
||||||
|
|
||||||
static LLVoiceChannel* getChannelByID(const LLUUID& session_id);
|
static LLVoiceChannel* getChannelByID(const LLUUID& session_id);
|
||||||
static LLVoiceChannel* getChannelByURI(std::string uri);
|
static LLVoiceChannel* getChannelByURI(std::string uri);
|
||||||
static LLVoiceChannel* getCurrentVoiceChannel();
|
static LLVoiceChannel* getCurrentVoiceChannel();
|
||||||
@@ -77,14 +102,24 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void setState(EState state);
|
virtual void setState(EState state);
|
||||||
|
/**
|
||||||
|
* Use this method if you want mStateChangedCallback to be executed while state is changed
|
||||||
|
*/
|
||||||
|
void doSetState(const EState& state);
|
||||||
void setURI(std::string uri);
|
void setURI(std::string uri);
|
||||||
|
|
||||||
|
// there can be two directions INCOMING and OUTGOING
|
||||||
|
EDirection mCallDirection;
|
||||||
|
|
||||||
std::string mURI;
|
std::string mURI;
|
||||||
std::string mCredentials;
|
std::string mCredentials;
|
||||||
LLUUID mSessionID;
|
LLUUID mSessionID;
|
||||||
EState mState;
|
EState mState;
|
||||||
std::string mSessionName;
|
std::string mSessionName;
|
||||||
LLSD mNotifyArgs;
|
LLSD mNotifyArgs;
|
||||||
|
//LLSD mCallDialogPayload;
|
||||||
|
// true if call was ended by agent
|
||||||
|
bool mCallEndedByAgent;
|
||||||
BOOL mIgnoreNextSessionLeave;
|
BOOL mIgnoreNextSessionLeave;
|
||||||
LLHandle<LLPanel> mLoginNotificationHandle;
|
LLHandle<LLPanel> mLoginNotificationHandle;
|
||||||
|
|
||||||
@@ -97,6 +132,9 @@ protected:
|
|||||||
static LLVoiceChannel* sCurrentVoiceChannel;
|
static LLVoiceChannel* sCurrentVoiceChannel;
|
||||||
static LLVoiceChannel* sSuspendedVoiceChannel;
|
static LLVoiceChannel* sSuspendedVoiceChannel;
|
||||||
static BOOL sSuspended;
|
static BOOL sSuspended;
|
||||||
|
|
||||||
|
private:
|
||||||
|
state_changed_signal_t mStateChangedCallback;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LLVoiceChannelGroup : public LLVoiceChannel
|
class LLVoiceChannelGroup : public LLVoiceChannel
|
||||||
@@ -152,6 +190,12 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the caller to the list of people with which we've recently interacted
|
||||||
|
*
|
||||||
|
void addToTheRecentPeopleList();
|
||||||
|
**/
|
||||||
|
|
||||||
std::string mSessionHandle;
|
std::string mSessionHandle;
|
||||||
LLUUID mOtherUserID;
|
LLUUID mOtherUserID;
|
||||||
BOOL mReceivedCall;
|
BOOL mReceivedCall;
|
||||||
|
|||||||
Reference in New Issue
Block a user