[Kamailio-Users] avpops OR sqlops

Daniel-Constantin Mierla miconda at gmail.com
Wed Dec 23 10:28:56 CET 2009


Hello,

On 12/21/09 11:56 PM, Henning Westerholt wrote:
> On Mon, December 21, 2009 9:50 pm, Alex Balashov wrote:
>    
>> [..]
>> Having said that, AVPs are still very useful and necessary because they
>> persist across the lifetime of a transaction, so you can access them in
>> subsequent reply and failure routes.  This is not true of user
>> pseudovariables ($var(...)), nor, as far as I know, of any other class
>> of pseudovariable at this point except special transaction-persistent
>> ones exported by modules.
>>
>> As a result, it is often necessary for me to take data from $dbr
>> (sqlops) and load it into arrays of AVPs, such as for example when doing
>> custom fail-over in failure_route that uses logic for which dispatcher
>> is not suitable.  I store a set of gateways in an AVP array along with
>> another AVP value indicating the current array index and iterate over
>> them in failure_route, and so on.
>>
>> Daniel taught me how to use AVP arrays once, although I noticed this is
>> not mentioned anywhere in the avpops documentation.  It should be
>> published somewhere, as it is one of the most useful programmatic
>> features of Kamailio.
>>
>> Henning/Daniel, does Kamailio 3/SR offer any kind of better substitute
>> for what I am doing with AVPs as described above?  In other words, are
>> there any transaction-persistent pseudovariables and/or namespace
>> containers that are easier to deal with syntactically, and provide more
>> advanced data structure primitives like arrays?  I am aware of htable,
>> but I need something local to a transaction, not global.
>>      
> There are the $var PVs you already mentioned, and then also the $shv that
> are shared variables. But they are (process) global, and not
> transactional. Daniel proposed and developed the new xavp type for sr
> which are basically extended AVPs. More informations can be found here:
> http://sip-router.org/wiki/devel/xavp
>
>    
as Henning said, xavp try to become a bit more friendly to config 
admins, but it is not adopted in any other module, you can use them just 
in config.

Otherwise, the AVPs are the only one that help you for scenarios like 
failover. Note that with Kamailio 3.0 there are several lists of AVPs, 
inherited from SER, more here:
http://sip-router.org/wiki/devel/avps-ser

Kamailio AVPs map in the From list.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
* http://www.asipto.com/




More information about the Users mailing list