[OpenSIPS-Users] variable interpolation in strings

Liviu Chircu liviu at opensips.org
Wed Mar 31 16:38:31 EST 2021


On 31.03.2021 19:34, Kingsley Tart wrote:
> Why does this code:
>
> 	$var(oldstr) ="sip:_44*121-1234@";
> 	$var(uriOLD) = "<$var(oldstr)batty.com;user=phone>";
> 	xlog("TEST=<$var(oldstr)batty.com;user=phone>");
> 	xlog("uriOLD=$var(uriOLD)");
>
> Result in these log entries?

Hi,

This issue has been in there since forever, catching many of us (myself 
included) off-guard at times.  For now, the solution is to just 
concatenate strings in variable assignment expressions using the "+" 
operator:

$var(uriOLD) = "<" + $var(oldstr) + "batty.com;user=phone>";

As for when or if this is going to be addressed... is subject to a longer discussion...

Best regards,

-- 
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com
OpenSIPS eBootcamp 2021 | www.opensips.org/training




More information about the Users mailing list