<div dir="ltr">Hey Daniel,<div><br></div><div>Thanks for the reply and pointers on what I'm doing wrong. I'll look into the branch_failure_route and read the docs again to make sure I do serial forking and not accidentally creating a parallel fork.</div><div><br></div><div>Does there happen to be any good resources (blog posts, wiki articles, books, ancient Egyptian hieroglyphics) on better understanding the handling of requests/responses in Kamailio? Or are the module docs the best available resource?</div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks,</div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div style="font-family:arial;font-size:small">Ryan</div></div></div></div>
<br><div class="gmail_quote">On Wed, Feb 4, 2015 at 1:02 PM, Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hello,<br>
<div><div><br>
On 04/02/15 16:28, Ryan Brindley wrote:<br>
><br>
> Hey community,<br>
><br>
> I'm trying to understand t_relay () when a forward times out.<br>
><br>
> This is an abbreviated version of what i have:<br>
><br>
> Request_route {<br>
> ...<br>
> Route(do1)<br>
> }<br>
><br>
> Route [do1]  {<br>
> ...<br>
> T_on_reply (1reply)<br>
> T_on_failure (1fail)<br>
> T_relay ()<br>
> }<br>
><br>
> Reply_route[1reply] {<br>
> ...<br>
> If (t_check_status (302)) {<br>
>   Route (do2)<br>
> }<br>
> }<br>
><br>
> Failure_route [1fail] {<br>
> Xlog (dafail1)<br>
> }<br>
><br>
> Route [do2]{<br>
> ...<br>
> T_on_reply (2reply)<br>
> T_on_failure (2fail)<br>
> T_relay ()<br>
> }<br>
><br>
> Reply_route [2reply]{<br>
> Xlog (twerked)<br>
> }<br>
><br>
> Failure_route [2fail]{<br>
> Xlog (failured)<br>
> }<br>
><br>
> The case im currently interested in is when the first relay (do1)<br>
> returns a 302 and then the second (do2) times out.<br>
><br>
> What happens on the second when it times out, it hits the 1fail<br>
> failure_route. This messes with my logic as i would've expected (and<br>
> want to find out how to make it) hit the 2nd failure_route.<br>
><br>
> I also noticed that if i loop and try the do2 again after the first<br>
> failure it will then hit the 2fail route.<br>
><br>
> Any clarification on this subject would be greatly appreciated,<br>
><br>
</div></div>It is not easy to follow your pseduo-code, but it is important to know<br>
that the SIP response is handled in an onreply_route. Given that, you<br>
cannot call t_relay() on a SIP response (reply). SIP responses are<br>
routed automatically based on Via header.<br>
<br>
t_relay() must be used only for SIP requests. If you sent the SIP<br>
request to many destinations (parallel fork), the tm is waiting for all<br>
branches to complete before executing failure_route, the selected<br>
response is based on an algorithm derived from SIP RFC specs. If you<br>
want to have a routing block executed on a negative reply, use<br>
branch_failure_route - in it, you get the request for processing and you<br>
can relay it again.<br>
<br>
Cheers,<br>
Daniel<br>
<span><font color="#888888"><br>
--<br>
Daniel-Constantin Mierla<br>
<a href="http://twitter.com/#!/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a><br>
Kamailio World Conference, May 27-29, 2015<br>
Berlin, Germany - <a href="http://www.kamailioworld.com" target="_blank">http://www.kamailioworld.com</a><br>
<br>
<br>
_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</font></span></blockquote></div><br></div></div>