<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    there are different actions, one is assignment of an expression and
    the other is a function call. Functions can evaluate they parameters
    as they need/want by having the appropriate C code inside.<br>
    <br>
    For assignments, that is the general interpreter which considers
    strings as being the tokens in between quotes. Trying to interpret
    variables inside the strings automatically won't work, because that
    will mean to do it for cases when it should not happen (e.g.,
    modparams or function parameters that specify just name of
    variables). Of course, with some extra coding to keep states of
    where that string is used might be possible, but I think will make
    the interpreter too complex. I might be wrong, so a patch is welcome
    to prove the otherwise :-)<br>
    <br>
    Some functions can evaluate the parameter content, some don't. And
    in some cases, even there is a variable inside a parameter for a
    function, it is not evaluated, but it is set. That's again based on
    the purpose of the function.<br>
    <br>
    Instead of concatenation expression, you can use few other options:<br>
    <br>
    <br>
    - $_s(...) -- iirc, like:<br>
    <br>
    $var(x) = $_s(<a class="moz-txt-link-rfc2396E" href="sip:+$var(abc)-$var(def)-$si@$Ri:$Rp">"sip:+$var(abc)-$var(def)-$si@$Ri:$Rp"</a>);<br>
    <br>
    - pv_printf($var(x), ...)<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <div class="moz-cite-prefix">On 01/10/15 11:56, Sven Neuhaus wrote:<br>
    </div>
    <blockquote cite="mid:560D0331.8060603@tyntec.com" type="cite">
      <pre wrap="">Hello,

I'm occasionally running into issues with inconsistent string
interpolation in the kamailio.cfg.

Here's the latest example. Take this line:

$var(x) = <a class="moz-txt-link-rfc2396E" href="sip:+$var(abc)-$var(def)-$si@$Ri:$Rp">"sip:+$var(abc)-$var(def)-$si@$Ri:$Rp"</a>;

Here, the values of the variables will NOT be interpolated into the
string. Instead, I have to use this:

$var(x) = <a class="moz-txt-link-rfc2396E" href="sip:+">"sip:+"</a> + $var(abc) + "-" + $var(def) + "-" + $si + "@" + $Ri
+ ":" + $Rp;


However, when I have an instruction such as:

append_hf("P-Asserted-Identity: $var(x)\r\n");

Then string interpolation takes place (i.e. the value of $var(x) is put
into the string.

This is very confusing and error prone. Is it something that can be
fixed? The behaviour should be consistent.

-Sven

</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Book: SIP Routing With Kamailio - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
Kamailio Advanced Training, Sep 28-30, 2015, in Berlin - <a class="moz-txt-link-freetext" href="http://asipto.com/u/kat">http://asipto.com/u/kat</a></pre>
  </body>
</html>