[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* LLVoiceChannel::sCurrentVoiceChannel = NULL;
|
||||
LLVoiceChannel* LLVoiceChannel::sSuspendedVoiceChannel = NULL;
|
||||
LLVoiceChannel::channel_changed_signal_t LLVoiceChannel::sCurrentVoiceChannelChangedSignal;
|
||||
|
||||
BOOL LLVoiceChannel::sSuspended = FALSE;
|
||||
|
||||
@@ -65,7 +66,7 @@ private:
|
||||
|
||||
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;
|
||||
LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(mSessionID);
|
||||
if ( channelp )
|
||||
@@ -113,7 +114,9 @@ LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const std::string& sess
|
||||
mSessionID(session_id),
|
||||
mState(STATE_NO_CHANNEL_INFO),
|
||||
mSessionName(session_name),
|
||||
mIgnoreNextSessionLeave(FALSE)
|
||||
mCallDirection(OUTGOING_CALL),
|
||||
mIgnoreNextSessionLeave(FALSE),
|
||||
mCallEndedByAgent(false)
|
||||
{
|
||||
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
|
||||
LL_WARNS("Voice") << "Duplicate voice channels registered for session_id " << session_id << LL_ENDL;
|
||||
}
|
||||
|
||||
LLVoiceClient::getInstance()->addObserver(this);
|
||||
}
|
||||
|
||||
LLVoiceChannel::~LLVoiceChannel()
|
||||
@@ -280,6 +281,7 @@ void LLVoiceChannel::deactivate()
|
||||
LLVoiceClient::getInstance()->inputUserControlState(true);
|
||||
}
|
||||
}
|
||||
LLVoiceClient::getInstance()->removeObserver(this);
|
||||
|
||||
if (sCurrentVoiceChannel == this)
|
||||
{
|
||||
@@ -303,8 +305,10 @@ void LLVoiceChannel::activate()
|
||||
// activating the proximal channel between IM calls
|
||||
LLVoiceChannel* old_channel = sCurrentVoiceChannel;
|
||||
sCurrentVoiceChannel = this;
|
||||
//mCallDialogPayload["old_channel_name"] = "";
|
||||
if (old_channel)
|
||||
{
|
||||
//mCallDialogPayload["old_channel_name"] = old_channel->getSessionName();
|
||||
old_channel->deactivate();
|
||||
}
|
||||
}
|
||||
@@ -319,6 +323,10 @@ void LLVoiceChannel::activate()
|
||||
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()
|
||||
@@ -394,7 +402,16 @@ void LLVoiceChannel::setState(EState state)
|
||||
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
|
||||
@@ -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
|
||||
//
|
||||
@@ -466,11 +495,37 @@ void LLVoiceChannelGroup::activate()
|
||||
mURI,
|
||||
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
|
||||
if (LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
|
||||
{
|
||||
LLVoiceClient::getInstance()->inputUserControlState(true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,7 +655,7 @@ void LLVoiceChannelGroup::setState(EState state)
|
||||
gIMMgr->addSystemMessage(mSessionID, "ringing", mNotifyArgs);
|
||||
}
|
||||
|
||||
mState = state;
|
||||
doSetState(state);
|
||||
break;
|
||||
default:
|
||||
LLVoiceChannel::setState(state);
|
||||
@@ -613,7 +668,6 @@ void LLVoiceChannelGroup::setState(EState state)
|
||||
LLVoiceChannelProximal::LLVoiceChannelProximal() :
|
||||
LLVoiceChannel(LLUUID::null, LLStringUtil::null)
|
||||
{
|
||||
activate();
|
||||
}
|
||||
|
||||
BOOL LLVoiceChannelProximal::isActive()
|
||||
@@ -625,13 +679,13 @@ void LLVoiceChannelProximal::activate()
|
||||
{
|
||||
if (callStarted()) return;
|
||||
|
||||
LLVoiceChannel::activate();
|
||||
|
||||
if (callStarted())
|
||||
if((LLVoiceChannel::sCurrentVoiceChannel != this) && (LLVoiceChannel::getState() == STATE_CONNECTED))
|
||||
{
|
||||
// this implicitly puts you back in the spatial channel
|
||||
// we're connected to a non-spatial channel, so disconnect.
|
||||
LLVoiceClient::getInstance()->leaveNonSpatialChannel();
|
||||
}
|
||||
LLVoiceChannel::activate();
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
LLNotificationsUtil::add("VoiceChannelDisconnectedP2P", mNotifyArgs);
|
||||
mCallEndedByAgent = false;
|
||||
}
|
||||
deactivate();
|
||||
}
|
||||
@@ -774,6 +829,9 @@ void LLVoiceChannelP2P::activate()
|
||||
{
|
||||
if (callStarted()) return;
|
||||
|
||||
//call will be counted as ended by user unless this variable is changed in handleStatusChange()
|
||||
mCallEndedByAgent = true;
|
||||
|
||||
LLVoiceChannel::activate();
|
||||
|
||||
if (callStarted())
|
||||
@@ -789,15 +847,18 @@ void LLVoiceChannelP2P::activate()
|
||||
{
|
||||
if (!LLVoiceClient::getInstance()->answerInvite(mSessionHandle))
|
||||
{
|
||||
mCallEndedByAgent = false;
|
||||
mSessionHandle.clear();
|
||||
handleError(ERROR_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
// using the session handle invalidates it. Clear it out here so we can't reuse it by accident.
|
||||
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
|
||||
if (!LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
|
||||
{
|
||||
@@ -873,10 +934,33 @@ void LLVoiceChannelP2P::setState(EState state)
|
||||
if (mReceivedCall && state == STATE_RINGING)
|
||||
{
|
||||
gIMMgr->addSystemMessage(mSessionID, "answering", mNotifyArgs);
|
||||
mState = state;
|
||||
doSetState(state);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
} 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);
|
||||
virtual ~LLVoiceChannel();
|
||||
@@ -60,12 +75,22 @@ public:
|
||||
virtual BOOL isActive();
|
||||
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; }
|
||||
EState getState() { return mState; }
|
||||
|
||||
void updateSessionID(const LLUUID& new_session_id);
|
||||
const LLSD& getNotifyArgs() { return mNotifyArgs; }
|
||||
|
||||
void setCallDirection(EDirection direction) {mCallDirection = direction;}
|
||||
EDirection getCallDirection() {return mCallDirection;}
|
||||
|
||||
static LLVoiceChannel* getChannelByID(const LLUUID& session_id);
|
||||
static LLVoiceChannel* getChannelByURI(std::string uri);
|
||||
static LLVoiceChannel* getCurrentVoiceChannel();
|
||||
@@ -77,14 +102,24 @@ public:
|
||||
|
||||
protected:
|
||||
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);
|
||||
|
||||
// there can be two directions INCOMING and OUTGOING
|
||||
EDirection mCallDirection;
|
||||
|
||||
std::string mURI;
|
||||
std::string mCredentials;
|
||||
LLUUID mSessionID;
|
||||
EState mState;
|
||||
std::string mSessionName;
|
||||
LLSD mNotifyArgs;
|
||||
//LLSD mCallDialogPayload;
|
||||
// true if call was ended by agent
|
||||
bool mCallEndedByAgent;
|
||||
BOOL mIgnoreNextSessionLeave;
|
||||
LLHandle<LLPanel> mLoginNotificationHandle;
|
||||
|
||||
@@ -97,6 +132,9 @@ protected:
|
||||
static LLVoiceChannel* sCurrentVoiceChannel;
|
||||
static LLVoiceChannel* sSuspendedVoiceChannel;
|
||||
static BOOL sSuspended;
|
||||
|
||||
private:
|
||||
state_changed_signal_t mStateChangedCallback;
|
||||
};
|
||||
|
||||
class LLVoiceChannelGroup : public LLVoiceChannel
|
||||
@@ -152,6 +190,12 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Add the caller to the list of people with which we've recently interacted
|
||||
*
|
||||
void addToTheRecentPeopleList();
|
||||
**/
|
||||
|
||||
std::string mSessionHandle;
|
||||
LLUUID mOtherUserID;
|
||||
BOOL mReceivedCall;
|
||||
|
||||
Reference in New Issue
Block a user