Pārlūkot izejas kodu

topos: do not add contact header in outgoing 1xx responses if not present

- GH #1720
Daniel-Constantin Mierla 6 gadi atpakaļ
vecāks
revīzija
dcf9ee88db
1 mainītis faili ar 9 papildinājumiem un 1 dzēšanām
  1. 9 1
      src/modules/topos/tps_msg.c

+ 9 - 1
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 {