Hello,
Throughout the routes of kamailio we use multiple variables. These consist of $var, $avp, $dlg_var and probably more. What's the policy for these variables when used. When, if even, are they being cleaned up after a call has been terminated.
Is this something we need to be doing ourselves with functions like avp_delete("foo")?
Many thanks! Dirk
On Friday 10 April 2015 13:16:40 Dirk Teurlings - SIGNET B.V. wrote:
Throughout the routes of kamailio we use multiple variables. These consist of $var, $avp, $dlg_var and probably more. What's the policy for these variables when used. When, if even, are they being cleaned up after a call has been terminated.
These variables are limited to their scope, a $var is valid in the current SIP message. An $avp's scope is a SIP transaction (eg from INVITE til the end of a BYE), the same for $dlg_var but then only when using the dialog module.
Destroying seems to be handled internally by kamailio core at the end of a message, by (I guess) tm.so for $avp and dialog.so for dlg_var at the end of the transactions lifetime. You don't need to do manual garbage collection, avp_delete can be used to unset avps within scope though.
On 10 Apr 2015, at 14:21, Daniel Tryba d.tryba@pocos.nl wrote:
On Friday 10 April 2015 13:16:40 Dirk Teurlings - SIGNET B.V. wrote:
Throughout the routes of kamailio we use multiple variables. These consist of $var, $avp, $dlg_var and probably more. What's the policy for these variables when used. When, if even, are they being cleaned up after a call has been terminated.
These variables are limited to their scope, a $var is valid in the current SIP message. An $avp's scope is a SIP transaction (eg from INVITE til the end of a BYE),
No, a transaction is a request and the attached responses. From an INVITE to the final response or a BYE to the final response to the BYE - it's not in between INVITE and BYE.
the same for $dlg_var but then only when using the dialog module.
THis applies to the call.
/O
On Friday 10 April 2015 14:45:17 Olle E. Johansson wrote:
These variables are limited to their scope, a $var is valid in the current SIP message. An $avp's scope is a SIP transaction (eg from INVITE til the end of a BYE),
No, a transaction is a request and the attached responses. From an INVITE to the final response or a BYE to the final response to the BYE - it's not in between INVITE and BYE.
Subtle difference, dlg_vars now make sense to me.
Thanks for correcting my views.
On 10/04/15 14:21, Daniel Tryba wrote:
On Friday 10 April 2015 13:16:40 Dirk Teurlings - SIGNET B.V. wrote:
Throughout the routes of kamailio we use multiple variables. These consist of $var, $avp, $dlg_var and probably more. What's the policy for these variables when used. When, if even, are they being cleaned up after a call has been terminated.
These variables are limited to their scope, a $var is valid in the current SIP message. An $avp's scope is a SIP transaction (eg from INVITE til the end of a BYE), the same for $dlg_var but then only when using the dialog module.
Some corrections to the above:
- $var(...) is persistent in the context of the process, independent of the sip message processed at that moment - $avp(...) (and $xavp(...) for that matter) - is persistent in the context of the sip transaction, from the request to the final response of that request. For example, from INVITE to 200ok of the INVITE - $dlg_var(...) - is persistent in the context of the dialog (or call) - from the INVITE to the BYE
Destroying seems to be handled internally by kamailio core at the end of a message, by (I guess) tm.so for $avp and dialog.so for dlg_var at the end of the transactions lifetime. You don't need to do manual garbage collection, avp_delete can be used to unset avps within scope though.
$var(...) at not destroyed at runtime, but avp, xavp and dlg_var are destroyed when their context is destroyed.
Cheers, Daniel