[Kamailio-Users] Kamailio 3.0.0: configuration request regarding VARIABLES usage (custom variables + $var(x))

Alex Balashov abalashov at evaristesys.com
Mon Feb 22 11:59:44 CET 2010


On 02/22/2010 05:47 AM, Klaus Feichtinger wrote:

>
> QUESTION 1:
> ==========
> Is it impossible using a variable for requesting a SRC_IP address? With my
> current configuration I always see an entry in the SYSLOG that looks as
> follows:  "<core>  [route.c:1531]: BUG: comp_ip: invalid type for  src_ip or dst_ip (20)"
>
> The configuration lines look like:
>
> $var(lst_gwIpRange) = "10.16.48.6[0-2]";
> [...]
> if (src_ip=~$var(lst_gwIpRange)) {
> 	[...]
> }

The problem is that 'src_ip' is one of the composite types used in the 
core and cannot be evaluated against a regular expression.  The type 
that 'src_ip' has is just not part of the grammar surrounding the '=~' 
operator.

Use $si instead.  It will have an identical value.  For more 
information, see:

http://www.kamailio.org/dokuwiki/doku.php/pseudovariables:3.0.x

> QUESTION 2:
> ==========
> The second problem I found is, that the config variables can be configured
> within a route block only and not - as expected - e.g. at the top of the
> config file (in the same way as the custom variables). I can't use the
> custom variablesas they are, because I will use more complex variables,
> which are a mixture of up to three custom variables. These "complex" variables
> will be used in more than one routing block. Therefore I have to define these
> variables in every routing block...... Is an alternative (easier) solution with
> a single definition available, too?

This question I cannot answer and will defer to the developers, because 
I am confused by your use of custom "selects."  It was my impression 
that select namespaces are only defined by modules and the user cannot 
come up with them on his own, e.g. like 'tst'.

I also am not sure that there is a nice, elegant way to initialise 
variables in a global namespace right now except shared variables 
($shv(...), in the 'pv' module), even though I would agree that such a 
thing would be immensely useful.


-- 
Alex Balashov - Principal
Evariste Systems LLC

Tel    : +1 678-954-0670
Direct : +1 678-954-0671
Web    : http://www.evaristesys.com/



More information about the Users mailing list