From dcf9ee88dbf68eeaf0f64d203ce831eb6f536a85 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Wed, 21 Nov 2018 10:42:02 +0100 Subject: [PATCH] topos: do not add contact header in outgoing 1xx responses if not present - GH #1720 --- src/modules/topos/tps_msg.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/topos/tps_msg.c b/src/modules/topos/tps_msg.c index b3498652620..98806502908 100644 --- a/src/modules/topos/tps_msg.c +++ b/src/modules/topos/tps_msg.c @@ -1029,6 +1029,7 @@ int tps_response_sent(sip_msg_t *msg) str lkey; uint32_t direction = TPS_DIR_UPSTREAM; str xvbranch = {0, 0}; + int contact_keep = 0; LM_DBG("handling outgoing response\n"); @@ -1078,8 +1079,15 @@ int tps_response_sent(sip_msg_t *msg) /* keep contact without updates for redirect responses sent out */ if(msg->first_line.u.reply.statuscode<300 || msg->first_line.u.reply.statuscode>=400) { + contact_keep = 1; + } + if(contact_keep==0 && msg->first_line.u.reply.statuscode>100 + && msg->first_line.u.reply.statuscode<200 + && msg->contact==NULL) { + contact_keep = 1; + } + if(contact_keep==0) { tps_remove_headers(msg, HDR_CONTACT_T); - if(direction==TPS_DIR_DOWNSTREAM) { tps_reinsert_contact(msg, &stsd, &stsd.as_contact); } else {