Skip to content
Snippets Groups Projects
Commit 2e90d869 authored by Hugo Lefeuvre's avatar Hugo Lefeuvre
Browse files

call state machine: fix SEARCHING state transition


The call state machine expects a two step state transition: the
daemon should first transition to a terminating state, and then to
OVER. This is almost always the case, expect for the SEARCHING state.

In fact this state is a bit special since it does not correspond to
any well defined daemon state. In order to avoid issues resulting
from an invalid SEARCHING -> ENDED transition, add a temporary state
transition to TERMINATING.

Change-Id: I074d9a1beba2e39ef3089733485b57311e834214
Gitlab: #392
Reviewed-by: default avatarSebastien Blin <sebastien.blin@savoirfairelinux.com>
parent fc1d0348
No related branches found
No related tags found
No related merge requests found
...@@ -161,6 +161,29 @@ canSendSIPMessage(const Info& call) { ...@@ -161,6 +161,29 @@ canSendSIPMessage(const Info& call) {
} }
} }
static inline bool
isTerminating(const Status& status) {
switch(status)
{
case call::Status::INVALID:
case call::Status::INACTIVE:
case call::Status::ENDED:
case call::Status::PEER_BUSY:
case call::Status::TIMEOUT:
case call::Status::TERMINATING:
return true;
case call::Status::PAUSED:
case call::Status::IN_PROGRESS:
case call::Status::INCOMING_RINGING:
case call::Status::OUTGOING_RINGING:
case call::Status::CONNECTED:
case call::Status::CONNECTING:
case call::Status::SEARCHING:
default:
return false;
}
}
} // namespace call } // namespace call
} // namespace api } // namespace api
} // namespace lrc } // namespace lrc
...@@ -492,6 +492,13 @@ NewCallModelPimpl::slotCallStateChanged(const std::string& callId, const std::st ...@@ -492,6 +492,13 @@ NewCallModelPimpl::slotCallStateChanged(const std::string& callId, const std::st
auto status = call::to_status(state); auto status = call::to_status(state);
auto& call = calls[callId]; auto& call = calls[callId];
if (status == call::Status::ENDED && !call::isTerminating(call->status)) {
call->status = call::Status::TERMINATING;
emit linked.callStatusChanged(callId);
}
// proper state transition
auto previousStatus = call->status; auto previousStatus = call->status;
call->status = status; call->status = status;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment