[SR-Users] Kamailio config file String Concatenation

Alex Balashov abalashov at evaristesys.com
Wed May 2 17:05:40 CEST 2018

You are correct that concatenation vs interpolation works and doesn't work in slightly inconsistent ways, for instance function string arguments vs assignment.

The $_s() transformation may help make life easier. 

On May 2, 2018 10:50:53 AM EDT, George Diamantopoulos <georgediam at gmail.com> wrote:
>I'm a a bit confused as to when string concatenation will work in
>config file. So far I have identified the following cases:
>As part of the right hand side of an assignment:
>$var(x) = "string1" + "string2";
>String argument of some functions:
>xlog("L_ERR", "string1" + "string2" + DEFINED_STRING + '\n');
>Conditional Statements:
>if ( ru =~ "$" + "sip:" + $var(user) ) {
>Not Working:
>In string transformations (the fact that quotes is not part of the
>should give a hint though:
>$var(x) = $(var(y){s.replace,match,"repl1" + "repl2"});
>String argument of some other functions:
>append_hf_value("P-Asserted-Identity", "<" + "$var(new_pai)" + ">");
>lookup("location", "sip:$var(username)@" + SIP_REALM_DEFINITION));
>In module parameter definitions:
>modparam("nathelper", "sipping_from", "sip:keepalive@" +
>So far, I have found this to be fairly consistent, except for use
>functions. For example, string concatenation works for the second
>of xlog, but not for the string arguments of append_hf_value() or
>Is there anyway to know this for each function beforehand, or is my
>choice to go through trial and error here? Thanks!

-- Alex

Sent via mobile, please forgive typos and brevity. 

More information about the sr-users mailing list