[SR-Users] Kamailio config file String Concatenation

George Diamantopoulos georgediam at gmail.com
Wed May 2 16:50:53 CEST 2018


Hello,

I'm a a bit confused as to when string concatenation will work in kamailio
config file. So far I have identified the following cases:

Working:

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 argument
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@" +
SIP_REALM_DEFINITION)

So far, I have found this to be fairly consistent, except for use within
functions. For example, string concatenation works for the second argument
of xlog, but not for the string arguments of append_hf_value() or lookup().

Is there anyway to know this for each function beforehand, or is my only
choice to go through trial and error here? Thanks!

BR,
George
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20180502/499d6aa1/attachment.html>


More information about the sr-users mailing list