From 14ad7f85f6724fce5ef7724ff56583b63ce4277f Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Mon, 20 Feb 2023 16:31:00 +0100 Subject: [PATCH] MT#56321 Use the P-DSM-App instead of the P-Early-Announce Since the P-Early-Announce has gotten deprecated, it's required to stop using it. And instead start using the P-DSM-App header, which now carries the same information as parameter ';early-annonce='. Change-Id: I7f0f378143d0b6600a239084cd51935a31df3d08 --- apps/sbc/CallLeg.cpp | 11 +++++++---- core/AmB2BSession.cpp | 9 +++++---- core/AmSipDialog.cpp | 11 ++++++----- core/AmSipDialog.h | 2 +- core/sip/defs.h | 1 - 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/apps/sbc/CallLeg.cpp b/apps/sbc/CallLeg.cpp index 86927a03..b8c48842 100644 --- a/apps/sbc/CallLeg.cpp +++ b/apps/sbc/CallLeg.cpp @@ -552,16 +552,19 @@ void CallLeg::onInitialReply(B2BSipReplyEvent *e) { /* 100-199 */ if (e->reply.code < 200) { - string announce = getHeader(e->reply.hdrs, SIP_HDR_P_EARLY_ANNOUNCE); - dlg->setForcedEarlyAnnounce(announce.find("force") != std::string::npos); + string announce = getHeader(e->reply.hdrs, SIP_HDR_P_DSM_APP); + string p_dsm_app_param = get_header_param(announce, "early-announce"); + dlg->setForcedEarlyAnnounce(p_dsm_app_param == "force"); - /* exceptionally treat 183 with the 'P-Early-Announce: force', + /* exceptionally treat 183 with the 'P-DSM-App: ;early-announce=force', similarly to the 200OK response, this will properly update the caller with the late SDP capabilities (an early announcement), which has been put on hold during the transfer DSM applications using it: - - early_dbprompt (early_announce) */ + - early_dbprompt (early_announce) + - pre_announce + - play_last_caller */ if (e->reply.code == 183 && !announce.empty() && dlg->getForcedEarlyAnnounce()) { b2bInitial2xx(e->reply, e->forward); } else { diff --git a/core/AmB2BSession.cpp b/core/AmB2BSession.cpp index 1bb850c2..cdfe4d9e 100644 --- a/core/AmB2BSession.cpp +++ b/core/AmB2BSession.cpp @@ -292,10 +292,11 @@ void AmB2BSession::onB2BEvent(B2BEvent* ev) } else { - /* ensure that 'P-Early-Announce: force' is not present */ + /* ensure that 'P-DSM-App: ;early-announce=force' is not present */ if (reply_ev->reply.code == 183 && !dlg->getForcedEarlyAnnounce()) { - string announce = getHeader(reply_ev->reply.hdrs, SIP_HDR_P_EARLY_ANNOUNCE); - dlg->setForcedEarlyAnnounce(announce.find("force") != std::string::npos); + string announce = getHeader(reply_ev->reply.hdrs, SIP_HDR_P_DSM_APP); + string p_dsm_app_param = get_header_param(announce, "early-announce"); + dlg->setForcedEarlyAnnounce(p_dsm_app_param == "force"); } /* don't forget to reset the force_early_announce, if 200 OK in the same leg received */ @@ -334,7 +335,7 @@ void AmB2BSession::onB2BEvent(B2BEvent* ev) if (dlg->getUACInvTransPending()) { DBG("changed session, but UAC INVITE trans pending\n"); } else { - DBG("Received 183 with P-Early-Announce: force, refreshing media session.\n"); + DBG("Received 183 with <;early-announce=force>, refreshing media session.\n"); setMute(true); AmMediaProcessor::instance()->removeSession(this); diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp index 2f9fe60f..6e37fe7c 100644 --- a/core/AmSipDialog.cpp +++ b/core/AmSipDialog.cpp @@ -407,8 +407,9 @@ bool AmSipDialog::onRxReplyStatus(const AmSipReply& reply) /* 100-199 */ if (reply.code < 200) { - string announce = getHeader(reply.hdrs, SIP_HDR_P_EARLY_ANNOUNCE, true); - setForcedEarlyAnnounce(announce.find("force") != std::string::npos); + string announce = getHeader(reply.hdrs, SIP_HDR_P_DSM_APP, true); + string p_dsm_app_param = get_header_param(announce, "early-announce"); + setForcedEarlyAnnounce(p_dsm_app_param == "force"); /* we should always keep Route set for this leg updated in case the provisional response updates the list of routes for any reason */ @@ -418,7 +419,7 @@ bool AmSipDialog::onRxReplyStatus(const AmSipReply& reply) setRouteSet(reply.route); } - /* exceptionally treat 183 with the 'P-Early-Announce: force', + /* exceptionally treat 183 with the 'P-DSM-App: ;early-announce=force', similarly to the 200OK response, this will properly update the caller with the late SDP capabilities (an early announcement), which has been put on hold during the transfer @@ -429,7 +430,7 @@ bool AmSipDialog::onRxReplyStatus(const AmSipReply& reply) - early_dbprompt (early_announce) - pre_announce */ if (reply.code == 183 && !announce.empty() && getForcedEarlyAnnounce()) { - DBG("This is 183 with , treated exceptionally as 200OK.\n"); + DBG("This is 183 with <;early-announce=force>, treated exceptionally as 200OK.\n"); setStatus(Connected); setFaked183As200(true); /* remember that this is a faked 200OK, indeed 183 */ @@ -510,7 +511,7 @@ bool AmSipDialog::onRxReplyStatus(const AmSipReply& reply) bool cont = true; - /* For those exceptional 183 with the 'P-Early-Announce: force' + /* For those exceptional 183 with the 'P-DSM-App: ;early-announce=force' we don't want to fully imitate 200OK processing, and send ACK further processing with ACK is only applied to real 200OK responses */ if ( (reply.code >= 200) && (reply.code < 300) && diff --git a/core/AmSipDialog.h b/core/AmSipDialog.h index 9efe3502..3f85288e 100644 --- a/core/AmSipDialog.h +++ b/core/AmSipDialog.h @@ -59,7 +59,7 @@ protected: // Reliable provisional reply support Am100rel rel100; - /* Needed to properly handle 183->200OK faking, when 'P-Early-Announce: force' + /* Needed to properly handle 183->200OK faking, when 'P-DSM-App: ;early-announce=force' * is added into 183, and we have to treat 183 similarly to 200OK. * Means, we have to embed the early media into already established media session. */ diff --git a/core/sip/defs.h b/core/sip/defs.h index f85b0f5a..d1186d1c 100644 --- a/core/sip/defs.h +++ b/core/sip/defs.h @@ -54,7 +54,6 @@ #define SIP_HDR_EVENT "Event" #define SIP_HDR_SUBSCRIPTION_STATE "Subscription-State" #define SIP_HDR_REPLACES "Replaces" -#define SIP_HDR_P_EARLY_ANNOUNCE "P-Early-Announce" #define SIP_HDR_P_DSM_APP "P-DSM-App" #define SIP_HDR_COL(_hdr) _hdr ":"