From f56366737cdf6db4346f015232c7f951cb11e145 Mon Sep 17 00:00:00 2001 From: Daniel Grotti Date: Mon, 20 Nov 2023 11:32:04 +0100 Subject: [PATCH] MT#58584 Do not add outbound_proxy in Route if exist When outbound PRACK is challanged, SEMS is regenerating the PRACK to proxy duplicating the proxy socket in the Route header, with the result of: Route: , , , the duplicate "127.0.0.1:5062" is causing routing issue on proxy, cause loose_route() function removes only the first element. Then proxy sends PRACK to itself. To avoid that, we make sure is SEMS to do not add the 'outbound_socket' value in the Route header if that value already exist in the first position. Change-Id: Id310144d8e77a99111e199358462496c9dd0495c --- core/AmBasicSipDialog.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/AmBasicSipDialog.cpp b/core/AmBasicSipDialog.cpp index 4e66b021..5a68786b 100644 --- a/core/AmBasicSipDialog.cpp +++ b/core/AmBasicSipDialog.cpp @@ -129,8 +129,17 @@ string AmBasicSipDialog::getContactUri() string AmBasicSipDialog::getRoute() { string res; + string route_first_element; - if(!outbound_proxy.empty() && (force_outbound_proxy || remote_tag.empty())){ + if (!route.empty()) { + route_first_element = route.substr(0, route.find(',')); + } + + // Do no add outbound_proxy if it's already the top most Route + if(!outbound_proxy.empty() && + (force_outbound_proxy || remote_tag.empty()) && + route_first_element.find(outbound_proxy) == std::string::npos) + { res += "<" + outbound_proxy + ";lr>"; if(!route.empty()) {