[SR-Users] Keeping track of routing/dialog attribute value pairs

Daniel-Constantin Mierla miconda at gmail.com
Fri Apr 10 14:46:35 CEST 2015



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

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - http://www.kamailioworld.com




More information about the sr-users mailing list