Browse code

dialog: parse all headers before getting the message attributes for dialog

- some headers can appear many times

Daniel-Constantin Mierla authored on 07/11/2017 09:53:05
Showing 1 changed files
... ...
@@ -189,6 +189,11 @@ int populate_leg_info( struct dlg_cell *dlg, struct sip_msg *msg,
189 189
 	str contact;
190 190
 	str rr_set;
191 191
 
192
+	if(parse_headers(msg,HDR_EOH_F,0)<0){
193
+		LM_ERR("failed to parse headers\n");
194
+		goto error0;
195
+	}
196
+
192 197
 	dlg->bind_addr[leg] = msg->rcv.bind_address;
193 198
 
194 199
 	/* extract the cseq number as string */
... ...
@@ -210,19 +215,14 @@ int populate_leg_info( struct dlg_cell *dlg, struct sip_msg *msg,
210 210
 		goto error0;
211 211
 	}
212 212
 	if ( parse_contact(msg->contact)<0 ||
213
-	((contact_body_t *)msg->contact->parsed)->contacts==NULL ||
214
-	((contact_body_t *)msg->contact->parsed)->contacts->next!=NULL ) {
213
+			((contact_body_t *)msg->contact->parsed)->contacts==NULL ||
214
+			((contact_body_t *)msg->contact->parsed)->contacts->next!=NULL ) {
215 215
 		LM_ERR("bad Contact HDR\n");
216 216
 		goto error0;
217 217
 	}
218 218
 	contact = ((contact_body_t *)msg->contact->parsed)->contacts->uri;
219 219
 
220
-	/* extract the RR parts */
221
-	if(!msg->record_route && (parse_headers(msg,HDR_EOH_F,0)<0)  ){
222
-		LM_ERR("failed to parse record route header\n");
223
-		goto error0;
224
-	}
225
-
220
+	/* extract the record-route addresses */
226 221
 	if (leg==DLG_CALLER_LEG) {
227 222
 		skip_recs = 0;
228 223
 	} else {