Browse code

acc(k): take r-uri from winning branch for missed call acc

- only if the branch was relayed, otherwise uac struct might be
unfinished due to drop call in config. Use r-uri from uas struct
otherwise
- reported by Juha Henanen

Daniel-Constantin Mierla authored on 19/12/2010 10:56:49
Showing 1 changed files
... ...
@@ -326,13 +326,19 @@ static inline void acc_onreply_in(struct cell *t, struct sip_msg *req,
326 326
 static inline void on_missed(struct cell *t, struct sip_msg *req,
327 327
 											struct sip_msg *reply, int code)
328 328
 {
329
-	str new_uri_bk;
329
+	str new_uri_bk = {0, 0};
330 330
 	int flags_to_reset = 0;
331 331
 
332 332
 	/* set as new_uri the last branch */
333
-	new_uri_bk = req->new_uri;
334
-	req->new_uri = t->uac[t->nr_of_outgoings-1].uri;
335
-	req->parsed_uri_ok = 0;
333
+	if (t->relayed_reply_branch>=0) {
334
+		new_uri_bk = req->new_uri;
335
+		req->new_uri = t->uac[t->relayed_reply_branch].uri;
336
+		req->parsed_uri_ok = 0;
337
+	} else {
338
+		new_uri_bk.len = -1;
339
+		new_uri_bk.s = 0;
340
+	}
341
+
336 342
 	/* set env variables */
337 343
 	env_set_to( get_rpl_to(t,reply) );
338 344
 	env_set_code_status( code, reply);
... ...
@@ -380,8 +386,11 @@ static inline void on_missed(struct cell *t, struct sip_msg *req,
380 386
 	 */
381 387
 	reset_acc_flag( req, flags_to_reset );
382 388
 
383
-	req->new_uri = new_uri_bk;
384
-	req->parsed_uri_ok = 0;
389
+	if (new_uri_bk.len>=0) {
390
+		req->new_uri = new_uri_bk;
391
+		req->parsed_uri_ok = 0;
392
+	}
393
+
385 394
 }
386 395
 
387 396