diff options
author | trilene <trilene@runbox.com> | 2020-07-23 19:38:40 -0400 |
---|---|---|
committer | trilene <trilene@runbox.com> | 2020-07-23 19:38:40 -0400 |
commit | d51e34e66ad5fbce9f79b3d2a1b11fac01ef029e (patch) | |
tree | e371a75481a8211083e243ddea444d2909c0eb1e /src | |
parent | Fix QLayout warning (diff) | |
download | nheko-d51e34e66ad5fbce9f79b3d2a1b11fac01ef029e.tar.xz |
Cancel sent CallInvite if no response within expiry
Diffstat (limited to 'src')
-rw-r--r-- | src/CallManager.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/CallManager.cpp b/src/CallManager.cpp index 37b150b4..c987a58e 100644 --- a/src/CallManager.cpp +++ b/src/CallManager.cpp @@ -41,6 +41,14 @@ CallManager::CallManager(QSharedPointer<UserSettings> userSettings) nhlog::ui()->debug("Offer created with callid_ and roomid_: {} {}", callid_, roomid_.toStdString()); emit newMessage(roomid_, CallInvite{callid_, sdp, 0, timeoutms_}); emit newMessage(roomid_, CallCandidates{callid_, candidates, 0}); + + QTimer::singleShot(timeoutms_, this, [this](){ + if (session_.state() == WebRTCSession::State::OFFERSENT) { + emit newMessage(roomid_, CallHangUp{callid_, 0, CallHangUp::Reason::InviteTimeOut}); + endCall(); + emit ChatPage::instance()->showNotification("The remote side failed to pick up."); + } + }); }); connect(&session_, &WebRTCSession::answerCreated, this, @@ -112,7 +120,6 @@ CallManager::sendInvite(const QString &roomid) setTurnServers(); session_.setStunServer(settings_->useStunServer() ? STUN_SERVER : ""); - // TODO Add invite timeout generateCallID(); std::vector<RoomMember> members(cache::getMembers(roomid.toStdString())); const RoomMember &callee = members.front().user_id == utils::localUser() ? members.back() : members.front(); |