On Jul 02, 2009 at 16:13, Jan Janak <jan(a)iptel.org> wrote:
[...]
So, how are
ser identifiers and Kamailio pseudo-variables
differentiated? Both start with $.
e.g. in Kamailio $fd is the domain of the URI in the From header.
Ohh, that's a very good point and this is also probably the reason why Juha
was asking about the lookup_domain("$fd", "$fd") example--but I
didn't get it.
I am not sure now whether $fd in the second parameter of lookup_domain will be
treated as an AVP or as a pseudo-variable, Andrei?
lookup_domain works only with avps, selects and string params. It won't
try to lookup its param as a pvar.
In general in the script (and not in modules calls), when something
starts with $ and does not have one of the avp list prefixes (fd., fu.
a.s.o), first pvars will be looked up and if there is no result the
avps.
To make the same thing work for most ser modules, the fixup_* functions
(e.g.: fixup_var_str_12 that is used by lookup_domain) from sr_module.c
should be modified either in a similar way, or they should just try
fix_param(FPARAM_AVP, param) if first fix_param(FPARAM_PVS, param)
failed. One might need to remove the error messages printed by
fix_param() if AVP or PVAR parsing fails (to allow for retrying with AVP
or PVARs without filling the log with errors).
Note that fix_param(FPARAM_PVS, param) already works. The only change
needed might be removal of parse error messages and maybe a quicker check
for AVP (e.g. if 2nd or 3rd char is '.' is probably an AVP => don't try
PV lookup).
The get_*_fparam functions also work, so only minor changes would be
needed and lots of testing.
Andrei