Browse code

- bug fixed: q value is also pushed into branches in order to allow serial forking. Based on an original patch from Michael Samuel <michael.samuel@ipsystems.com.au>

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@855 689a6050-402a-0410-94f2-e92a70836424

Bogdan-Andrei Iancu authored on 24/05/2006 09:43:42
Showing 1 changed files
... ...
@@ -23,6 +23,7 @@
23 23
  * History:
24 24
  * ---------
25 25
  *  2005-06-22  first version (bogdan)
26
+ *  2006-05-23  push also q value into branches (bogdan)
26 27
  */
27 28
 
28 29
 
... ...
@@ -109,9 +110,9 @@ error:
109 110
 
110 111
 
111 112
 /* returns the number of contacts put in the sorted array */
112
-static int sort_contacts(contact_t *ct_list, contact_t **ct_array)
113
+static int sort_contacts(contact_t *ct_list, contact_t **ct_array,
114
+														qvalue_t *q_array)
113 115
 {
114
-	static qvalue_t q_array[MAX_CONTACTS_PER_REPLY];
115 116
 	param_t *q_para;
116 117
 	qvalue_t q;
117 118
 	int n;
... ...
@@ -176,6 +177,7 @@ static int shmcontact2dset(struct sip_msg *req, struct sip_msg *sh_rpl,
176 177
 {
177 178
 	static struct sip_msg  dup_rpl;
178 179
 	static contact_t *scontacts[MAX_CONTACTS_PER_REPLY];
180
+	static qvalue_t  sqvalues[MAX_CONTACTS_PER_REPLY];
179 181
 	struct hdr_field *hdr;
180 182
 	struct hdr_field *contact_hdr;
181 183
 	contact_t        *contacts;
... ...
@@ -257,7 +259,7 @@ static int shmcontact2dset(struct sip_msg *req, struct sip_msg *sh_rpl,
257 259
 			"has no contacts\n");
258 260
 		goto restore;
259 261
 	}
260
-	n = sort_contacts( contacts, scontacts);
262
+	n = sort_contacts( contacts, scontacts, sqvalues);
261 263
 
262 264
 	/* to many branches ? */
263 265
 	if (max!=-1 && n>max)
... ...
@@ -269,7 +271,7 @@ static int shmcontact2dset(struct sip_msg *req, struct sip_msg *sh_rpl,
269 271
 	for ( i=0 ; i<n ; i++ ) {
270 272
 		DBG("DEBUG:uac_redirect:shmcontact2dset: adding contact <%.*s>\n",
271 273
 			scontacts[i]->uri.len, scontacts[i]->uri.s);
272
-		if (append_branch( 0, &scontacts[i]->uri, 0, 0, Q_UNSPECIFIED, 0, 0)<0 ) {
274
+		if (append_branch( 0, &scontacts[i]->uri, 0, 0, sqvalues[i], 0, 0)<0) {
273 275
 			LOG(L_ERR,"ERROR:uac_redirect:shmcontact2dset: failed to add "
274 276
 				"contact to dset\n");
275 277
 		} else {