[SIPForum-discussion] q value in contact question

Robert Sparks rjsparks at nostrum.com
Tue Oct 7 20:55:12 UTC 2008


First - your q-values aren't valid. But answering what you meant:

This is a hard question. The difficulty comes from 'q' not meaning the  
same thing throughout the system. The values only have relative  
meaning when they come from the same source.

There are many ways to reconcile this, and sometimes your particular  
application will make it clear what you should do.
The best _general_ answer I've found is to treat new values you  
receive from other sources as subordinates to the one you were  
processing when you got them. In your example, That means processing  
the redirect contact you show below _between_ targets 1 and 2 in your  
first list.

Semantically, here's what's happening.

You have 3 targets from a set where they are well ordered. That  
ordering says you really want the first target to succeed, but if it  
doesn't work out, try these others. When you tried the first target,  
it said "I might work if you try again over there". You want to try  
that place before you move on to the other things in your original  
set, because it was your preference for whatever was behind that  
original first target to succeed (and it's telling you with that  
redirect where that might be).

To expand, if you start with
(A:0.9, B:0.5, C:0.1) and when you contact A you get a redirect to (D:. 
6,E:.2) you should try things in this order:
A D E B C

And this is recursive - if D above returned a redirect to (F:0.9, G: 
0.1), your order should be
A D F G E B C

If you followed that, here's one step further:

Assume you process contacts with the same q-values in parallel and you  
start with
(A:0.5, B:0.5, C:0.1). A redirects to (D:0.9,E:0.4) and B redirects to  
(F:0.4,G:0.1)
Then you would process these in this order (where columns indicate  
parallelism - use a monospace font if this looks odd):
A D E G C
B     F

Hope that helps :)

RjS

On Oct 7, 2008, at 7:33 AM, Ravi Siebel wrote:

> Hi All ,
> Below is the question on the q value :
> I send a request which results in a redirection with the following  
> contacts:
> 1. alice at 10.20.30.1;q=1.0
> 2. alice at 10.20.30.2;q=2.0
> 3. alice at 10.20.30.3;q=3.0
> Now, while handling the first of the above contacts, I get a
>  second
> redirect with the following contacts:
> 1. alice at 10.1.0.4;q=2.5
> Should I suppose to handle this new redirect after 2 and 3 above, or  
> in
> between 2 and 3?
> regards,
> Ravi
>
> _______________________________________________
> This is the SIP Forum discussion mailing list
> TO UNSUBSCRIBE, or edit your delivery options, please visit http://sipforum.org/mailman/listinfo/discussion
> Post to the list at discussion at sipforum.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sipforum.org/pipermail/discussion/attachments/20081007/e177246a/attachment-0002.html>


More information about the discussion mailing list