<div dir="ltr">Hello Jeff,<div><br></div><div>That's exactly what I'm doing:</div><div><br></div><div><font face="monospace"># Relay to REDIRECT server<br>route[relay_to_REDIRECT]<br>{<br> t_on_reply("reply_from_REDIRECT");<br> t_on_failure("failure_from_REDIRECT");<br><br> xlog("L_ERR", "[$ci][$rm]: Relaying to REDIRECT");<br> if (!t_relay()) {<br> xlog("L_ERR", "[$ci][$rm]: unable to relay request $ru to $tU -- replying with error");<br> sl_reply_error();<br> }<br><br> exit;<br>}<br><br># Response from REDIRECT will come in here.<br>failure_route[failure_from_REDIRECT]<br>{<br> xlog("L_ERR", "[$ci][$rm]: I'm in failure_route[failover_from_REDIRECT]");<br> if (t_was_cancelled()) {<br> exit;<br> }<br><br> if(is_avp_set("$avp(myheader)")) {<br> xlog("L_ERR", "[$ci][$rm]: Got Identity Header: $(hdr(myheader))");<br> setflag(100);<br> route(invite);<br> }<br>}<br><br># Response 302 from REDIRECT will come in here.<br>onreply_route[reply_from_REDIRECT]<br>{<br> xlog("L_ERR", "[$ci][$rm]: I'm in onreply_route[reply_from_REDIRECT]");<br> if (t_was_cancelled()) {<br> exit;<br> }<br><br> # detect redirect, store the header and send to "invite" as normally<br> if (t_check_status("302") && is_present_hf("myheader")) {<br> $avp(identity_header) = $(hdr(myheader));<br> setflag(100);<br> drop();<br> }<br>}</font></div><div><br></div><div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>So I suppose i don't need the drop()?</div><div><br></div><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 2, 2021 at 4:32 PM Jeff Pyle <<a href="mailto:jeff@ugnd.org">jeff@ugnd.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>If I arm both t_on_failure() and t_on_reply(), do a t_relay(), and a
302 comes back, I have access to the reply in the onreply_route, then
the failure_route. From a SIP perspective, a 302 is a failure since
it's not 2xx-series, no? I don't do a drop() in the onreply_route. It
just naturally follows its course to the failure_route.</div><div><br></div><div>David,
in your case, since you're trying to drop any 302 that doesn't have an
Identity header, I'd check for its presence in the onreply_route and set
a flag if there accordingly. And, capture its value in an AVP if you
need. Next, in the failure_route, if (t_check_status("302") &&
!isflagset("302_HAS_ID_HEADER")) drop; or something similar. You
could easily expand that block to route-advance to your next carrier,
send_reply(499, "Something Else"), or whatever you makes sense for your
application.<font color="#888888"><br></font></div><font color="#888888"><div><br></div><div><br></div><div>- Jeff</div></font></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 2, 2021 at 10:19 AM Johan De Clercq <<a href="mailto:Johan@democon.be" target="_blank">Johan@democon.be</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>that's because 302 is not an error. <br></div><div>So I guess that drop() is the only way. <br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Op wo 2 jun. 2021 om 15:42 schreef David Villasmil <<a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Thanks Ben,</div><div dir="auto"><br></div><div dir="auto">That’s a good point. But only way I’ve found to jump over from oneply to failure_route is by doing a drop(). If there’s another way, I’d love to know about it!</div><div dir="auto"><br></div><div dir="auto">David</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 2 Jun 2021 at 08:29, Ben Newlin <<a href="mailto:Ben.Newlin@genesys.com" target="_blank">Ben.Newlin@genesys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div>
<p class="MsoNormal">You still don’t need to call drop() as long as you are handling the request in failure_route. The 302 will not be sent back upstream as long as failure_route either creates a new branch request or sends back a different reply code. Only
if failure_route exits without doing either of these things would the downstream 302 be sent back upstream as-is.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">In fact, as far as I know drop() has no functionality for responses >= 200.</p></div></div><div lang="EN-US"><div><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span style="color:black">Ben Newlin </span><u></u><u></u></p>
<p class="MsoNormal"><br>
</p></div></div></blockquote></div></div></blockquote></div></blockquote></div></div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div>