Hello,

ah, ok, I misunderstood.

Is the INVITE received with the header Session-Expires?

And remove the line:

#!define DLG_TIMEOUT_AVP "i:1"

It does not replaces the token inside strings, like inside the last parameter of the line:

modparam("dialog", "timeout_avp", "$avp(DLG_TIMEOUT_AVP)")

and if you use in config expressions $avp(DLG_TIMEOUT_AVP), then its name is replaced. So overall it can be two avp names, although when reading looks like one.

Cheers,
Daniel

On 22.03.20 14:40, harneet singh wrote:
Hi Daniel,

Thanks for the confirmation. Your point confirms the same as I interpreted from the documentation, that Kamailio would not send refresh INVITEs. I am not expecting to achieve that. However, if i understand correctly, Kamailio can look into the "Session-Expires" header from UAC/UAS and set the timeout_avp based on that.
In effect, Kamailio should ideally tear down the call (Send a BYE to UAC and UAS), if it doesn't see any signalling(may it be session-refresh INVITE/UPDATE or any other mid-dialog messages). This i believe can be done by using the SST Module in conjunction with the Dialog Module. 
I am also using the SST Module and the Dialog Module, however have the following issues.

1. I am seeing the following message when sending Session-Expires: 200 . 
   ""dialog [dlg_handlers.c:681]: get_dlg_timeout(): invalid AVP value, using default timeout"

Not sure what is causing this. 

2. If i try to hardcode the session-expires to a certain value, the Kamailio DOES send a BYE to UAC and UAS on the timer expiry if no signaling seen during that time. However, as pointed earlier, the Dialog Load on the Kamailio DOES NOT go down, as shown in the last email.

FWIW, here's the config snippet from the Kamailio cfg i am using.
  ==========================================================================  
#!define DLG_TIMEOUT_AVP "i:1"

# ----------- dialog params -----------
modparam("dialog", "send_bye", 1)
modparam("dialog", "timeout_avp", "$avp(DLG_TIMEOUT_AVP)")
modparam("dialog", "dlg_flag", 5)

# ----------- sst params -----------
modparam("sst", "enable_stats", 1)
modparam("sst", "min_se", 150)
# Set the sst modules timeout_avp to be the same value
modparam("sst", "timeout_avp", "$avp(DLG_TIMEOUT_AVP)")
#modparam("sst", "reject_to_small", 1)
modparam("sst", "sst_flag", 6)


request_route {
     ....... 
     ....... 
    # account only INVITEs
if (is_method("INVITE")) {
                setflag(FLT_ACC); # do accounting
                
                setflag(5); # set the dialog flag
                setflag(6); # Set the sst flag
                $dlg_ctx(timeout_bye)=1;

                if (sstCheckMin("1")) {
                   xlog("L_ERR", "422 Session Timer Too Small reply sent.\n");
                   exit;
                }

}
 .....
......
}


==========================================================================

From the SST documentation, it pretty much seems like the only config to do. Am I missing something. If you have a working config for the Kamailio tuned in this manner using the SST and Dialog Module, could you share the same?
Any pointers to make it work are most welcome. 

Regards,
Harneet



On Sun, Mar 22, 2020 at 3:01 PM Daniel-Constantin Mierla <miconda@gmail.com> wrote:

Hello,

are you looking for Kamailio to send re-INVITEs? If yes, that is not available as a feature of dialog module.

Cheers,
Daniel

On 21.03.20 10:39, harneet singh wrote:
Hi,

I am fairly new to Kamailio and had a question regarding how to use Kamailio to enable Session refresh functionality when Kamailio is acting as Sip Stateful Proxy. 
Kamailio Version used: 5.3.2 with Call Load based routing using the dispatcher module.


* From what i understand from the documentation, Kamailio will probably not be acting as a session refresher, but Kamailio can tear down the call in case session refresh is negotiated, between the caller and the callee(via Kamailio Sip Proxy), and no message exchange happens in the duration set in Session-Expires header. Is my understanding correct?

* I believe the above functionality is possible by using the sst and dialog module. I have set the same according to the documentation but I keep getting the following error:
"dialog [dlg_handlers.c:681]: get_dlg_timeout(): invalid AVP value, using default timeout"
Can someone share a working example?

* When i tried hardcoding the timeout value by setting the timeout_avp to a specific value, Kamailio did sense a timeout and hence sent a BYE towards the caller and the Callee side both(which is what the requirement is), however, i do see the dialog is still not cleared in the "kamcmd dispatcher.list". Output excerpt below for reference:

[root@CPaaSVM ~]# kamcmd dispatcher.list
{
        NRSETS: 1
        RECORDS: {
                SET: {
                        ID: 1
                        TARGETS: {
                                DEST: {
                                        URI: sip:172.27.44.121:5080;transport=tcp
                                        FLAGS: AP
                                        PRIORITY: 0
                                        ATTRS: {
                                                BODY: duid=sample-cas;maxload=1000
                                                DUID: sample-cas
                                                MAXLOAD: 1000
                                                WEIGHT: 0
                                                RWEIGHT: 0
                                                SOCKET:
                                        }
                                        LATENCY: {
                                                AVG: 111.304000
                                                STD: 1042.193000
                                                EST: 2.385000
                                                MAX: 9999
                                                TIMEOUT: 1
                                        }
                                        RUNTIME: {
                                                DLGLOAD: 1
                                        }
                                }
                        }
                }
        }
}

It is noteworthy that in case the BYE is initiated by either the caller or the callee, the dialog is cleared properly and the DLGLOAD is set to 0 on call termination. 

Any pointers for the above questions would be highly appreciated. 

Regards,
Harneet

--
"Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth" - Sir Arthur Conan Doyle

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda


--
"Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth" - Sir Arthur Conan Doyle
-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda