Module: kamailio
Branch: master
Commit: dcf9ee88dbf68eeaf0f64d203ce831eb6f536a85
URL:
https://github.com/kamailio/kamailio/commit/dcf9ee88dbf68eeaf0f64d203ce831e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-11-21T10:42:02+01:00
topos: do not add contact header in outgoing 1xx responses if not present
- GH #1720
---
Modified: src/modules/topos/tps_msg.c
---
Diff:
https://github.com/kamailio/kamailio/commit/dcf9ee88dbf68eeaf0f64d203ce831e…
Patch:
https://github.com/kamailio/kamailio/commit/dcf9ee88dbf68eeaf0f64d203ce831e…
---
diff --git a/src/modules/topos/tps_msg.c b/src/modules/topos/tps_msg.c
index b349865262..9880650290 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 {