From 4e930fb089555426f8f7e284cebc47c5c8c2d689 Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Mon, 18 Feb 2019 17:06:53 -0500 Subject: [PATCH] FS-11452: [sofia-sip] handle 200/183 w/ sdp receivied out of order quickly --- libs/sofia-sip/.update | 2 +- .../libsofia-sip-ua/nua/nua_session.c | 24 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index e94c5432f4..ec04f46051 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Wed Feb 21 15:29:04 CST 2018 +Mon Feb 18 16:55:02 EST 2019 diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c index d9261324d5..21c3d65af1 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c @@ -940,12 +940,12 @@ static int nua_session_client_response(nua_client_request_t *cr, char const *received = NULL; #define LOG3(m) \ - SU_DEBUG_3(("nua(%p): %s: %s %s in %u %s\n", \ + SU_DEBUG_3(("nua(%p): %s: %s %s in %u %s (%u)\n", \ (void *)nh, cr->cr_method_name, (m), \ - received ? received : "SDP", status, phrase)) + received ? received : "SDP", status, phrase, cr->cr_answer_recv)) #define LOG5(m) \ - SU_DEBUG_5(("nua(%p): %s: %s %s in %u %s\n", \ - (void *)nh, cr->cr_method_name, (m), received, status, phrase)) + SU_DEBUG_5(("nua(%p): %s: %s %s in %u %s (%u)\n", \ + (void *)nh, cr->cr_method_name, (m), received, status, phrase, cr->cr_answer_recv)) retry: @@ -954,12 +954,16 @@ static int nua_session_client_response(nua_client_request_t *cr, else if (!session_get_description(sip, &sdp, &len)) /* No SDP */; else if (cr->cr_answer_recv) { - /* Ignore spurious answers after completing O/A */ - //LOG3("ignoring duplicate"); - //sdp = NULL; - // we need to make sure its *actually* a dup, so we can't assume for now. - cr->cr_answer_recv = 0; - goto retry; + if (cr->cr_answer_recv > status) { + LOG3("status is older than previous answer, ignoring"); + sdp = NULL; + return 0; + } else { + // we need to make sure its *actually* a dup, so we can't assume for now. + LOG3("multiple answers received, processing"); + cr->cr_answer_recv = 0; + goto retry; + } } else if (cr->cr_offer_sent) { /* case 1: answer to our offer */