[OpenSIPS-Users] Problem using xlog with variables
Bogdan-Andrei Iancu
bogdan at opensips.org
Fri Dec 2 09:56:38 CET 2016
Hi Jan,
You can print via variables strings containing again references to other
variables - there is only one level of variable evaluation.
You should do it:
$var(msg) = $rm + "received on " + $var(hostname);
xlog("L_INFO", "$var(msg)");
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com
On 01.12.2016 23:36, Jan Blom wrote:
>
> Hello all,
>
> I was going to centralized logging functions to a route block that
> would be called from various place in script, using $param(n) to
> access the log message. I got stuck on what I guess is variable
> evaluation. Simplified this is the problem:
>
> The normal (working) way:
>
> xlog("L_INFO", "$rm received on $var(hostname)");
>
> Output: INVITE received on proxy-stage-01
>
> What I was trying:
>
> $var(msg) = "$rm received on $var(hostname)";
>
> xlog("L_INFO", "$var(msg)");
>
> Output: $rm received on $var(hostname)
>
> In the latter case the variables are not evaluated the way I was
> expecting.
>
> Is there a better way to achieve the output of the first example by
> using a variable containing the message to xlog?
>
> I am testing this on OpenSIPS 2.1.
>
> Best regards,
>
> Jan Blom
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20161202/6468cb1e/attachment.htm>
More information about the Users
mailing list