CANCEL and 408 Request Timeout when fr_inv_timer expires

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

CANCEL and 408 Request Timeout when fr_inv_timer expires

Ricardo Lopez Camino
Hi List,
I'm having a problem with the following setup.
 
Asterisk as B2BUA and OpenSIPS as proxy and Registrar, both running on the same Box with different virtuals IPs.
 
Clients are registered in opensips, but the INVITEs are routed to asterisk (caller leg) and then asterisk generates an INVITE back to opensips (called leg).
 
Asterisk IP: 10.121.1.251      asterisk16-1.6.0.1
OpenSIPS IP: 10.121.1.252   opensips-1.4.2
Caller IP: 10.121.1.101          Bria 2.2
Called IP: 10.121.1.104         Bria 2.2
 
When the fr_iv_timer expires OpenSIPS sends a 408 to asterisk and that event should trigger the voicemail greeting (200 OK) in the Caller Leg. The problem is that OpenSIPS sends a CANCEL after the 408 and asterisk can not send the 200 OK. This is some kind of race condition because sometimes the 200 OK (in the caller leg) is sent but the call is canceled anyway and the voicemail greeting is not reproduced.
So, Is it possible to change this behavior without modify the source code?
 
The following are the relevant fragments of the opensips.cfg file
 ------------------------
# ----- TM params -----
modparam("tm", "fr_timer", 10)
modparam("tm", "fr_inv_timer", 20)
modparam("tm", "wt_timer", 5)
modparam("tm", "delete_timer", 2)
modparam("tm", "ruri_matching", 1)
modparam("tm", "via1_matching", 1)
modparam("tm", "unix_tx_timeout", 2)
modparam("tm", "restart_fr_on_each_reply", 1)
modparam("tm", "pass_provisional_replies", 1)
#-----Failure Route----
failure_route[1] {
        if (t_was_cancelled()) {
                exit;
        }
}
 
I dont want to use Voicemail Diversion (with a new redirected INVITE generated by opensips), I would rather use the asterisk VoiceMail app as second priority after the Dial app.
 
Regards,
 
Ricardo

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

LEG_CALLER_408.txt (2K) Download Attachment
LEG_CALLED_408.txt (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: CANCEL and 408 Request Timeout when fr_inv_timer expires

Iñaki Baz Castillo
2008/12/29 Ricardo Lopez Camino <[hidden email]>:

> The following are the relevant fragments of the opensips.cfg file
>  ------------------------
> #-----Failure Route----
> failure_route[1] {
>         if (t_was_cancelled()) {
>                 exit;
>         }
> }

You need to inspect the selected response code in failure_route and if
it's 408 then append_branch to the voicemail server URI. Are you doing
it?

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

Re: CANCEL and 408 Request Timeout when fr_inv_timer expires

Ricardo Lopez Camino
I've tried redirecting the request to the voicemail URI, when the tm timer expires.
---
if (t_check_status("480|408")) {
               revert_uri();
               sethostport("voicemail_ip:5060");
               append_branch();
               t_relay();
      }
---
 
But that's not the way I want the voicemail working. What I'm looking for is a way to respond "408 Request Timeout" only in the LEG2 initiated by asterisk (and send just one CANCEL to User 2 (called)). That way asterisk will respond 200 OK to User 1 (LEG 1) and this user will be able to record a voicemail message.
 
                                    LEG1                      B2BUA                                LEG2
User 1 ---------------->> OpenSIPS -------------->> Asterisk --------------------->> OpenSIPS ------------>> User 2
                                       |-------------------------------------------------------------------------|
 
I've found what the problem is. Using this Setup, the timer (most of the times) expires simultaneously in both legs and that's the reason of why the CANCEL and the 408 are sent to both legs as well.
I dont know if there is a way to change this behavior by configuration. I'm going through the code to better understand how the tm module works. Thanks for youtr help.
 
Regards,
 
Ricardo
On Mon, Dec 29, 2008 at 6:34 AM, Iñaki Baz Castillo <[hidden email]> wrote:
2008/12/29 Ricardo Lopez Camino <[hidden email]>:

> The following are the relevant fragments of the opensips.cfg file
>  ------------------------
> #-----Failure Route----
> failure_route[1] {
>         if (t_was_cancelled()) {
>                 exit;
>         }
> }

You need to inspect the selected response code in failure_route and if
it's 408 then append_branch to the voicemail server URI. Are you doing
it?

--
Iñaki Baz Castillo
<[hidden email]>
_______________________________________________
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: CANCEL and 408 Request Timeout when fr_inv_timer expires

Iñaki Baz Castillo
El Martes, 30 de Diciembre de 2008, Ricardo Lopez Camino escribió:
> I've found what the problem is. Using this Setup, the timer (most of the
> times) expires simultaneously in both legs and that's the reason of why the
> CANCEL and the 408 are sent to both legs as well.

In tm module there is a paramater to set an AVP with the expire time for the
branch.
You can set that AVP to a different value depending on the 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: CANCEL and 408 Request Timeout when fr_inv_timer expires

Ricardo Lopez Camino
Great!!. Finally I´ve set the fr_inv_timer like this
 
modparam("tm", "fr_inv_timer", 40)
modparam("tm", "fr_inv_timer_avp", "$avp(s:callee_fr_inv_timer)")
And when an initial INVITE comes from Asterisk (Called LEG) the following avp function is invoked
 
avp_printf("$avp(s:callee_fr_inv_timer)", "30");
 
That way the timer hits first in that LEG and the Voicemail App works perfectly in the other (caller) LEG. 

Thanks!!!
 
Ricardo
On Tue, Dec 30, 2008 at 6:16 PM, Iñaki Baz Castillo <[hidden email]> wrote:
El Martes, 30 de Diciembre de 2008, Ricardo Lopez Camino escribió:
> I've found what the problem is. Using this Setup, the timer (most of the
> times) expires simultaneously in both legs and that's the reason of why the
> CANCEL and the 408 are sent to both legs as well.

In tm module there is a paramater to set an AVP with the expire time for the
branch.
You can set that AVP to a different value depending on the 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
Reply | Threaded
Open this post in threaded view
|

Re: CANCEL and 408 Request Timeout when fr_inv_timer expires

Iñaki Baz Castillo
El Miércoles, 31 de Diciembre de 2008, Ricardo Lopez Camino escribió:
> Great!!. Finally I´ve set the fr_inv_timer like this
>  
> modparam("tm", "fr_inv_timer", 40)
> modparam("tm", "fr_inv_timer_avp", "$avp(s:callee_fr_inv_timer)")
> And when an initial INVITE comes from Asterisk (Called LEG) the following
> avp function is invoked

> avp_printf("$avp(s:callee_fr_inv_timer)", "30");

You can do the same in a simpler way by just doing:

  $avp(s:callee_fr_inv_timer) = 30;

  
> That way the timer hits first in that LEG and the Voicemail App works
> perfectly in the other (caller) LEG. 
>
> Thanks!!!

:)

--
Iñaki Baz Castillo

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