Explorar o código

modules/tm: load_contacts() now prefers contacts whose path is empty

- For contacts with the same q, order contacts so that contacts that
  have empty path are preferred over ones that have path defined.  In
  practice, this affects only contacts with the same ua instance id.
Juha Heinanen %!s(int64=12) %!d(string=hai) anos
pai
achega
2a895f5dcf
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      modules/tm/t_serial.c

+ 3 - 1
modules/tm/t_serial.c

@@ -251,7 +251,9 @@ int t_load_contacts(struct sip_msg* msg, char* key, char* value)
 
 	prev = (struct contact *)0;
 	curr = contacts;
-	while (curr && (curr->q < branch->q)) {
+	while (curr && 
+	       ((curr->q < next->q) ||
+		((curr->q == next->q) && (next->path.len == 0)))) {
 	    prev = curr;
 	    curr = curr->next;
 	}