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

Newlin, Ben Ben.Newlin at inin.com
Fri Jan 27 15:18:38 EST 2017


For the hard-coded string, my suggestion was to remove the quotes completely. Most transformations don’t want quotes, even on string-type input.

$var(index) = $(var(source){s.index, one});

For the variable, I can’t help as I’m not using it. I can confirm it works with a route parameter:

$var(index) = $(var(source){s.index, $param(1)});

Ben Newlin
Lead Voice Network Engineer, PureCloud
T:  +1 317 957 1009
ben.newlin at inin.com


From: Users <users-bounces at lists.opensips.org> on behalf of Jock McKechnie <jock.mckechnie at gmail.com>
Reply-To: OpenSIPS users mailling list <users at lists.opensips.org>
Date: Friday, January 27, 2017 at 2:11 PM
To: OpenSIPS users mailling list <users at lists.opensips.org>
Subject: Re: [OpenSIPS-Users] s.index madness and my waning grip on sanity

Thanks Ben;

As you say, the s.index is in the 1.11 docs. I had a brief moment of
panic when Liviu suggested otherwise until I checked, verified, and
then your mail popped up confirming.

I tried single quotes on both variable declarations, I tried the index
with the var ($var(search)) and a string ('one') with the same error,
so that doesn't appear to be it. I'd wonder if it didn't like this
type of variable... except it's documented to work this way.
$var(source) = 'onetwothree';
$var(search) = 'one'
$var(index) = $(var(source){s.index, $var(search)});
$var(index) = $(var(source){s.index, 'one'});

Even though you use this differently, would you be willing to post
your working example just so I have something else to stare at?

And if anyone else has any bright ideas, I'm definitely all ears (or eyes);

Thanks very much;

- Jock


On Fri, Jan 27, 2017 at 12:17 PM, Newlin, Ben <Ben.Newlin at inin.com<mailto:Ben.Newlin at inin.com>> wrote:
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<mailto:users-bounces at lists.opensips.org>> on behalf of Liviu Chircu
<liviu at opensips.org<mailto:liviu at opensips.org>>
Reply-To: OpenSIPS users mailling list <users at lists.opensips.org<mailto:users at lists.opensips.org>>
Date: Friday, January 27, 2017 at 1:10 PM
To: "users at lists.opensips.org<mailto:users at lists.opensips.org>" <users at lists.opensips.org<mailto: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




_______________________________________________
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/cbe1f2b8/attachment-0001.html>


More information about the Users mailing list