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

Fixes in call repair handling.

parent 281bac16
......@@ -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){
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");
lc->media_network_reachable=is_media_reachable;
......
......@@ -243,7 +243,7 @@ void linphone_core_notify_configuring_status(LinphoneCore *lc, LinphoneConfiguri
}
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);
cleanup_dead_vtable_refs(lc);
}
......
......@@ -38,7 +38,7 @@ private:
void unsubscribe ();
// CoreListener
void onNetworkReachable (bool reachable) override;
void onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) override;
void onRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const std::string &message) override;
ChatRoomId chatRoomId;
......
......@@ -200,8 +200,8 @@ void RemoteConferenceEventHandlerPrivate::unsubscribe () {
// -----------------------------------------------------------------------------
void RemoteConferenceEventHandlerPrivate::onNetworkReachable (bool reachable) {
if (!reachable)
void RemoteConferenceEventHandlerPrivate::onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) {
if (!sipNetworkReachable)
unsubscribe();
}
......
......@@ -86,10 +86,11 @@ protected:
virtual void terminate ();
virtual void updateCurrentParams () const;
void setBroken ();
void setContactOp ();
// CoreListener
void onNetworkReachable (bool reachable) override;
void onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) override;
void onRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const std::string &message) override;
private:
......
......@@ -379,7 +379,7 @@ void CallSessionPrivate::replaceOp (SalCallOp *newOp) {
switch (oldState) {
case CallSession::State::IncomingEarlyMedia:
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
if (op->get_replaces())
oldOp->terminate();
......@@ -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 () {
L_Q();
SalAddress *salAddress = nullptr;
......@@ -684,37 +713,11 @@ void CallSessionPrivate::setContactOp () {
// -----------------------------------------------------------------------------
void CallSessionPrivate::onNetworkReachable (bool reachable) {
if (reachable) {
void CallSessionPrivate::onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) {
if (sipNetworkReachable)
repairIfBroken();
} else {
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::onNetworkReachable(): unimplemented case";
break;
}
}
else
setBroken();
}
void CallSessionPrivate::onRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const std::string &message) {
......
......@@ -109,7 +109,7 @@ public:
SalMediaDescription *getResultDesc () const { return resultDesc; }
// CoreListener
void onNetworkReachable (bool reachable) override;
void onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) override;
private:
static OrtpJitterBufferAlgorithm jitterBufferNameToAlgo (const std::string &name);
......
......@@ -629,14 +629,16 @@ void MediaSessionPrivate::stopStreams () {
// -----------------------------------------------------------------------------
void MediaSessionPrivate::onNetworkReachable (bool reachable) {
void MediaSessionPrivate::onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) {
L_Q();
if (reachable) {
if (mediaNetworkReachable) {
LinphoneConfig *config = linphone_core_get_config(q->getCore()->getCCore());
if (lp_config_get_int(config, "net", "recreate_sockets_when_network_is_up", 0))
refreshSockets();
} else {
setBroken();
}
CallSessionPrivate::onNetworkReachable(reachable);
CallSessionPrivate::onNetworkReachable(sipNetworkReachable, mediaNetworkReachable);
}
// -----------------------------------------------------------------------------
......
......@@ -30,7 +30,7 @@ class CoreListener {
public:
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) {}
};
......
......@@ -39,7 +39,7 @@ public:
void unregisterListener (CoreListener *listener);
void uninit ();
void notifyNetworkReachable (bool reachable);
void notifyNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable);
void notifyRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const std::string &message);
int addCall (const std::shared_ptr<Call> &call);
......
......@@ -79,9 +79,9 @@ void CorePrivate::uninit () {
// -----------------------------------------------------------------------------
void CorePrivate::notifyNetworkReachable (bool reachable) {
void CorePrivate::notifyNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) {
for (const auto &listener : listeners)
listener->onNetworkReachable(reachable);
listener->onNetworkReachable(sipNetworkReachable, mediaNetworkReachable);
}
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