Greetings Bogdan;<br><br>Unfortunately there's a minor hitch in the getalong with this suggestion - the failure route utilises two functions that can only be called from a failure_route block (t_was_cancelled() and ds_next_domain()).<br>
<br>From my understanding of what you're suggesting below, I should move my failure logic into its own route block and then call it, both from the failure_route block and from the t_relay() failed section. This would be a very elegant way to handle it, if I could use it :)<br>
<br>It appears there is no 'back door' method of calling a failure_route() block from inside a route block, as in:<br>if (!t_relay()) {<br> failure_route("2");<br> }<br><br>Any new thoughts?<br><br>
Many thanks, both of you.<br><br> - JP<br><br><br><div class="gmail_quote">On Fri, Apr 2, 2010 at 2:58 AM, Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Jock,<br>
<br>
I guess the problem is detecting the failure . The failure route catches<br>
only SIP failures (like you sent the requests and you get nothing or<br>
negative reply); but failure route does not catch sending error (like in<br>
your case).<br>
<br>
So, you should do something like:<br>
<br>
route[try_next] {<br>
here put the next stuff<br>
}<br>
<br>
<br>
{<br>
...<br>
t_on_failure("sip_failure");<br>
<div class="im"> if (!t_relay()) {<br>
xlog("L_WARN", "[$Tf] t_relay fail\n");<br>
</div> route(try_next);<br>
}<br>
...<br>
}<br>
<br>
<br>
failure_route[sip_failure]<br>
{<br>
if (t_check_status("....") {<br>
# is a destination failure<br>
route(try_next);<br>
}<br>
}<br>
<br>
<br>
Regards,<br>
bogdan<br>
<div class="im"><br>
<br>
Jock McKechnie wrote:<br>
><br>
><br>
> On Thu, Apr 1, 2010 at 10:26 AM, Brett Nemeroff <<a href="mailto:brett@nemeroff.com">brett@nemeroff.com</a><br>
</div><div><div></div><div class="h5">> <mailto:<a href="mailto:brett@nemeroff.com">brett@nemeroff.com</a>>> wrote:<br>
><br>
> Where is your failure route? :)<br>
> -Brett<br>
><br>
><br>
> I intentionally chose to not include it, along with the other 200<br>
> lines of config, for simplicity, but you're right, given this is a<br>
> failure, I clearly should've, duh :)<br>
><br>
> failure_route[2] {<br>
> if (t_was_cancelled()) {<br>
> xlog( "L_NOTICE", "[$Tf] FR: transaction cancelled -<br>
> exiting\n" );<br>
> exit;<br>
> }<br>
><br>
> # If fr_timer expires t_check_status("408") is true, although<br>
> $rs is <null><br>
> if( t_check_status("408") ){<br>
> xlog( "L_NOTICE", "[$Tf] FR: $ci -- TIMEOUT for<br>
> Gateway $rd\n" );<br>
> } else {<br>
> xlog( "L_NOTICE", "[$Tf] FR: $ci -- $rs reason $rr\n" );<br>
> }<br>
><br>
> # 403 -- typically ISDN network says 'not a valid number' etc..<br>
> if( t_check_status("403") ){<br>
> xlog("L_WARN", "[$Tf] FR: $ci -- SIP-$rs Forbidden -><br>
> ISDN Cause Code 1\n" );<br>
> return;<br>
> }<br>
><br>
> if( ds_next_domain() ){<br>
> xlog( "L_NOTICE", "[$Tf] FR: $ci Next gateway $fU -><br>
> $tU via $rd \n" );<br>
><br>
> t_on_failure("2");<br>
><br>
> if( !t_relay() ){<br>
> xlog( "L_WARN", "[$Tf] FR: $ci -- ERROR -<br>
> Cannot t_relay() -- $fU -> $tU via $rd\n" );<br>
> return;<br>
> }<br>
> return;<br>
> } else {<br>
> xlog( "L_WARN", "[$Tf] FR: $ci No more gateways -><br>
> 503.\n" );<br>
> t_reply("503", "Service unavailable -- no more<br>
> gateways" );<br>
> return;<br>
> }<br>
><br>
> }<br>
><br>
> - Jock<br>
><br>
><br>
><br>
><br>
> On Thu, Apr 1, 2010 at 11:20 AM, Jock McKechnie<br>
</div></div><div><div></div><div class="h5">> <<a href="mailto:jock.mckechnie@gmail.com">jock.mckechnie@gmail.com</a> <mailto:<a href="mailto:jock.mckechnie@gmail.com">jock.mckechnie@gmail.com</a>>> wrote:<br>
> > Greetings all;<br>
> ><br>
> > I'm attempting to set up a fail-over only scenario using<br>
> dispatcher and am<br>
> > encountering some problems. I'm using dispatcher since we're already<br>
> > utilising it for load balancing, so it makes sense to reuse the<br>
> tool, and<br>
> > according to the OpenSIPS 1.6 dispatcher module documentation it<br>
> supports<br>
> > fail-over.<br>
> ><br>
> > If the destination server is running, everything works as<br>
> expected - algo 8<br>
> > (which OpenSIPS logs as not found and defaulting to the first<br>
> entry) pushes<br>
> > the call to the first server at all times. However if I block<br>
> the route to<br>
> > the destination server like so:<br>
> > /sbin/route add -host 192.168.0.99 reject<br>
> > Then instead of failing over I get a SIP 477 (Send failed) error.<br>
> ><br>
> > The chunk of routing looks like so:<br>
> ><br>
> > xlog("L_WARN", "[$Tf] Found failover, working on set: 1101\n");<br>
> > if (!ds_select_domain("1101", "8")) {<br>
> > t_reply("503", "Unable to locate failover set requested");<br>
> > return;<br>
> > };<br>
> ><br>
> > route(1);<br>
> > };<br>
> ><br>
> > route[1] {<br>
> > t_on_failure("2");<br>
> ><br>
> > xlog("L_WARN", "Attempting to relay call to $ru\n");<br>
> ><br>
> > if (!t_relay()) {<br>
> > xlog("L_WARN", "[$Tf] t_relay fail\n");<br>
> > return;<br>
> > }<br>
> > return;<br>
> > }<br>
> ><br>
> ><br>
> ><br>
> > The log contains:<br>
> > [Thu Apr 1 11:14:35 2010] Found failover, working on set: 1101<br>
> > WARNING:dispatcher:ds_select_dst: algo 8 not implemented - using<br>
> first<br>
> > entry...<br>
> > Attempting to relay call to <a href="http://sip:+12125551212@192.168.0.99:5060" target="_blank">sip:+12125551212@192.168.0.99:5060</a><br>
</div></div>> <<a href="http://sip:+12125551212@192.168.0.99:5060" target="_blank">http://sip:+12125551212@192.168.0.99:5060</a>><br>
<div class="im">> > ERROR:core:udp_send:<br>
> sendto(sock,0xb3b9bd28,1039,0,0xb3ba2cf4,16): Network<br>
> > is unreachable(101)<br>
> > ERROR:tm:msg_send: udp_send failed<br>
> > ERROR:tm:t_forward_nonack: sending request failed<br>
> > [Thu Apr 1 11:14:35 2010] Found failover, working on set: 1101<br>
> > WARNING:dispatcher:ds_select_dst: algo 8 not implemented - using<br>
> first<br>
> > entry...<br>
> > Attempting to relay call to <a href="http://sip:+12125551212@192.168.0.99:5060" target="_blank">sip:+12125551212@192.168.0.99:5060</a><br>
</div>> <<a href="http://sip:+12125551212@192.168.0.99:5060" target="_blank">http://sip:+12125551212@192.168.0.99:5060</a>><br>
<div class="im">> ><br>
> > This suggests to me that instead of failing over it's simply<br>
> retrying the<br>
> > first entry, which it shouldn't be, and after finding it out for<br>
> a second<br>
> > time (and thus exhausting the two-entry set), gives up.<br>
> ><br>
> > Any thoughts?<br>
> ><br>
> > - JP<br>
> ><br>
> > _______________________________________________<br>
> > Users mailing list<br>
</div>> > <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>><br>
<div class="im">> > <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
> ><br>
> ><br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
</div>> <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>><br>
<div class="im">> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
><br>
><br>
> ------------------------------------------------------------------------<br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
><br>
<br>
<br>
</div><font color="#888888">--<br>
Bogdan-Andrei Iancu<br>
<a href="http://www.voice-system.ro" target="_blank">www.voice-system.ro</a><br>
</font><div><div></div><div class="h5"><br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br>