<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Brett,</div><div><br></div>I can't answer how it's *supposed* to work, but I can explain how I've made it work.<div><br></div><div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> if (t_check_status("302")) {</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> if(!get_redirects("*")) {</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> route(20); # No redirects, junk the call (send an error to the caller, other than 302)</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> exit;</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> }</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> # Brett, these two may be your key</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> serialize_branches(1);</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> next_branches(); </span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> setbflag(3); # 302 in progress</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> t_on_failure("4"); # This failure_route</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> t_on_branch("1"); # Not sure why I need this, but it used to fail without I think</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> resetflag(1);</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> route(23); # Send request (some wrappers around a t_relay, nothing relevant to the 302)</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> }</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> if (isbflagset(3)) {</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> if (next_branches()) {</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> t_on_failure("4"); # This failure_route</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> resetflag(22);</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> route(23); # Send request</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> } else {</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> resetbflag(3); # The 302's over</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> setflag(22); # Make sure there's failure accounting</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> route(20); # Done trying, fail the call (send an error to the caller, other than 302)</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> }</span></font></font></div><div><font class="Apple-style-span" face="Monaco"><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"> }</span></font></font></div><div><br></div><div>This is some older config of mine. I haven't revisited it because it works, but I would imagine there are efficiency improvements to be had.</div><div><br></div><div><br></div><div>- Jeff</div><div><br></div><div><br></div><div><div>On Mar 24, 2010, at 10:41 PM, Brett Nemeroff wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hello All,<div>I have a question about 302 redirects.Maybe I'm just misunderstanding how it's supposed to work..</div><div><br></div><div>I get the following redirect:</div><div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Courier">
</p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">SIP/2.0 302 Moved temporarily.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">Via:SIP/2.0/UDP 192.168.21.10;branch=z9hG4bK6cd5.ae1f6c43.0,SIP/2.0/UDP 10.10.10.11:5060;branch=z9hG4bK-a96e3-4baac9a7-8c685c67-5898d54b.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">From:<<a href="http://sip:+5125551212@10.10.10.11:5060/">sip:+5125551212@10.10.10.11:5060</a>>;tag=a9d5ed0-13c4-4baac9a7-8c685c67-19c2a61a.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">To:<<a href="http://sip:15205551212@192.168.21.10:5060/">sip:15205551212@192.168.21.10:5060</a>>;tag=100063687-1269483944267.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; "><a href="mailto:Call-ID%3ACXC-410-65762490-a9d5ed0-13c4-4baac9a7-8c685c67-17d5873c@10.10.10.11">Call-ID:CXC-410-65762490-a9d5ed0-13c4-4baac9a7-8c685c67-17d5873c@10.10.10.11</a>.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">CSeq:1 INVITE.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">Record-Route:<<a href="sip:192.168.21.10;lr=on;did=f8d.623e93f6">sip:192.168.21.10;lr=on;did=f8d.623e93f6</a>>.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">Contact:<<a href="sip:5205551212@192.168.50.10:5060;user=phone">sip:5205551212@192.168.50.10:5060;user=phone</a>>;q=0.5,<<a href="sip:5205551212@192.168.30.10:5060;user=phone">sip:5205551212@192.168.30.10:5060;user=phone</a>>;q=0.25.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">Content-Length:0.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">
And in my failure route I have:</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Courier"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; "> if (t_check_status("302")) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">
get_redirects("*");</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; "> t_relay();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; "> exit;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; "> }</div><div><br></div><div>Now when I watch a sip trace, right after the 302, an INVITE fires off to BOTH 192.168.50.10 and 192.168.30.10 at the exact same time. The q values are different, shouldn't they be serial?</div>
<div><br></div><div>I'm not entirely sure how much "magic" is handled in the q-value and how much needs to be scripted.. But I was under the impression that this magic was "fully automatic"</div><div>
<br></div><div>Thanks!</div><div>-Brett</div><div><br></div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div></div>
_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>http://lists.opensips.org/cgi-bin/mailman/listinfo/users<br></blockquote></div><br></div></body></html>