[SR-Users] Kamailio config file String Concatenation
abalashov at evaristesys.com
Wed May 2 19:58:02 CEST 2018
On Wed, May 02, 2018 at 08:52:03PM +0300, George Diamantopoulos wrote:
> - Will $_s() work before the routing part of the config file, and
> specifically with pre-processor definitions? For example in the following:
> modparam("nathelper", "sipping_from", $_s(sip:keepalive at SIP_REALM_DEFINITION
No. Transformations work in route script only.
> - Will providing PVs in a dynamic string work with all functions, even for
> those currently not supporting string concatenation? E.g.:
> append_hf_value("P-Asserted-Identity", "<$var(new_pai)>");
Only for functions which support PV interpolation. That's most
functions nowadays, but not some of the older ones from OpenSER <= 1.2.
> If yes, I assume this will only work for PVs, as preprocessor defined
> strings won't be substituted if the parser finds their labels enclosed in
> quotes. In other words, the following won't work:
> append_hf_value("P-Asserted-Identity", "<$var(new_pai);SOME_DEF>");
It will if SOME_DEF was defined via #!subst.
> - I assumed this would work in the first example, but maybe I should ask
> explicitly. Will pre-processor defines work with the $_s() PV? Is this
> valid at all?
Not if SOME_PREPROC_DEF is a #!defined constant, no. But it will work if
it's a #!subst, as is also the case if it appears in strong constants.
$var(x) = 'abc123';
May 02 13:57:42 allegro-1.evaristesys.com /usr/local/sbin/kamailio: INFO: <script>: sip:s at 10.150.20.2;xyz=abc123
Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
More information about the sr-users