From 5afd60db9162600ef1314fdb01f3a2e84b6c2449 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Mon, 19 Jan 2026 14:06:15 +0100 Subject: [PATCH] MT#59962 core: on receive don't run body checks if it's empty If there is no SDP body makes no sense to run checks on that. Change-Id: If7b77335fb7941a867a7efff34e56e3a26c7ad53 --- apps/sbc/SBCCallLeg.cpp | 33 ++++++++++++++++----------------- core/AmB2BSession.cpp | 3 ++- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/apps/sbc/SBCCallLeg.cpp b/apps/sbc/SBCCallLeg.cpp index 6c025a23..dace691e 100644 --- a/apps/sbc/SBCCallLeg.cpp +++ b/apps/sbc/SBCCallLeg.cpp @@ -933,15 +933,14 @@ void SBCCallLeg::process(AmEvent* ev) { void SBCCallLeg::onInitialRelayBody(AmMimeBody& body, const string& method) { - - // when INVITE was processed first, stuff was not setup, so do again - onRxRelayBody(body, method, true); - /* ct length 0 means: it was parsed, but indeed it turned out body was empty */ if (body.getCTLength() == 0) { - ILOG_DLG(L_DBG, "Skip filtering SDP body, because Content-Length is zero.\n"); + ILOG_DLG(L_DBG, "Body is empty, nothing to do.\n"); } else { + // when INVITE was processed first, stuff was not setup, so do again + onRxRelayBody(body, method, true); + int res = onBeforeB2BRelayBody(body, method); if (res < 0) { // FIXME: quick hack, throw the exception from the filtering function for @@ -973,10 +972,9 @@ void SBCCallLeg::onInvite(const AmSipRequest& req) // fix up module names for (CCInterfaceListIteratorT cc_it=call_profile.cc_interfaces.begin(); - cc_it != call_profile.cc_interfaces.end(); cc_it++) { - - cc_it->cc_module = - ctx.replaceParameters(cc_it->cc_module, "cc_module", req); + cc_it != call_profile.cc_interfaces.end(); cc_it++) + { + cc_it->cc_module = ctx.replaceParameters(cc_it->cc_module, "cc_module", req); } if (!getCCInterfaces()) { @@ -993,16 +991,15 @@ void SBCCallLeg::onInvite(const AmSipRequest& req) } } - call_profile.sst_aleg_enabled = - ctx.replaceParameters(call_profile.sst_aleg_enabled, - "enable_aleg_session_timer", req); + call_profile.sst_aleg_enabled = ctx.replaceParameters(call_profile.sst_aleg_enabled, + "enable_aleg_session_timer", req); - call_profile.sst_enabled = ctx.replaceParameters(call_profile.sst_enabled, - "enable_session_timer", req); + call_profile.sst_enabled = ctx.replaceParameters(call_profile.sst_enabled, + "enable_session_timer", req); if ((call_profile.sst_aleg_enabled == "yes") && - (call_profile.sst_enabled == "yes")) { - + (call_profile.sst_enabled == "yes")) + { call_profile.eval_sst_config(ctx,req,call_profile.sst_a_cfg); if(applySSTCfg(call_profile.sst_a_cfg,&req) < 0) { throw AmSession::Exception(500, SIP_REPLY_SERVER_INTERNAL_ERROR); @@ -1026,6 +1023,7 @@ void SBCCallLeg::onInvite(const AmSipRequest& req) string ruri, to, from; AmSipRequest uac_req(req); AmUriParser uac_ruri; + uac_ruri.uri = uac_req.r_uri; if(!uac_ruri.parse_uri()) { ILOG_DLG(L_DBG, "Error parsing R-URI '%s'\n",uac_ruri.uri.c_str()); @@ -1118,7 +1116,8 @@ void SBCCallLeg::onInvite(const AmSipRequest& req) // call extend call controls InitialInviteHandlerParams params(to, ruri, from, &req, &invite_req); - for (vector::iterator i = cc_ext.begin(); i != cc_ext.end(); ++i) { + for (vector::iterator i = cc_ext.begin(); i != cc_ext.end(); ++i) + { (*i)->onInitialInvite(this, params); // initialize possibily added modules initPendingCCExtModules(); diff --git a/core/AmB2BSession.cpp b/core/AmB2BSession.cpp index 617273f5..30d248ed 100644 --- a/core/AmB2BSession.cpp +++ b/core/AmB2BSession.cpp @@ -834,7 +834,8 @@ void AmB2BSession::onRxRelayBody(AmMimeBody& body, const string& method, bool is_offer) { AmMimeBody* sdp_body = body.hasContentType(SIP_APPLICATION_SDP); - if (!sdp_body) + + if (!sdp_body || sdp_body->getCTLength() == -1 || !sdp_body->getCTLength()) return; // filter body for given methods only