Thanks,
I did as previously suggested and used line.at instead. It works so my issue can be
considered solved. But yes, I agree it can be a useful feature to introduce.
/M
From: Daniel-Constantin Mierla <miconda(a)gmail.com>
Reply to: "miconda(a)gmail.com" <miconda(a)gmail.com>
Date: Thursday, 20 May 2021 at 13:28
To: "Kamailio (SER) - Users Mailing List" <sr-users(a)lists.kamailio.org>rg>,
Martin Nyström <martin.nystrom(a)connectel.se>
Subject: Re: [SR-Users] Text transformations s.select and newline char
Hello,
the separator has to be a single character as documented:
*
https://www.kamailio.org/wiki/cookbooks/5.5.x/transformations#sselect_index…
It does not support variables.
Looking at the code, it also does not support escaped characters, probably this feature
can be useful to introduce.
Cheers,
Daniel
On 17.05.21 12:03, Martin Nyström wrote:
Hello,
I am simply trying to parse a SDP body, read it line by line and save the line into a
variable for further processing. It seems when using a newline \n as the delimiter it
breaks down with errors. How should I treat this issue and properly managed the newline as
delimiter?
May 17 12:00:00 ip-10-120-120-12 kamailio[12878]: 0(12878) ERROR: pv [pv_trans.c:2326]:
tr_parse_string(): invalid select transformation: select,$var(i),$var(delimeter)}!!
May 17 12:00:00 ip-10-120-120-12 kamailio[12878]: 0(12878) ERROR: <core>
[core/pvapi.c:1717]: tr_lookup(): error parsing [{s.select,$var(i),$var(delimeter)}]
Block extracted from .cfg
sdp_get("$avp(sdp)");
$avp(lines) = $(avp(sdp){line.count});
$var(delimeter) = "\n";
$var(i) = 0;
while($var(i) < $avp(lines)) {
# This works
xlog("L_INFO", "==> Position $var(i):
$(avp(sdp){s.select,$var(i),\n}) \n");
# This fails
$var(l1) = $(avp(sdp){s.select,$var(i),$var(delimeter)});
# This fails
$var(l2) = $(avp(sdp){s.select,$var(i),\n});
# This fails
$var(l3) = $(avp(sdp){s.select,$var(i),\\n});
# Supposed to do something funny with the $var(line) here
$var(i) = $var(i) + 1;
}
/M
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.org<mailto:sr-users@lists.kamailio.org>
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
*
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla --
www.asipto.com<http://www.asipto.com>
www.twitter.com/miconda<http://www.twitter.com/miconda> --
www.linkedin.com/in/miconda<http://www.linkedin.com/in/miconda>
Kamailio Advanced Training - Online
May 17-20, 2021 (Europe Timezone) - June 7-10, 2021 (America Timezone)
*
https://www.asipto.com/sw/kamailio-advanced-training-online/