[OpenSIPS-Users] s.index madness and my waning grip on sanity

Newlin, Ben Ben.Newlin at inin.com
Fri Jan 27 13:17:18 EST 2017


That is not correct. OpenSIPS 1.11 definitely contains the index transformation [1]. I’m using it in my code!

I think the problem is the quoting. For the example that uses a hard-coded search string it should work if you leave off the quotes. This is how I’m using it.

For the variable example, the only thing I can see is that the example you copied is using single quotes, while you are using double quotes. I only use s.index with a $param variable, so I’m not sure what the proper quoting is our if it will make a difference.

[1] http://www.opensips.org/Documentation/Script-Tran-1-11#toc19

Ben Newlin



From: Users <users-bounces at lists.opensips.org> on behalf of Liviu Chircu <liviu at opensips.org>
Reply-To: OpenSIPS users mailling list <users at lists.opensips.org>
Date: Friday, January 27, 2017 at 1:10 PM
To: "users at lists.opensips.org" <users at lists.opensips.org>
Subject: Re: [OpenSIPS-Users] s.index madness and my waning grip on sanity

Hi, Jock!

The answer is simple: you must be using a pre-2.2 OpenSIPS, which does
not include this transformation, just like the error message says:

"ERROR:core:tr_parse_string: unknown transformation: index"

Future advice: before reading documentation, make sure you properly
select your OpenSIPS version using the top-level switches [1]

[1]: http://www.opensips.org/Documentation/Script-Tran-2-1

Regards,

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 27.01.2017 19:26, Jock McKechnie wrote:
Good morning all;

I'm having a battle with s.index that I'd really like to believe no
one should be waging, and I've come to the conclusion either 1.11 is
seriously broken, or I'm utterly deranged, but at the risk of
verifying the second, I wanted to reach out and figure out what I'm
doing wrong here.

I seem utterly incapable of getting s.index working at all, consider
the following:

$var(source) = "onetwothree";
$var(search) = "one";
$var(index) = $(var(source){s.index, $var(search), 0});

Which should look famaliar as it's based entirely on the example in
the 1.11 documentation. This produces the following:
ERROR:core:tr_parse_string: unknown transformation: index,
$var(search), 0}/index/5! ERROR:core:parse_transformation: error
parsing [{s.index, $var(search), 0}] ERROR:core:pv_parse_spec:
ERROR:bad tr in pvar name "var" ERROR:core:pv_parse_spec: invalid
parsing in [$(var(source){s.index, $var(search), 0})] at (4)
CRITICAL:core:yyerror: parse error in config file
/etc/opensips/opensips.cfg, line 92, column 166-206: unknown script
variable

Using a static search string:
$var(index) = $(var(source){s.index, "one", 0});

Garners me the same with:
ERROR:core:tr_parse_string: unknown transformation: index, "one", 0}/index/5!

And not providing a starting offset is similar:
$var(index) = $(var(source){s.index, $var(search)});

ERROR:core:tr_parse_string: unknown transformation: index,
$var(search)}/index/5!

Given these are core transformations and I'm using several others in
my configs I'm running under the belief I'm not missing a module. I've
tried copying the doc example verbatim with identical results. What am
I missing here, people? Is it just staring me straight in the face?

My thanks;
   - Jock

_______________________________________________
Users mailing list
Users at lists.opensips.org<mailto:Users at lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
Users at lists.opensips.org<mailto:Users at lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20170127/55b1c686/attachment-0001.html>


More information about the Users mailing list