Thank you for your  explanation. 
The failure routeis ran in the context of the initial request and the 
route reply work on reply message, this explanation helped me understand a lot 
of confusion.
But I also have another question, for example:
when openbsuips received non-2xx response for register or option requet message 
,
if I ignore failure route and reply route in the routing script, will 
opensips forward one response or two (failure route and reply route all excute 
its default action) to upstream?


if I write reply route in routing script,but it do nothing, and i write failure 
route that only call t_reply(), will opensips forward one response or two 
to upstream?


------------------ 原始邮件 ------------------
发件人:&nbsp;"Ben Newlin"<[email protected]&gt;;
发送时间:&nbsp;2019年11月21日(星期四) 晚上10:17
收件人:&nbsp;"OpenSIPS users mailling list"<[email protected]&gt;;

主题:&nbsp;Re: [OpenSIPS-Users] confusion about the reply route and the failure 
route



"Moreover, in failure route you can only drop a reply, but you cannot failover."

I think this should say in reply route.

Ben Newlin 

On 11/21/19, 3:56 AM, "Users on behalf of Răzvan Crainea" 
<[email protected] on behalf of [email protected]&gt; wrote:

&nbsp;&nbsp;&nbsp; Hello!
&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; By default, the replies received by OpenSIPS are relayed 
further, 
&nbsp;&nbsp;&nbsp; whether you have a reply of failure route or not. The 
purpose of these 
&nbsp;&nbsp;&nbsp; two routes is to do any processing on the messages they are 
processing.
&nbsp;&nbsp;&nbsp; Note that the scope of failure route and reply route is a 
bit different: 
&nbsp;&nbsp;&nbsp; the reply route is ran for each reply message - this means 
that if you 
&nbsp;&nbsp;&nbsp; for example add a header on a 408, that 408 message will 
contain the 
&nbsp;&nbsp;&nbsp; header. Moreover, in failure route you can only drop a 
reply, but you 
&nbsp;&nbsp;&nbsp; cannot failover.
&nbsp;&nbsp;&nbsp; The failure route has nothing to do with replies processing 
- it is ran 
&nbsp;&nbsp;&nbsp; in the context of the initial request. This means that if 
you add a 
&nbsp;&nbsp;&nbsp; header in failure route, it will not appear in any replies! 
However, if 
&nbsp;&nbsp;&nbsp; you run t_relay() in failure route, you will create a new 
branch - send 
&nbsp;&nbsp;&nbsp; the request to a new upstream - that request will contain 
the added 
&nbsp;&nbsp;&nbsp; header. The only thing that failure route running relates to 
replies is 
&nbsp;&nbsp;&nbsp; the fact that if you do a t_relay() in failure route and 
dispatch the 
&nbsp;&nbsp;&nbsp; request to a new destination, no reply will be sent 
downstream.
&nbsp;&nbsp;&nbsp; To summarize, if you don't use reply route or failure route, 
all 
&nbsp;&nbsp;&nbsp; responses will be sent. The only exception to this rule is 
when you use 
&nbsp;&nbsp;&nbsp; parallel forking: send the initial request to multiple 
destinations in 
&nbsp;&nbsp;&nbsp; parallel. In such case, according to RFC 3261, OpenSIPS will 
only relay 
&nbsp;&nbsp;&nbsp; downstream the result all replies received from upstream - 
that is the 
&nbsp;&nbsp;&nbsp; lowest terminal response code.
&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; Best regards,
&nbsp;&nbsp;&nbsp; Răzvan
&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; On 11/21/19 4:30 AM, 汤世祥 wrote:
&nbsp;&nbsp;&nbsp; &gt; Hi:
&nbsp;&nbsp;&nbsp; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I'm a little confused 
about the reply route and the failure route.
&nbsp;&nbsp;&nbsp; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Both can handle 
404/408 responses in invite session. Both default action is to relay back the 
SIP reply.
&nbsp;&nbsp;&nbsp; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If I 
omit two routes in scripts(that meas not arm the reply route by using the 
t_on_reply("name") function or t_on_failure("name") function) or call t_relay() 
in these two routing scripts, will there be two responses sent ?
&nbsp;&nbsp;&nbsp; &gt; 
&nbsp;&nbsp;&nbsp; &gt; _______________________________________________
&nbsp;&nbsp;&nbsp; &gt; Users mailing list
&nbsp;&nbsp;&nbsp; &gt; [email protected]
&nbsp;&nbsp;&nbsp; &gt; http://lists.opensips.org/cgi-bin/mailman/listinfo/users
&nbsp;&nbsp;&nbsp; &gt; 
&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; -- 
&nbsp;&nbsp;&nbsp; Răzvan Crainea
&nbsp;&nbsp;&nbsp; OpenSIPS Core Developer
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http://www.opensips-solutions.com
&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; _______________________________________________
&nbsp;&nbsp;&nbsp; Users mailing list
&nbsp;&nbsp;&nbsp; [email protected]
&nbsp;&nbsp;&nbsp; http://lists.opensips.org/cgi-bin/mailman/listinfo/users
&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; 

_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to