[sr-dev] Feature request: sql row number, route-specific avps

Henning Westerholt henning.westerholt at 1und1.de
Tue Apr 6 12:38:35 CEST 2010


On Friday 02 April 2010, Jasmin Schnatterbeck wrote:
> I use the function sql_query() instead of avp_db_query now, works
> perfectly...

Hello Jasmin,

good. :)
 
> Regarding the route specific AVPs the idea is to make it possible to
> have something like "private" variables (compared with e.g. c-code).

There are a number of different variables available, like the ones from 
htable, the shared memory variable '$shv', the $var and of course the $avp. 
The $var is specific to every process, so they have a smaller visibility 
compared to the others, which are global or transactional usable.

> If private variables would be available, they would be very useful for
> recursive route calls. Otherwise (as you have stated) you need different
> variables for every recursion. The same with iterations, because if you
> convert the recursion to an iteration, you need a stack to save values
> temporarily (of course the same happens with recursions, but then you do
> not have to do it by yourself) and (that's the main problem) at this
> point, you do not now, how many recursion levels will be there, so you
> do not know also, how much avps/variables you need to save the stack.
> 
> With avp_pushto (as I understand the module doc) it is only possible to
> push avps into sip-msg (r-uri/domain etc.). Or can you also use that
> function to build something like a memory stack?

My explanation was probably a bit unclear. I think you could use AVPs as a 
list, storing different values serially in in _one_ $avp, and then loop over 
it, use and delete the head variable. Something as described here: 
http://www.kamailio.org/dokuwiki/doku.php/tutorials:avpops#serial_forking

(avp_write was removed in the past, you can assign values directly in the cfg)

Regards,

Henning



More information about the sr-dev mailing list