From d45dcf1ecf81894a4cf42520af4ba6fdcc925b1f Mon Sep 17 00:00:00 2001 From: Marco Capetta Date: Thu, 29 Dec 2022 10:14:21 +0100 Subject: [PATCH] MT#55831 Fix issue if an UPDATE is received after 183 If an SDP UPDATE is received after the 183, but before the 200, SEMS fails when it receive the final ACK. In fact SEMS tries to find the SDP content inside the ACK message itself. The solution is copied from sems-pbx module where the issue doesn't happen. (real ticket number: TT#43503) Change-Id: I5a432dc57c701d7eb0d5306d6005508e3310e7ba --- apps/sbc/CallLeg.cpp | 10 ++++++++-- core/AmOfferAnswer.cpp | 7 ++++--- core/AmOfferAnswer.h | 6 ++++++ core/AmSipDialog.h | 4 ++++ 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/apps/sbc/CallLeg.cpp b/apps/sbc/CallLeg.cpp index 8c04d1c8..fa6716e9 100644 --- a/apps/sbc/CallLeg.cpp +++ b/apps/sbc/CallLeg.cpp @@ -197,7 +197,10 @@ CallLeg::CallLeg(const CallLeg* caller, AmSipDialog* p_dlg, AmSipSubscription* p set_sip_relay_only(false); // will be changed later on (for now we have no peer so we can't relay) // enable OA for the purpose of hold request detection - if (dlg) dlg->setOAEnabled(true); + if (dlg) { + dlg->setOAEnabled(true); + dlg->setOAForceSDP(false); + } else WARN("can't enable OA!\n"); // code below taken from createCalleeSession @@ -259,7 +262,10 @@ CallLeg::CallLeg(AmSipDialog* p_dlg, AmSipSubscription* p_subs) set_sip_relay_only(false); // enable OA for the purpose of hold request detection - if (dlg) dlg->setOAEnabled(true); + if (dlg) { + dlg->setOAEnabled(true); + dlg->setOAForceSDP(false); + } else WARN("can't enable OA!\n"); } diff --git a/core/AmOfferAnswer.cpp b/core/AmOfferAnswer.cpp index 98a80b72..58b9a879 100644 --- a/core/AmOfferAnswer.cpp +++ b/core/AmOfferAnswer.cpp @@ -53,7 +53,8 @@ AmOfferAnswer::AmOfferAnswer(AmSipDialog* dlg) cseq(0), sdp_remote(), sdp_local(), - dlg(dlg) + dlg(dlg), + force_sdp(true) { } @@ -322,7 +323,7 @@ int AmOfferAnswer::onRequestOut(AmSipRequest& req) sdp_buf.length()); has_sdp = true; } - else { + else if(force_sdp) { return -1; } } else if (sdp_body && has_sdp) { @@ -395,7 +396,7 @@ int AmOfferAnswer::onReplyOut(AmSipReply& reply) else if (reply.code == 200 && reply.cseq_method == SIP_METH_INVITE && state == OA_Completed) { // just ignore if no SDP is generated (required for B2B) } - else return -1; + else if(force_sdp) return -1; } else { if(!sdp_body){ diff --git a/core/AmOfferAnswer.h b/core/AmOfferAnswer.h index 64f942bc..f1f3abf3 100644 --- a/core/AmOfferAnswer.h +++ b/core/AmOfferAnswer.h @@ -53,6 +53,9 @@ private: AmSipDialog* dlg; + /** Should SDP generation be forced when not required by standards? */ + bool force_sdp; + /** State maintenance */ void saveState(); int checkStateChange(); @@ -75,6 +78,9 @@ public: void clear(); void clearTransitionalState(); + void setForceSDP(bool force) { force_sdp = force; } + bool getForceSDP() const { return force_sdp; } + /** Event handlers */ int onRequestIn(const AmSipRequest& req); int onReplyIn(const AmSipReply& reply); diff --git a/core/AmSipDialog.h b/core/AmSipDialog.h index 887940de..79d732c8 100644 --- a/core/AmSipDialog.h +++ b/core/AmSipDialog.h @@ -95,6 +95,10 @@ protected: AmOfferAnswer::OAState getOAState(); void setOAState(AmOfferAnswer::OAState n_st); void setOAEnabled(bool oa_enabled); + + void setOAForceSDP(bool force) { oa.setForceSDP(force); } + bool getOAForceSDP() const { return oa.getForceSDP(); } + const AmSdp& getLocalSdp() { return oa.getLocalSdp(); } const AmSdp& getRemoteSdp() { return oa.getRemoteSdp(); }