dialog lifetime refresh issue

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

dialog lifetime refresh issue

seanchann
I use time_avp set my custom timeout for dialog lifetime, then update dialog lifetime when recive uac's re-invite(include sessiom-timer header),  but dialog send BYE to uac , it seems lifetime not refresh in re-invite.
scritpt like this:

    if (has_totag()) {
       if (loose_route()) {
          if (is_method("INVITE")) {
                # even if in most of the cases is useless, do RR for
                # re-INVITEs alos, as some buggy clients do change route set
                # during the dialog.
                record_route();
                               
                if($(hdr(Session-Expires))){
                    if(match_dialog()){
                        # handling the case "Session-Expires:4000;refresher=uac"
                        $var(se_value) = $(hdr(Session-Expires){s.select,0,;});

                        if($(var(se_value){s.int})>=SIP_MIN_SESSION_TIME){
                            $avp(session_expires) = $(var(se_value){s.int});
                            xlog("L_INFO", "set session timer by reinvite se_value:$(var(se_value){s.int}) dlg_lifettime:$DLG_lifetime seconds\n");
                        }else{
                            xlog("L_ERR", "Session timer not refreshed");
                        }
                    }else{
                        sl_send_reply("481", "Transaction Does Exist");
                        exit;
                    }
                }
               
                if (is_present_hf("Proxy-Authorization")) {
                    remove_hf("Proxy-Authorization");
                }  
                               
            }
       }
    }


.......

    if (is_method("INVITE")) {
        # check Session time and Min-Se header if exist.update dialog timer
        if($hdr(Session-Expires)){
            # Handling the case "Session-Expires:4000;refresher=uac"
            $var(se_value) = $(hdr(Session-Expires){s.select,0,;});
                       
            if(sstCheckMin("1")){
                xlog("L_ERR", "422 Session Timer Too Small reply send.\n");
                exit;
            }
            create_dialog("B");
                       
            $avp(session_expires) = $(var(se_value){s.int});
            xlog("L_INFO", "set session timer for invite se_value:$var(se_value) dlg_lifet:$DLG_lifetime seconds\n");
                       
        }
               
        setflag(ACC_DO); # do accounting
    }
Reply | Threaded
Open this post in threaded view
|

Re: dialog lifetime refresh issue

Bogdan-Andrei Iancu-2
Hi,

Maybe something is missing me, but the only operation you do is to write
into $avp(session_expires)- I do not understand how you push this info
into the dialog module . Are you using an version < 1.10 with
tinmeout_avp modparam (
http://www.opensips.org/html/docs/modules/1.10.x/dialog.html#timeout-avp-id 
) ?

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 10.09.2014 04:19, chow wrote:

> I use time_avp set my custom timeout for dialog lifetime, then update dialog
> lifetime when recive uac's re-invite(include sessiom-timer header),  but
> dialog send BYE to uac , it seems lifetime not refresh in re-invite.
> scritpt like this:
>
>      if (has_totag()) {
>         if (loose_route()) {
>            if (is_method("INVITE")) {
>                  # even if in most of the cases is useless, do RR for
>                  # re-INVITEs alos, as some buggy clients do change route set
>                  # during the dialog.
>                  record_route();
>                                  
>                  if($(hdr(Session-Expires))){
>                      if(match_dialog()){
>                          # handling the case
> "Session-Expires:4000;refresher=uac"
>                          $var(se_value) =
> $(hdr(Session-Expires){s.select,0,;});
>
>                          if($(var(se_value){s.int})>=SIP_MIN_SESSION_TIME){
>                              $avp(session_expires) = $(var(se_value){s.int});
>                              xlog("L_INFO", "set session timer by reinvite
> se_value:$(var(se_value){s.int}) dlg_lifettime:$DLG_lifetime seconds\n");
>                          }else{
>                              xlog("L_ERR", "Session timer not refreshed");
>                          }
>                      }else{
>                          sl_send_reply("481", "Transaction Does Exist");
>                          exit;
>                      }
>                  }
>                  
>                  if (is_present_hf("Proxy-Authorization")) {
>                      remove_hf("Proxy-Authorization");
>                  }
>                                  
>              }
>         }
>      }
>
>
> .......
>
>      if (is_method("INVITE")) {
>          # check Session time and Min-Se header if exist.update dialog timer
>          if($hdr(Session-Expires)){
>              # Handling the case "Session-Expires:4000;refresher=uac"
>              $var(se_value) = $(hdr(Session-Expires){s.select,0,;});
>                          
>              if(sstCheckMin("1")){
>                  xlog("L_ERR", "422 Session Timer Too Small reply send.\n");
>                  exit;
>              }
>              create_dialog("B");
>                          
>              $avp(session_expires) = $(var(se_value){s.int});
>              xlog("L_INFO", "set session timer for invite
> se_value:$var(se_value) dlg_lifet:$DLG_lifetime seconds\n");
>                          
>          }
>                  
>          setflag(ACC_DO); # do accounting
>      }
>
>
>
> --
> View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/dialog-lifetime-refresh-issue-tp7593404.html
> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> 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: dialog lifetime refresh issue

seanchann
hi,the opensips version is 1.10.1. In the code, I did not see $ DLG_timeout, so, I use timeout_avp.
I fix script config , modify  $avp(session_expires) value before  loose_route , it work. why?  

In the code , I see in dlg_handlers.c have function void dlg_onroute(struct sip_msg* req, str *route_params, void *param), this function update our dialog lifetime if timeout_avp changed.
In my option , loose_route() function triger the dlg_onroute() function.  right?

script like this:
         if (is_method("INVITE")) {
                  if($(hdr(Session-Expires))){
                          # handling the case
 "Session-Expires:4000;refresher=uac"
                          $var(se_value) =
 $(hdr(Session-Expires){s.select,0,;});
 
                          if($(var(se_value){s.int})>=SIP_MIN_SESSION_TIME){
                              $avp(session_expires) = $(var(se_value){s.int});
                              xlog("L_INFO", "set session timer by reinvite
 se_value:$(var(se_value){s.int}) dlg_lifettime:$DLG_lifetime seconds\n");
                          }else{
                              xlog("L_ERR", "Session timer not refreshed");
                          }
                  }
        }
      if (has_totag()) {
         if (loose_route()) {
            if (is_method("INVITE")) {
                  # even if in most of the cases is useless, do RR for
                  # re-INVITEs alos, as some buggy clients do change route set
                  # during the dialog.
                                   
                   
                  if (is_present_hf("Proxy-Authorization")) {
                      remove_hf("Proxy-Authorization");
                  }
                                   
              }
         }
      }
Reply | Threaded
Open this post in threaded view
|

Re: dialog lifetime refresh issue

Bogdan-Andrei Iancu-2
Hi,

yes, that is true....the idea is the loose_route() function hides the
dialog matching (for the sequential requests) ; and when this matching
is done, the lifetime / timeout is updated. So you need to set your avp
before the matching (the loose_route() ), otherwise it will be ignored.

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 10.09.2014 11:33, chow wrote:

> hi,the opensips version is 1.10.1. In the code, I did not see $ DLG_timeout,
> so, I use timeout_avp.
> I fix script config , modify  $avp(session_expires) value before
> loose_route , it work. why?
>
> In the code , I see in dlg_handlers.c have function void dlg_onroute(struct
> sip_msg* req, str *route_params, void *param), this function update our
> dialog lifetime if timeout_avp changed.
> In my option , loose_route() function triger the dlg_onroute() function.
> right?
>
> script like this:
>           if (is_method("INVITE")) {
>                    if($(hdr(Session-Expires))){
>                            # handling the case
>   "Session-Expires:4000;refresher=uac"
>                            $var(se_value) =
>   $(hdr(Session-Expires){s.select,0,;});
>  
>                            if($(var(se_value){s.int})>=SIP_MIN_SESSION_TIME){
>                                $avp(session_expires) =
> $(var(se_value){s.int});
>                                xlog("L_INFO", "set session timer by reinvite
>   se_value:$(var(se_value){s.int}) dlg_lifettime:$DLG_lifetime seconds\n");
>                            }else{
>                                xlog("L_ERR", "Session timer not refreshed");
>                            }
>                    }
>          }
>        if (has_totag()) {
>           if (loose_route()) {
>              if (is_method("INVITE")) {
>                    # even if in most of the cases is useless, do RR for
>                    # re-INVITEs alos, as some buggy clients do change route
> set
>                    # during the dialog.
>                                    
>                    
>                    if (is_present_hf("Proxy-Authorization")) {
>                        remove_hf("Proxy-Authorization");
>                    }
>                                    
>                }
>           }
>        }
>
>
>
> --
> View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/dialog-lifetime-refresh-issue-tp7593404p7593411.html
> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> 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: dialog lifetime refresh issue

seanchann
hi,
thanks a lot!