#2325 WebRTC: p2p voice calling option sometimes becomes disabled after calling another agent back too soon
parent
8fef55b3b2
commit
f7bb097247
|
|
@ -368,8 +368,6 @@ bool LLFloaterIMSession::postBuild()
|
|||
add_btn->setEnabled(isInviteAllowed());
|
||||
add_btn->setClickedCallback(boost::bind(&LLFloaterIMSession::onAddButtonClicked, this));
|
||||
|
||||
childSetAction("voice_call_btn", boost::bind(&LLFloaterIMSession::onCallButtonClicked, this));
|
||||
|
||||
LLVoiceClient::addObserver(this);
|
||||
|
||||
//*TODO if session is not initialized yet, add some sort of a warning message like "starting session...blablabla"
|
||||
|
|
@ -551,23 +549,6 @@ void LLFloaterIMSession::boundVoiceChannel()
|
|||
}
|
||||
}
|
||||
|
||||
void LLFloaterIMSession::onCallButtonClicked()
|
||||
{
|
||||
LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
|
||||
if (voice_channel)
|
||||
{
|
||||
bool is_call_active = voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED;
|
||||
if (is_call_active)
|
||||
{
|
||||
gIMMgr->endCall(mSessionID);
|
||||
}
|
||||
else
|
||||
{
|
||||
gIMMgr->startCall(mSessionID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterIMSession::onChange(EStatusType status, const LLSD& channelInfo, bool proximal)
|
||||
{
|
||||
if(status != STATUS_JOINING && status != STATUS_LEFT_CHANNEL)
|
||||
|
|
|
|||
|
|
@ -159,8 +159,6 @@ private:
|
|||
void sendParticipantsAddedNotification(const uuid_vec_t& uuids);
|
||||
bool canAddSelectedToChat(const uuid_vec_t& uuids);
|
||||
|
||||
void onCallButtonClicked();
|
||||
|
||||
void onVoiceChannelChanged(const LLUUID &session_id);
|
||||
|
||||
void boundVoiceChannel();
|
||||
|
|
|
|||
|
|
@ -302,6 +302,7 @@ bool LLFloaterIMSessionTab::postBuild()
|
|||
mGearBtn = getChild<LLButton>("gear_btn");
|
||||
mAddBtn = getChild<LLButton>("add_btn");
|
||||
mVoiceButton = getChild<LLButton>("voice_call_btn");
|
||||
mVoiceButton->setClickedCallback([this](LLUICtrl*, const LLSD&) { onCallButtonClicked(); });
|
||||
|
||||
mParticipantListPanel = getChild<LLLayoutPanel>("speakers_list_panel");
|
||||
mRightPartPanel = getChild<LLLayoutPanel>("right_part_holder");
|
||||
|
|
@ -434,16 +435,34 @@ void LLFloaterIMSessionTab::draw()
|
|||
|
||||
void LLFloaterIMSessionTab::enableDisableCallBtn()
|
||||
{
|
||||
if (LLVoiceClient::instanceExists() && mVoiceButton)
|
||||
if (!mVoiceButton)
|
||||
return;
|
||||
|
||||
bool enable = false;
|
||||
|
||||
if (mSessionID.notNull() && mSession && mSession->mSessionInitialized && mSession->mCallBackEnabled)
|
||||
{
|
||||
mVoiceButton->setEnabled(
|
||||
mSessionID.notNull()
|
||||
&& mSession
|
||||
&& mSession->mSessionInitialized
|
||||
&& LLVoiceClient::getInstance()->voiceEnabled()
|
||||
&& LLVoiceClient::getInstance()->isVoiceWorking()
|
||||
&& mSession->mCallBackEnabled);
|
||||
if (mVoiceButtonHangUpMode)
|
||||
{
|
||||
// We allow to hang up from any state
|
||||
enable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We allow to start call from this state only
|
||||
if (mSession->mVoiceChannel->getState() == LLVoiceChannel::STATE_NO_CHANNEL_INFO &&
|
||||
LLVoiceClient::instanceExists())
|
||||
{
|
||||
LLVoiceClient* client = LLVoiceClient::getInstance();
|
||||
if (client->voiceEnabled() && client->isVoiceWorking())
|
||||
{
|
||||
enable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mVoiceButton->setEnabled(enable);
|
||||
}
|
||||
|
||||
// virtual
|
||||
|
|
@ -466,6 +485,25 @@ void LLFloaterIMSessionTab::onFocusLost()
|
|||
super::onFocusLost();
|
||||
}
|
||||
|
||||
void LLFloaterIMSessionTab::onCallButtonClicked()
|
||||
{
|
||||
if (mVoiceButtonHangUpMode)
|
||||
{
|
||||
// We allow to hang up from any state
|
||||
gIMMgr->endCall(mSessionID);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLVoiceChannel::EState channel_state = mSession && mSession->mVoiceChannel ?
|
||||
mSession->mVoiceChannel->getState() : LLVoiceChannel::STATE_NO_CHANNEL_INFO;
|
||||
// We allow to start call from this state only
|
||||
if (channel_state == LLVoiceChannel::STATE_NO_CHANNEL_INFO)
|
||||
{
|
||||
gIMMgr->startCall(mSessionID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterIMSessionTab::onInputEditorClicked()
|
||||
{
|
||||
LLFloaterIMContainer* im_box = LLFloaterIMContainer::findInstance();
|
||||
|
|
@ -1040,6 +1078,7 @@ void LLFloaterIMSessionTab::updateCallBtnState(bool callIsActive)
|
|||
{
|
||||
mVoiceButton->setImageOverlay(callIsActive? getString("call_btn_stop") : getString("call_btn_start"));
|
||||
mVoiceButton->setToolTip(callIsActive? getString("end_call_button_tooltip") : getString("start_call_button_tooltip"));
|
||||
mVoiceButtonHangUpMode = callIsActive;
|
||||
|
||||
enableDisableCallBtn();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,6 +198,11 @@ protected:
|
|||
LLButton* mAddBtn;
|
||||
LLButton* mVoiceButton;
|
||||
|
||||
// Since mVoiceButton can work in one of two modes, "Start call" or "Hang up",
|
||||
// (with different images and tooltips depending on the currently chosen mode)
|
||||
// we should track the mode we're currently using to react on click accordingly
|
||||
bool mVoiceButtonHangUpMode { false };
|
||||
|
||||
private:
|
||||
// Handling selection and contextual menu
|
||||
void doToSelected(const LLSD& userdata);
|
||||
|
|
@ -216,6 +221,8 @@ private:
|
|||
*/
|
||||
void reshapeChatLayoutPanel();
|
||||
|
||||
void onCallButtonClicked();
|
||||
|
||||
void onInputEditorClicked();
|
||||
|
||||
void onEmojiRecentPanelToggleBtnClicked();
|
||||
|
|
|
|||
|
|
@ -328,6 +328,16 @@ void LLVoiceChannel::setState(EState state)
|
|||
|
||||
void LLVoiceChannel::doSetState(const EState& new_state)
|
||||
{
|
||||
LL_DEBUGS("Voice") << "session '" << mSessionName << "' state " << mState << ", new_state " << new_state << ": "
|
||||
<< (new_state == STATE_ERROR ? "ERROR" :
|
||||
new_state == STATE_HUNG_UP ? "HUNG_UP" :
|
||||
new_state == STATE_READY ? "READY" :
|
||||
new_state == STATE_CALL_STARTED ? "CALL_STARTED" :
|
||||
new_state == STATE_RINGING ? "RINGING" :
|
||||
new_state == STATE_CONNECTED ? "CONNECTED" :
|
||||
"NO_INFO")
|
||||
<< LL_ENDL;
|
||||
|
||||
EState old_state = mState;
|
||||
mState = new_state;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue