Commit 6fab7844 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Fixes in call repair handling.

parent 281bac16
...@@ -6125,6 +6125,8 @@ static void set_sip_network_reachable(LinphoneCore* lc,bool_t is_sip_reachable, ...@@ -6125,6 +6125,8 @@ static void set_sip_network_reachable(LinphoneCore* lc,bool_t is_sip_reachable,
static void set_media_network_reachable(LinphoneCore* lc, bool_t is_media_reachable){ static void set_media_network_reachable(LinphoneCore* lc, bool_t is_media_reachable){
if (lc->media_network_reachable==is_media_reachable) return; // no change, ignore. if (lc->media_network_reachable==is_media_reachable) return; // no change, ignore.
lc->network_reachable_to_be_notified=TRUE;
ms_message("Media network reachability state is now [%s]",is_media_reachable?"UP":"DOWN"); ms_message("Media network reachability state is now [%s]",is_media_reachable?"UP":"DOWN");
lc->media_network_reachable=is_media_reachable; lc->media_network_reachable=is_media_reachable;
......
...@@ -243,7 +243,7 @@ void linphone_core_notify_configuring_status(LinphoneCore *lc, LinphoneConfiguri ...@@ -243,7 +243,7 @@ void linphone_core_notify_configuring_status(LinphoneCore *lc, LinphoneConfiguri
} }
void linphone_core_notify_network_reachable(LinphoneCore *lc, bool_t reachable) { void linphone_core_notify_network_reachable(LinphoneCore *lc, bool_t reachable) {
L_GET_PRIVATE_FROM_C_OBJECT(lc)->notifyNetworkReachable(!!reachable); L_GET_PRIVATE_FROM_C_OBJECT(lc)->notifyNetworkReachable(!!lc->sip_network_reachable, lc->media_network_reachable);
NOTIFY_IF_EXIST(network_reachable, lc,reachable); NOTIFY_IF_EXIST(network_reachable, lc,reachable);
cleanup_dead_vtable_refs(lc); cleanup_dead_vtable_refs(lc);
} }
......
...@@ -38,7 +38,7 @@ private: ...@@ -38,7 +38,7 @@ private:
void unsubscribe (); void unsubscribe ();
// CoreListener // CoreListener
void onNetworkReachable (bool reachable) override; void onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) override;
void onRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const std::string &message) override; void onRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const std::string &message) override;
ChatRoomId chatRoomId; ChatRoomId chatRoomId;
......
...@@ -200,8 +200,8 @@ void RemoteConferenceEventHandlerPrivate::unsubscribe () { ...@@ -200,8 +200,8 @@ void RemoteConferenceEventHandlerPrivate::unsubscribe () {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void RemoteConferenceEventHandlerPrivate::onNetworkReachable (bool reachable) { void RemoteConferenceEventHandlerPrivate::onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) {
if (!reachable) if (!sipNetworkReachable)
unsubscribe(); unsubscribe();
} }
......
...@@ -86,10 +86,11 @@ protected: ...@@ -86,10 +86,11 @@ protected:
virtual void terminate (); virtual void terminate ();
virtual void updateCurrentParams () const; virtual void updateCurrentParams () const;
void setBroken ();
void setContactOp (); void setContactOp ();
// CoreListener // CoreListener
void onNetworkReachable (bool reachable) override; void onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) override;
void onRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const std::string &message) override; void onRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const std::string &message) override;
private: private:
......
...@@ -379,7 +379,7 @@ void CallSessionPrivate::replaceOp (SalCallOp *newOp) { ...@@ -379,7 +379,7 @@ void CallSessionPrivate::replaceOp (SalCallOp *newOp) {
switch (oldState) { switch (oldState) {
case CallSession::State::IncomingEarlyMedia: case CallSession::State::IncomingEarlyMedia:
case CallSession::State::IncomingReceived: case CallSession::State::IncomingReceived:
op->set_user_pointer(nullptr); // In order for the call session to not get terminated by terminating this op oldOp->set_user_pointer(nullptr); // In order for the call session to not get terminated by terminating this op
// Do not terminate a forked INVITE // Do not terminate a forked INVITE
if (op->get_replaces()) if (op->get_replaces())
oldOp->terminate(); oldOp->terminate();
...@@ -668,6 +668,35 @@ void CallSessionPrivate::updateCurrentParams () const {} ...@@ -668,6 +668,35 @@ void CallSessionPrivate::updateCurrentParams () const {}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void CallSessionPrivate::setBroken () {
switch (state) {
// For all the early states, we prefer to drop the call
case CallSession::State::OutgoingInit:
case CallSession::State::OutgoingProgress:
case CallSession::State::OutgoingRinging:
case CallSession::State::OutgoingEarlyMedia:
case CallSession::State::IncomingReceived:
case CallSession::State::IncomingEarlyMedia:
// During the early states, the SAL layer reports the failure from the dialog or transaction layer,
// hence, there is nothing special to do
case CallSession::State::StreamsRunning:
case CallSession::State::Updating:
case CallSession::State::Pausing:
case CallSession::State::Resuming:
case CallSession::State::Paused:
case CallSession::State::PausedByRemote:
case CallSession::State::UpdatedByRemote:
// During these states, the dialog is established. A failure of a transaction is not expected to close it.
// Instead we have to repair the dialog by sending a reINVITE
broken = true;
needLocalIpRefresh = true;
break;
default:
lError() << "CallSessionPrivate::setBroken(): unimplemented case";
break;
}
}
void CallSessionPrivate::setContactOp () { void CallSessionPrivate::setContactOp () {
L_Q(); L_Q();
SalAddress *salAddress = nullptr; SalAddress *salAddress = nullptr;
...@@ -684,37 +713,11 @@ void CallSessionPrivate::setContactOp () { ...@@ -684,37 +713,11 @@ void CallSessionPrivate::setContactOp () {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void CallSessionPrivate::onNetworkReachable (bool reachable) { void CallSessionPrivate::onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) {
if (reachable) { if (sipNetworkReachable)
repairIfBroken(); repairIfBroken();
} else { else
switch(state) { setBroken();
// For all the early states, we prefer to drop the call
case CallSession::State::OutgoingInit:
case CallSession::State::OutgoingProgress:
case CallSession::State::OutgoingRinging:
case CallSession::State::OutgoingEarlyMedia:
case CallSession::State::IncomingReceived:
case CallSession::State::IncomingEarlyMedia:
// During the early states, the SAL layer reports the failure from the dialog or transaction layer,
// hence, there is nothing special to do
case CallSession::State::StreamsRunning:
case CallSession::State::Updating:
case CallSession::State::Pausing:
case CallSession::State::Resuming:
case CallSession::State::Paused:
case CallSession::State::PausedByRemote:
case CallSession::State::UpdatedByRemote:
// During these states, the dialog is established. A failure of a transaction is not expected to close it.
// Instead we have to repair the dialog by sending a reINVITE
broken = true;
needLocalIpRefresh = true;
break;
default:
lError() << "CallSessionPrivate::onNetworkReachable(): unimplemented case";
break;
}
}
} }
void CallSessionPrivate::onRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const std::string &message) { void CallSessionPrivate::onRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const std::string &message) {
......
...@@ -109,7 +109,7 @@ public: ...@@ -109,7 +109,7 @@ public:
SalMediaDescription *getResultDesc () const { return resultDesc; } SalMediaDescription *getResultDesc () const { return resultDesc; }
// CoreListener // CoreListener
void onNetworkReachable (bool reachable) override; void onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) override;
private: private:
static OrtpJitterBufferAlgorithm jitterBufferNameToAlgo (const std::string &name); static OrtpJitterBufferAlgorithm jitterBufferNameToAlgo (const std::string &name);
......
...@@ -629,14 +629,16 @@ void MediaSessionPrivate::stopStreams () { ...@@ -629,14 +629,16 @@ void MediaSessionPrivate::stopStreams () {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void MediaSessionPrivate::onNetworkReachable (bool reachable) { void MediaSessionPrivate::onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) {
L_Q(); L_Q();
if (reachable) { if (mediaNetworkReachable) {
LinphoneConfig *config = linphone_core_get_config(q->getCore()->getCCore()); LinphoneConfig *config = linphone_core_get_config(q->getCore()->getCCore());
if (lp_config_get_int(config, "net", "recreate_sockets_when_network_is_up", 0)) if (lp_config_get_int(config, "net", "recreate_sockets_when_network_is_up", 0))
refreshSockets(); refreshSockets();
} else {
setBroken();
} }
CallSessionPrivate::onNetworkReachable(reachable); CallSessionPrivate::onNetworkReachable(sipNetworkReachable, mediaNetworkReachable);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
...@@ -30,7 +30,7 @@ class CoreListener { ...@@ -30,7 +30,7 @@ class CoreListener {
public: public:
virtual ~CoreListener () = default; virtual ~CoreListener () = default;
virtual void onNetworkReachable (bool reachable) {} virtual void onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) {}
virtual void onRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const std::string &message) {} virtual void onRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const std::string &message) {}
}; };
......
...@@ -39,7 +39,7 @@ public: ...@@ -39,7 +39,7 @@ public:
void unregisterListener (CoreListener *listener); void unregisterListener (CoreListener *listener);
void uninit (); void uninit ();
void notifyNetworkReachable (bool reachable); void notifyNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable);
void notifyRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const std::string &message); void notifyRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const std::string &message);
int addCall (const std::shared_ptr<Call> &call); int addCall (const std::shared_ptr<Call> &call);
......
...@@ -79,9 +79,9 @@ void CorePrivate::uninit () { ...@@ -79,9 +79,9 @@ void CorePrivate::uninit () {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void CorePrivate::notifyNetworkReachable (bool reachable) { void CorePrivate::notifyNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) {
for (const auto &listener : listeners) for (const auto &listener : listeners)
listener->onNetworkReachable(reachable); listener->onNetworkReachable(sipNetworkReachable, mediaNetworkReachable);
} }
void CorePrivate::notifyRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const string &message) { void CorePrivate::notifyRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const string &message) {
......
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