Commit d7b9e435 authored by Simon Morlat's avatar Simon Morlat
Browse files

Fix bug causing undesired transition from Paused to StreamsRunning state in...

Fix bug causing undesired transition from Paused to StreamsRunning state in case of incoming UPDATE request.
parent 7f667301
......@@ -325,9 +325,7 @@ static void call_refreshed(SalOp *op) {
return;
}
auto sessionRef = session->getSharedFromThis();
L_GET_PRIVATE(sessionRef)->setState(CallSession::State::UpdatedByRemote, "Session refresh");
L_GET_PRIVATE(sessionRef)->setState(CallSession::State::StreamsRunning, "Session refresh");
L_GET_PRIVATE(sessionRef)->refreshed();
}
/* Used to set the CallSession state to Updating */
......
......@@ -38,6 +38,7 @@ public:
virtual void initializeParamsAccordingToIncomingCallParams ();
void notifyReferState ();
virtual void setState (CallSession::State newState, const std::string &message);
void restorePreviousState();
void setTransferState (CallSession::State newState);
void startIncomingNotification ();
bool startPing ();
......@@ -70,6 +71,7 @@ public:
void updated (bool isUpdate);
void updatedByRemote ();
virtual void updating (bool isUpdate);
virtual void refreshed(); /* Called when an incoming UPDATE is received (for session timers)*/
void setCallSessionListener (CallSessionListener *listener) { this->listener = listener; }
CallSessionListener *getCallSessionListener()const{
......@@ -117,7 +119,9 @@ protected:
std::string subject;
LinphoneCallDir direction = LinphoneCallOutgoing;
CallSession::State state = CallSession::State::Idle;
std::string messageState;
CallSession::State prevState = CallSession::State::Idle;
std::string prevMessageState;
CallSession::State transferState = CallSession::State::Idle;
LinphoneProxyConfig *destProxy = nullptr;
LinphoneErrorInfo *ei = nullptr;
......
......@@ -60,6 +60,10 @@ void CallSessionPrivate::notifyReferState () {
refererOp->notifyReferState(op);
}
void CallSessionPrivate::restorePreviousState(){
setState(prevState, prevMessageState);
}
void CallSessionPrivate::setState (CallSession::State newState, const string &message) {
L_Q();
......@@ -67,6 +71,7 @@ void CallSessionPrivate::setState (CallSession::State newState, const string &me
shared_ptr<CallSession> ref = q->getSharedFromThis();
if (state != newState){
prevState = state;
prevMessageState = messageState;
// Make sanity checks with call state changes. Any bad transition can result in unpredictable results
// or irrecoverable errors in the application.
......@@ -86,6 +91,7 @@ void CallSessionPrivate::setState (CallSession::State newState, const string &me
// CallSession::State::Referred is rather an event, not a state.
// Indeed it does not change the state of the call (still paused or running).
state = newState;
messageState = message;
}
switch (newState) {
......@@ -500,6 +506,13 @@ void CallSessionPrivate::updated (bool isUpdate) {
}
}
void CallSessionPrivate::refreshed() {
/* Briefly notifies the application that we received an UPDATE thanks to UpdatedByRemote state .*/
setState(CallSession::State::UpdatedByRemote, "Session refresh");
/* And immediately get back to previous state, since the actual call state doesn't change.*/
restorePreviousState();
}
void CallSessionPrivate::updatedByRemote () {
L_Q();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment