<div dir="auto">Thanks Ben,</div><div dir="auto"><br></div><div dir="auto">I understand now. Perfect.</div><div dir="auto"><br></div><div dir="auto">David</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 3 Jun 2021 at 14:24, Ben Newlin <<a href="mailto:Ben.Newlin@genesys.com">Ben.Newlin@genesys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="m_7130828551534315296WordSection1">
<p class="MsoNormal">Yes, if a reply route is armed or the global reply route exists, they are triggered first for any reply. Failure route, if armed, is triggered after that for any >=300 response codes.<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"><u></u> <u></u></p>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Users <<a href="mailto:users-bounces@lists.opensips.org" target="_blank">users-bounces@lists.opensips.org</a>> on behalf of David Villasmil <<a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a>><br>
<b>Date: </b>Thursday, June 3, 2021 at 8:10 AM<br>
<b>To: </b>OpenSIPS users mailling list <<a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a>><br>
<b>Subject: </b>Re: [OpenSIPS-Users] Getting header from 302<u></u><u></u></span></p>
</div>
</div></div><div lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word"><div class="m_7130828551534315296WordSection1"><div>
<p class="MsoNormal">Oh I didn’t register that <reply> param. I’ll try with that.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">On the other hand, I may be confused about how opensips processes >299 replies. Does it process them on onreply route and then goes to the failure route? I mean that’s what I’m doing right now, but is this intended by design? I would’ve
 though it’d go straight to the failure route, but actually going to the onreply route sounds smart.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Wed, 2 Jun 2021 at 22:08, Jeff Pyle <<a href="mailto:jeff@ugnd.org" target="_blank">jeff@ugnd.org</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">I've been working on a proxy to sit between MS Teams and "normal" SIP stacks.  Teams sends way too many 180s and RTP-less 183s so I sanitize them like this:<br>
<br>
<span style="font-family:"Courier New"">onreply_route[relay_reply] {<br>
        if (t_check_status("180")) {<br>
                if (isflagset("GOT_180")) {<br>
                        drop;<br>
                } else {<br>
                        setflag("GOT_180");<br>
                }<br>
        }<br>
<br>
        if (isflagset("GOT_180") && t_check_status("183")) {<br>
                drop;<br>
        }</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New"">}</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">With this I stop superfluous 18x messages from being relayed downstream.  The 'drop' here kills the message completely.  You could include the drop if you want to stop the message from being relayed (which you probably do) and are finished
 processing it in the script (which you are probably not).<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">If I understand your application correctly, I'd populate the AVP in the reply route and do everything else in the failure route.  Or, try Liviu's suggestion of using $(<reply>hdr(Identity)) in the failure_route directly.  Either way, then
 continue in the failure_route to do whatever else needs to happen.<u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">- Jeff<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Wed, Jun 2, 2021 at 2:10 PM David Villasmil <<a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal">Hello Jeff,<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">That's exactly what I'm doing:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New""># 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>
}</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">So I suppose i don't need the drop()?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Regards,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">David Villasmil<u></u><u></u></p>
<div>
<p class="MsoNormal">email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">
david.villasmil.work@gmail.com</a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">phone: +34669448337<u></u><u></u></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
</div>
</div></div><div lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word"><div class="m_7130828551534315296WordSection1"></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></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><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>