From 091dc9a76bcec5c8a4bc73e863ed10b1b9d76c92 Mon Sep 17 00:00:00 2001 From: Henning Westerholt Date: Mon, 15 May 2023 13:22:09 +0000 Subject: [PATCH] topos: fix early-dialog b-side UPDATE requests routing (GH #3437) --- src/modules/topos/tps_msg.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/modules/topos/tps_msg.c b/src/modules/topos/tps_msg.c index a19b30dcfc4..a11d544f777 100644 --- a/src/modules/topos/tps_msg.c +++ b/src/modules/topos/tps_msg.c @@ -946,14 +946,22 @@ int tps_request_received(sip_msg_t *msg, int dialog) } } - if(use_branch && direction == TPS_DIR_DOWNSTREAM) { + if(use_branch) { + LM_DBG("use branch for routing information, request from direction %d\n", direction); if(tps_reappend_route(msg, &stsd, &stsd.s_rr, 1) < 0) { LM_ERR("failed to reappend s-route\n"); return -1; } - if(tps_reappend_route(msg, &stsd, &stsd.y_rr, 1) < 0) { - LM_ERR("failed to reappend b-route\n"); - return -1; + if (direction == TPS_DIR_UPSTREAM) { + if(tps_reappend_route(msg, &stsd, &stsd.x_rr, 0) < 0) { + LM_ERR("failed to reappend a-route\n"); + return -1; + } + } else { + if(tps_reappend_route(msg, &stsd, &stsd.y_rr, 1) < 0) { + LM_ERR("failed to reappend b-route\n"); + return -1; + } } } else { if(tps_reappend_route(msg, &stsd, &stsd.s_rr,