Browse code

uac_redirect: module compiles now with sr

Daniel-Constantin Mierla authored on 28/05/2009 12:29:24
Showing 1 changed files
... ...
@@ -53,6 +53,7 @@ int get_redirect( struct sip_msg *msg , int maxt, int maxb,
53 53
 	int cts_added;
54 54
 	int n;
55 55
 	int i;
56
+	int first_branch;
56 57
 
57 58
 	/* get transaction */
58 59
 	t = rd_tmb.t_gett();
... ...
@@ -61,14 +62,22 @@ int get_redirect( struct sip_msg *msg , int maxt, int maxb,
61 62
 		LM_CRIT("no current transaction found\n");
62 63
 		goto error;
63 64
 	}
65
+	for(first_branch=t->nr_of_outgoings-1; first_branch>=0; first_branch--)
66
+		if(t->uac[first_branch].flags&TM_UAC_FLAG_FB)
67
+			break;
68
+	if(first_branch<0)
69
+	{
70
+		LM_CRIT("no current first branch found\n");
71
+		goto error;
72
+	}
64 73
 
65
-	LM_DBG("resume branch=%d\n", t->first_branch);
74
+	LM_DBG("resume branch=%d\n", first_branch);
66 75
 
67 76
 	cts_added = 0; /* no contact added */
68 77
 	backup_uri = msg->new_uri; /* shmcontact2dset will ater this value */
69 78
 
70 79
 	/* look if there are any 3xx branches starting from resume_branch */
71
-	for( i=t->first_branch ; i<t->nr_of_outgoings ; i++) {
80
+	for( i=first_branch ; i<t->nr_of_outgoings ; i++) {
72 81
 		LM_DBG("checking branch=%d (added=%d)\n", i, cts_added);
73 82
 		/* is a redirected branch? */
74 83
 		if (t->uac[i].last_received<300 || t->uac[i].last_received>399)
... ...
@@ -264,7 +273,7 @@ static int shmcontact2dset(struct sip_msg *req, struct sip_msg *sh_rpl,
264 273
 	/* add the sortet contacts as branches in dset and log this! */
265 274
 	for ( i=0 ; i<n ; i++ ) {
266 275
 		LM_DBG("adding contact <%.*s>\n", scontacts[i]->uri.len, scontacts[i]->uri.s);
267
-		if (append_branch( 0, &scontacts[i]->uri, 0, 0, sqvalues[i], bflags, 0)<0) {
276
+		if (km_append_branch( 0, &scontacts[i]->uri, 0, 0, sqvalues[i], bflags, 0)<0) {
268 277
 			LM_ERR("failed to add contact to dset\n");
269 278
 		} else {
270 279
 			added++;
... ...
@@ -272,7 +281,7 @@ static int shmcontact2dset(struct sip_msg *req, struct sip_msg *sh_rpl,
272 281
 				/* log the redirect */
273 282
 				req->new_uri =  scontacts[i]->uri;
274 283
 				//FIXME
275
-				rd_acc_fct( req, (char*)reason, acc_db_table, NULL, NULL, NULL, NULL);
284
+				rd_acc_fct( req, (char*)reason, acc_db_table);
276 285
 			}
277 286
 		}
278 287
 	}