Sfoglia il codice sorgente

tm: Fix setting flags for record-route headers

The flags where set in add_uac() by counting the number of record-route
headers added by prepare_new_uac(). The latter function backups and
restores the list of lumps, so add_uac() only sees the original list,
which is not what has happened on the branch being handled.

Moving setting the flags into prepare_new_uac() fixes this.

This fixed the dialog module, which has to remove the correct number
of RR headers from the callee's routeset (which it does based on the
tm flags).
Alex Hermann 11 anni fa
parent
commit
ee9b787095
1 ha cambiato i file con 9 aggiunte e 10 eliminazioni
  1. 9 10
      modules/tm/t_fwd.c

+ 9 - 10
modules/tm/t_fwd.c

@@ -600,6 +600,15 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
 		t->uac[branch].location_ua.s[i_req->location_ua.len]=0;
 		t->uac[branch].location_ua.s[i_req->location_ua.len]=0;
 		memcpy( t->uac[branch].location_ua.s, i_req->location_ua.s, i_req->location_ua.len);
 		memcpy( t->uac[branch].location_ua.s, i_req->location_ua.s, i_req->location_ua.len);
 	}
 	}
+
+#ifdef TM_UAC_FLAGS
+	len = count_applied_lumps(i_req->add_rm, HDR_RECORDROUTE_T);
+	if(len==1)
+		t->uac[branch].flags = TM_UAC_FLAG_RR;
+	else if(len==2)
+		t->uac[branch].flags = TM_UAC_FLAG_RR|TM_UAC_FLAG_R2;
+#endif
+
 	ret=0;
 	ret=0;
 
 
 error01:
 error01:
@@ -806,9 +815,6 @@ int add_uac( struct cell *t, struct sip_msg *request, str *uri,
 
 
 	int ret;
 	int ret;
 	unsigned short branch;
 	unsigned short branch;
-#ifdef TM_UAC_FLAGS
-	unsigned int len;
-#endif /* TM_UAC_FLAGS */
 
 
 	branch=t->nr_of_outgoings;
 	branch=t->nr_of_outgoings;
 	if (branch==sr_dst_max_branches) {
 	if (branch==sr_dst_max_branches) {
@@ -851,13 +857,6 @@ int add_uac( struct cell *t, struct sip_msg *request, str *uri,
 		ser_error=ret;
 		ser_error=ret;
 		goto error01;
 		goto error01;
 	}
 	}
-#ifdef TM_UAC_FLAGS
-	len = count_applied_lumps(request->add_rm, HDR_RECORDROUTE_T);
-	if(len==1)
-		t->uac[branch].flags = TM_UAC_FLAG_RR;
-	else if(len==2)
-		t->uac[branch].flags = TM_UAC_FLAG_RR|TM_UAC_FLAG_R2;
-#endif
 	getbflagsval(0, &t->uac[branch].branch_flags);
 	getbflagsval(0, &t->uac[branch].branch_flags);
 	membar_write(); /* to allow lockless ops (e.g. prepare_to_cancel()) we want
 	membar_write(); /* to allow lockless ops (e.g. prepare_to_cancel()) we want
 					   to be sure everything above is fully written before
 					   to be sure everything above is fully written before