From b631c8f397e59c586c7a5cf5b8021b38c0063468 Mon Sep 17 00:00:00 2001
From: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
Date: Sat, 3 Sep 2016 21:07:15 -0400
Subject: [PATCH] sips: fix bad ended call when hangup

When SIPS transport receives a BYE sip method,
the TLS connection is also closed at mostly the same moment.
But the handling of the BYE causes PJSIP trying to also send
an acknowledgement to this BYE. As the send cannot succeed
as the TLS session is closed and as the send return an error
in such case, PSIP ends the current INVITE by an error
and not by a success as it should do to process the BYE.
This patch fixes this problem by queueing PJSIP msg when
the TLS session is disconnected.

Change-Id: I416c1e98a8934bd794a654358c50f58141c76bac
Tuleap: #998
---
 src/ringdht/sips_transport_ice.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ringdht/sips_transport_ice.cpp b/src/ringdht/sips_transport_ice.cpp
index 37695447b2..d273e578d3 100644
--- a/src/ringdht/sips_transport_ice.cpp
+++ b/src/ringdht/sips_transport_ice.cpp
@@ -482,7 +482,7 @@ SipsIceTransport::updateTransportState(pjsip_transport_state state)
     bool connected = state == PJSIP_TP_STATE_CONNECTED;
     {
         std::lock_guard<std::mutex> lk {txMutex_};
-        syncTx_ = true;
+        syncTx_ = connected;
     }
     getInfo(&ev.ssl_info, connected);
     if (connected)
-- 
GitLab