No subject
Thu Jan 29 11:41:19 CET 2009
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 :)
It appears there is no 'back door' method of calling a failure_route() block
from inside a route block, as in:
if (!t_relay()) {
failure_route("2");
}
Any new thoughts?
Many thanks, both of you.
- JP
On Fri, Apr 2, 2010 at 2:58 AM, Bogdan-Andrei Iancu
<bogdan at voice-system.ro>wrote:
> Hi Jock,
>
> I guess the problem is detecting the failure . The failure route catches
> only SIP failures (like you sent the requests and you get nothing or
> negative reply); but failure route does not catch sending error (like in
> your case).
>
> So, you should do something like:
>
> route[try_next] {
> here put the next stuff
> }
>
>
> {
> ...
> t_on_failure("sip_failure");
> if (!t_relay()) {
> xlog("L_WARN", "[$Tf] t_relay fail\n");
> route(try_next);
> }
> ...
> }
>
>
> failure_route[sip_failure]
> {
> if (t_check_status("....") {
> # is a destination failure
> route(try_next);
> }
> }
>
>
> Regards,
> bogdan
>
>
> Jock McKechnie wrote:
> >
> >
> > On Thu, Apr 1, 2010 at 10:26 AM, Brett Nemeroff <brett at nemeroff.com
> > <mailto:brett at nemeroff.com>> wrote:
> >
> > Where is your failure route? :)
> > -Brett
> >
> >
> > I intentionally chose to not include it, along with the other 200
> > lines of config, for simplicity, but you're right, given this is a
> > failure, I clearly should've, duh :)
> >
> > failure_route[2] {
> > if (t_was_cancelled()) {
> > xlog( "L_NOTICE", "[$Tf] FR: transaction cancelled -
> > exiting\n" );
> > exit;
> > }
> >
> > # If fr_timer expires t_check_status("408") is true, although
> > $rs is <null>
> > if( t_check_status("408") ){
> > xlog( "L_NOTICE", "[$Tf] FR: $ci -- TIMEOUT for
> > Gateway $rd\n" );
> > } else {
> > xlog( "L_NOTICE", "[$Tf] FR: $ci -- $rs reason $rr\n" );
> > }
> >
> > # 403 -- typically ISDN network says 'not a valid number' etc..
> > if( t_check_status("403") ){
> > xlog("L_WARN", "[$Tf] FR: $ci -- SIP-$rs Forbidden ->
> > ISDN Cause Code 1\n" );
> > return;
> > }
> >
> > if( ds_next_domain() ){
> > xlog( "L_NOTICE", "[$Tf] FR: $ci Next gateway $fU ->
> > $tU via $rd \n" );
> >
> > t_on_failure("2");
> >
> > if( !t_relay() ){
> > xlog( "L_WARN", "[$Tf] FR: $ci -- ERROR -
> > Cannot t_relay() -- $fU -> $tU via $rd\n" );
> > return;
> > }
> > return;
> > } else {
> > xlog( "L_WARN", "[$Tf] FR: $ci No more gateways ->
> > 503.\n" );
> > t_reply("503", "Service unavailable -- no more
> > gateways" );
> > return;
> > }
> >
> > }
> >
> > - Jock
> >
> >
> >
> >
> > On Thu, Apr 1, 2010 at 11:20 AM, Jock McKechnie
> > <jock.mckechnie at gmail.com <mailto:jock.mckechnie at gmail.com>> wrote:
> > > Greetings all;
> > >
> > > I'm attempting to set up a fail-over only scenario using
> > dispatcher and am
> > > encountering some problems. I'm using dispatcher since we're
> already
> > > utilising it for load balancing, so it makes sense to reuse the
> > tool, and
> > > according to the OpenSIPS 1.6 dispatcher module documentation it
> > supports
> > > fail-over.
> > >
> > > If the destination server is running, everything works as
> > expected - algo 8
> > > (which OpenSIPS logs as not found and defaulting to the first
> > entry) pushes
> > > the call to the first server at all times. However if I block
> > the route to
> > > the destination server like so:
> > > /sbin/route add -host 192.168.0.99 reject
> > > Then instead of failing over I get a SIP 477 (Send failed) error.
> > >
> > > The chunk of routing looks like so:
> > >
> > > xlog("L_WARN", "[$Tf] Found failover, working on set: 1101\n");
> > > if (!ds_select_domain("1101", "8")) {
> > > t_reply("503", "Unable to locate failover set requested");
> > > return;
> > > };
> > >
> > > route(1);
> > > };
> > >
> > > route[1] {
> > > t_on_failure("2");
> > >
> > > xlog("L_WARN", "Attempting to relay call to $ru\n");
> > >
> > > if (!t_relay()) {
> > > xlog("L_WARN", "[$Tf] t_relay fail\n");
> > > return;
> > > }
> > > return;
> > > }
> > >
> > >
> > >
> > > The log contains:
> > > [Thu Apr 1 11:14:35 2010] Found failover, working on set: 1101
> > > WARNING:dispatcher:ds_select_dst: algo 8 not implemented - using
> > first
> > > entry...
> > > Attempting to relay call to sip:+12125551212 at 192.168.0.99:5060
> > <http://sip:+12125551212@192.168.0.99:5060>
> > > ERROR:core:udp_send:
> > sendto(sock,0xb3b9bd28,1039,0,0xb3ba2cf4,16): Network
> > > is unreachable(101)
> > > ERROR:tm:msg_send: udp_send failed
> > > ERROR:tm:t_forward_nonack: sending request failed
> > > [Thu Apr 1 11:14:35 2010] Found failover, working on set: 1101
> > > WARNING:dispatcher:ds_select_dst: algo 8 not implemented - using
> > first
> > > entry...
> > > Attempting to relay call to sip:+12125551212 at 192.168.0.99:5060
> > <http://sip:+12125551212@192.168.0.99:5060>
> > >
> > > This suggests to me that instead of failing over it's simply
> > retrying the
> > > first entry, which it shouldn't be, and after finding it out for
> > a second
> > > time (and thus exhausting the two-entry set), gives up.
> > >
> > > Any thoughts?
> > >
> > > - JP
> > >
> > > _______________________________________________
> > > Users mailing list
> > > Users at lists.opensips.org <mailto:Users at lists.opensips.org>
> > > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> > >
> > >
> >
> > _______________________________________________
> > Users mailing list
> > Users at lists.opensips.org <mailto:Users at lists.opensips.org>
> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Users mailing list
> > Users at lists.opensips.org
> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> >
>
>
> --
> Bogdan-Andrei Iancu
> www.voice-system.ro
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
--0016361e7f36945fe50483442b2a
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Greetings Bogdan;<br><br>Unfortunately there's a minor hitch in the get=
along with this suggestion - the failure route utilises two functions that =
can only be called from a failure_route block (t_was_cancelled() and ds_nex=
t_domain()).<br>
<br>From my understanding of what you're suggesting below, I should mov=
e 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>=A0=
=A0=A0 failure_route("2");<br>=A0=A0=A0 }<br><br>Any new thoughts=
?<br><br>
Many thanks, both of you.<br><br>=A0- JP<br><br><br><div class=3D"gmail_quo=
te">On Fri, Apr 2, 2010 at 2:58 AM, Bogdan-Andrei Iancu <span dir=3D"ltr">&=
lt;<a href=3D"mailto:bogdan at voice-system.ro">bogdan at voice-system.ro</a>>=
</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde=
r-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>
=A0 =A0here put the next stuff<br>
}<br>
<br>
<br>
{<br>
=A0 =A0...<br>
=A0 =A0t_on_failure("sip_failure");<br>
<div class=3D"im"> =A0 =A0if (!t_relay()) {<br>
=A0 =A0 =A0 =A0xlog("L_WARN", "[$Tf] t_relay fail\n");=
<br>
</div> =A0 =A0 =A0 =A0route(try_next);<br>
=A0 =A0}<br>
=A0 =A0...<br>
}<br>
<br>
<br>
failure_route[sip_failure]<br>
{<br>
=A0 =A0if (t_check_status("....") {<br>
=A0 =A0 =A0 # is a destination failure<br>
=A0 =A0 =A0 route(try_next);<br>
=A0 =A0}<br>
}<br>
<br>
<br>
Regards,<br>
bogdan<br>
<div class=3D"im"><br>
<br>
Jock McKechnie wrote:<br>
><br>
><br>
> On Thu, Apr 1, 2010 at 10:26 AM, Brett Nemeroff <<a href=3D"mailto:=
brett at nemeroff.com">brett at nemeroff.com</a><br>
</div><div><div></div><div class=3D"h5">> <mailto:<a href=3D"mailto:b=
rett at nemeroff.com">brett at nemeroff.com</a>>> wrote:<br>
><br>
> =A0 =A0 Where is your failure route? :)<br>
> =A0 =A0 -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>
> =A0 =A0 =A0 =A0 if (t_was_cancelled()) {<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 xlog( "L_NOTICE", "[$Tf=
] FR: transaction cancelled -<br>
> exiting\n" );<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 exit;<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }<br>
><br>
> =A0 =A0 =A0 =A0 # If fr_timer expires t_check_status("408") =
is true, although<br>
> $rs is <null><br>
> =A0 =A0 =A0 =A0 =A0if( t_check_status("408") ){<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 xlog( "L_NOTICE", "[$Tf=
] FR: $ci -- TIMEOUT for<br>
> Gateway $rd\n" );<br>
> =A0 =A0 =A0 =A0 =A0} else {<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 xlog( "L_NOTICE", "[$Tf=
] FR: $ci -- $rs reason $rr\n" );<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }<br>
><br>
> =A0 =A0 =A0 =A0 # 403 -- typically ISDN network says 'not a valid =
number' etc..<br>
> =A0 =A0 =A0 =A0 if( t_check_status("403") ){<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 xlog("L_WARN", "[$Tf] F=
R: $ci -- SIP-$rs Forbidden -><br>
> ISDN Cause Code 1\n" );<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return;<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }<br>
><br>
> =A0 =A0 =A0 =A0 if( ds_next_domain() ){<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 xlog( "L_NOTICE", "[$Tf=
] FR: $ci Next gateway $fU -><br>
> $tU via $rd \n" );<br>
><br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 t_on_failure("2");<br>
><br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if( !t_relay() ){<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 xlog( "L_WARN&quo=
t;, "[$Tf] FR: $ci -- ERROR -<br>
> Cannot t_relay() -- $fU -> $tU via $rd\n" );<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return;<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return;<br>
> =A0 =A0 =A0 =A0 } else {<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 xlog( "L_WARN", "[$Tf] =
FR: $ci No more gateways -><br>
> 503.\n" );<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 t_reply("503", "Service=
unavailable -- no more<br>
> gateways" );<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return;<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }<br>
><br>
> =A0 =A0 =A0 =A0 }<br>
><br>
> =A0- Jock<br>
><br>
><br>
><br>
><br>
> =A0 =A0 On Thu, Apr 1, 2010 at 11:20 AM, Jock McKechnie<br>
</div></div><div><div></div><div class=3D"h5">> =A0 =A0 <<a href=3D"m=
ailto:jock.mckechnie at gmail.com">jock.mckechnie at gmail.com</a> <mailto:<a =
href=3D"mailto:jock.mckechnie at gmail.com">jock.mckechnie at gmail.com</a>>&g=
t; wrote:<br>
> =A0 =A0 > Greetings all;<br>
> =A0 =A0 ><br>
> =A0 =A0 > I'm attempting to set up a fail-over only scenario us=
ing<br>
> =A0 =A0 dispatcher and am<br>
> =A0 =A0 > encountering some problems. I'm using dispatcher sinc=
e we're already<br>
> =A0 =A0 > utilising it for load balancing, so it makes sense to reu=
se the<br>
> =A0 =A0 tool, and<br>
> =A0 =A0 > according to the OpenSIPS 1.6 dispatcher module documenta=
tion it<br>
> =A0 =A0 supports<br>
> =A0 =A0 > fail-over.<br>
> =A0 =A0 ><br>
> =A0 =A0 > If the destination server is running, everything works as=
<br>
> =A0 =A0 expected - algo 8<br>
> =A0 =A0 > (which OpenSIPS logs as not found and defaulting to the f=
irst<br>
> =A0 =A0 entry) pushes<br>
> =A0 =A0 > the call to the first server at all times. However if I b=
lock<br>
> =A0 =A0 the route to<br>
> =A0 =A0 > the destination server like so:<br>
> =A0 =A0 > /sbin/route add -host 192.168.0.99 reject<br>
> =A0 =A0 > Then instead of failing over I get a SIP 477 (Send failed=
) error.<br>
> =A0 =A0 ><br>
> =A0 =A0 > The chunk of routing looks like so:<br>
> =A0 =A0 ><br>
> =A0 =A0 > xlog("L_WARN", "[$Tf] Found failover, work=
ing on set: 1101\n");<br>
> =A0 =A0 > if (!ds_select_domain("1101", "8")) {=
<br>
> =A0 =A0 > =A0 =A0 t_reply("503", "Unable to locate f=
ailover set requested");<br>
> =A0 =A0 > =A0 =A0 return;<br>
> =A0 =A0 > =A0 =A0 };<br>
> =A0 =A0 ><br>
> =A0 =A0 > route(1);<br>
> =A0 =A0 > };<br>
> =A0 =A0 ><br>
> =A0 =A0 > route[1] {<br>
> =A0 =A0 > t_on_failure("2");<br>
> =A0 =A0 ><br>
> =A0 =A0 > xlog("L_WARN", "Attempting to relay call t=
o $ru\n");<br>
> =A0 =A0 ><br>
> =A0 =A0 > if (!t_relay()) {<br>
> =A0 =A0 > =A0 =A0 xlog("L_WARN", "[$Tf] t_relay fail=
\n");<br>
> =A0 =A0 > =A0 =A0 return;<br>
> =A0 =A0 > =A0 =A0 }<br>
> =A0 =A0 > return;<br>
> =A0 =A0 > }<br>
> =A0 =A0 ><br>
> =A0 =A0 ><br>
> =A0 =A0 ><br>
> =A0 =A0 > The log contains:<br>
> =A0 =A0 > [Thu Apr =A01 11:14:35 2010] Found failover, working on s=
et: 1101<br>
> =A0 =A0 > WARNING:dispatcher:ds_select_dst: algo 8 not implemented =
- using<br>
> =A0 =A0 first<br>
> =A0 =A0 > entry...<br>
> =A0 =A0 > Attempting to relay call to <a href=3D"http://sip:+121255=
51212 at 192.168.0.99:5060" target=3D"_blank">sip:+12125551212 at 192.168.0.99:50=
60</a><br>
</div></div>> =A0 =A0 <<a href=3D"http://sip:+12125551212@192.168.0.9=
9:5060" target=3D"_blank">http://sip:+12125551212@192.168.0.99:5060</a>>=
<br>
<div class=3D"im">> =A0 =A0 > ERROR:core:udp_send:<br>
> =A0 =A0 sendto(sock,0xb3b9bd28,1039,0,0xb3ba2cf4,16): Network<br>
> =A0 =A0 > is unreachable(101)<br>
> =A0 =A0 > ERROR:tm:msg_send: udp_send failed<br>
> =A0 =A0 > ERROR:tm:t_forward_nonack: sending request failed<br>
> =A0 =A0 > [Thu Apr =A01 11:14:35 2010] Found failover, working on s=
et: 1101<br>
> =A0 =A0 > WARNING:dispatcher:ds_select_dst: algo 8 not implemented =
- using<br>
> =A0 =A0 first<br>
> =A0 =A0 > entry...<br>
> =A0 =A0 > Attempting to relay call to <a href=3D"http://sip:+121255=
51212 at 192.168.0.99:5060" target=3D"_blank">sip:+12125551212 at 192.168.0.99:50=
60</a><br>
</div>> =A0 =A0 <<a href=3D"http://sip:+12125551212@192.168.0.99:5060=
" target=3D"_blank">http://sip:+12125551212@192.168.0.99:5060</a>><br>
<div class=3D"im">> =A0 =A0 ><br>
> =A0 =A0 > This suggests to me that instead of failing over it's=
simply<br>
> =A0 =A0 retrying the<br>
> =A0 =A0 > first entry, which it shouldn't be, and after finding=
it out for<br>
> =A0 =A0 a second<br>
> =A0 =A0 > time (and thus exhausting the two-entry set), gives up.<b=
r>
> =A0 =A0 ><br>
> =A0 =A0 > Any thoughts?<br>
> =A0 =A0 ><br>
> =A0 =A0 > =A0- JP<br>
> =A0 =A0 ><br>
> =A0 =A0 > _______________________________________________<br>
> =A0 =A0 > Users mailing list<br>
</div>> =A0 =A0 > <a href=3D"mailto:Users at lists.opensips.org">Users at l=
ists.opensips.org</a> <mailto:<a href=3D"mailto:Users at lists.opensips.org=
">Users at lists.opensips.org</a>><br>
<div class=3D"im">> =A0 =A0 > <a href=3D"http://lists.opensips.org/cg=
i-bin/mailman/listinfo/users" target=3D"_blank">http://lists.opensips.org/c=
gi-bin/mailman/listinfo/users</a><br>
> =A0 =A0 ><br>
> =A0 =A0 ><br>
><br>
> =A0 =A0 _______________________________________________<br>
> =A0 =A0 Users mailing list<br>
</div>> =A0 =A0 <a href=3D"mailto:Users at lists.opensips.org">Users at lists.=
opensips.org</a> <mailto:<a href=3D"mailto:Users at lists.opensips.org">Use=
rs at lists.opensips.org</a>><br>
<div class=3D"im">> =A0 =A0 <a href=3D"http://lists.opensips.org/cgi-bin=
/mailman/listinfo/users" target=3D"_blank">http://lists.opensips.org/cgi-bi=
n/mailman/listinfo/users</a><br>
><br>
><br>
> ----------------------------------------------------------------------=
--<br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href=3D"mailto:Users at lists.opensips.org">Users at lists.opensips.org</=
a><br>
> <a href=3D"http://lists.opensips.org/cgi-bin/mailman/listinfo/users" t=
arget=3D"_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</=
a><br>
><br>
<br>
<br>
</div><font color=3D"#888888">--<br>
Bogdan-Andrei Iancu<br>
<a href=3D"http://www.voice-system.ro" target=3D"_blank">www.voice-system.r=
o</a><br>
</font><div><div></div><div class=3D"h5"><br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href=3D"mailto:Users at lists.opensips.org">Users at lists.opensips.org</a><br=
>
<a href=3D"http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target=
=3D"_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br=
>
</div></div></blockquote></div><br>
--0016361e7f36945fe50483442b2a--
More information about the Users
mailing list