Invoking 'failure_route[X]' when OpenSIPS replies [3456]XX by itself

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Invoking 'failure_route[X]' when OpenSIPS replies [3456]XX by itself

Iñaki Baz Castillo
Hi, is possible to invoke 'failure_route[X]' after OpenSIPS has sent a
negative reply by itself to the caller? In this case the reply would be sent
to the caller but it would selected as final reply.

Well, I expect this is not possible since 'failure_route' is just invoked when
the final response from downstream (or the best of them) is negative.

What I want is:

---------
route[TO_USER] {
       
        t_on_failure("TO_USER");

        # some_custom_query...
        if $rc = ... {
                # I decide to reject the call
                # First create the transaction ("failure_route" could have sense)
                t_newtran();
                send_reply("403", "Forbidden sorry");
                exit;
        }

        # do loockup and so...
        t_relay();
}

failure_route[TO_USER] {

        if $fU == "alice" {
                $ru = "sip:voicemail@server";
                append_branch();
        }

}
---------


But this doesn't work, "failure_route" is not called. I understand that the
design doesn't allow this case, would it be possible in other way?

Thanks a lot.



 
--
Iñaki Baz Castillo

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Invoking 'failure_route[X]' when OpenSIPS replies [3456]XX by itself

Iñaki Baz Castillo
El Miércoles, 26 de Noviembre de 2008, Iñaki Baz Castillo escribió:
> Hi, is possible to invoke 'failure_route[X]' after OpenSIPS has sent a
> negative reply by itself to the caller? In this case the reply would be
> sent to the caller but it would selected as final reply.
>
> Well, I expect this is not possible since 'failure_route' is just invoked
> when the final response from downstream (or the best of them) is negative.

The doc says:
-----------
3. failure_route

Failed transaction routing block. It contains a set of actions to be taken
each transaction that received only negative replies (>=300) for all
branches.

Triggered by : receiving or generation(internal) of a negative reply that
completes the transaction (all branches are terminated with negative replies)
-------------

What does it mean with "generation (internal)"? In my previous example
code "failure_route" is not invoked when OpenSIPS replies a negative response
(note that I already created the transaction with "t_newtrans").

--
Iñaki Baz Castillo

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Invoking 'failure_route[X]' when OpenSIPS replies [3456]XX by itself

Brett Nemeroff
Why not just call a normal route after you send your negative reply?
-Brett


On Wed, Nov 26, 2008 at 9:49 AM, Iñaki Baz Castillo <[hidden email]> wrote:
El Miércoles, 26 de Noviembre de 2008, Iñaki Baz Castillo escribió:
> Hi, is possible to invoke 'failure_route[X]' after OpenSIPS has sent a
> negative reply by itself to the caller? In this case the reply would be
> sent to the caller but it would selected as final reply.
>
> Well, I expect this is not possible since 'failure_route' is just invoked
> when the final response from downstream (or the best of them) is negative.

The doc says:
-----------
3. failure_route

Failed transaction routing block. It contains a set of actions to be taken
each transaction that received only negative replies (>=300) for all
branches.

Triggered by : receiving or generation(internal) of a negative reply that
completes the transaction (all branches are terminated with negative replies)
-------------

What does it mean with "generation (internal)"? In my previous example
code "failure_route" is not invoked when OpenSIPS replies a negative response
(note that I already created the transaction with "t_newtrans").

--
Iñaki Baz Castillo

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


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Invoking 'failure_route[X]' when OpenSIPS replies [3456]XX by itself

Iñaki Baz Castillo
El Miércoles, 26 de Noviembre de 2008, Brett Nemeroff escribió:
> Why not just call a normal route after you send your negative reply?

Because I've already coded the needed logic in a failure_route that would be
runned when a negative reply comes from the callee. But I want the same
behaviour when I (OpenSIPS) send the negative reply.

I could do the following (but it's not very cool):

---------
route[TO_USER] {
       
        t_on_failure("TO_USER");

        # some_custom_query...
        if $rc = ... {
                # I decide to reject the call
                # First create the transaction ("failure_route" could have
sense)
                t_newtran();
                route(FAILURE);
                exit;
        }

        # do loockup and so...
        t_relay();
}

failure_route[TO_USER] {

        route(FAILURE);

}

route[FAILURE] {

        if $fU == "alice" {
                $ru = "sip:voicemail@server";
                append_branch();
        }

}
---------

--
Iñaki Baz Castillo

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Invoking 'failure_route[X]' when OpenSIPS replies [3456]XX by itself

Brett Nemeroff
That's better than what I had in mind. :) 

I don't think that's too bad really.. Conforms with all the rules of what a failure route is for.. so I think that's a good way to do it.

Just my $0.02

-Brett


On Wed, Nov 26, 2008 at 10:29 AM, Iñaki Baz Castillo <[hidden email]> wrote:
El Miércoles, 26 de Noviembre de 2008, Brett Nemeroff escribió:
> Why not just call a normal route after you send your negative reply?

Because I've already coded the needed logic in a failure_route that would be
runned when a negative reply comes from the callee. But I want the same
behaviour when I (OpenSIPS) send the negative reply.

I could do the following (but it's not very cool):

---------
route[TO_USER] {

       t_on_failure("TO_USER");

       # some_custom_query...
       if $rc = ... {
               # I decide to reject the call
               # First create the transaction ("failure_route" could have
sense)
               t_newtran();
               route(FAILURE);
               exit;
       }

       # do loockup and so...
       t_relay();
}

failure_route[TO_USER] {

       route(FAILURE);

}

route[FAILURE] {

       if $fU == "alice" {
               $ru = "sip:voicemail@server";
               append_branch();
       }

}
---------

--
Iñaki Baz Castillo

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


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