[SR-Users] Text transformations s.select and newline char
Martin Nyström
martin.nystrom at connectel.se
Mon May 17 12:03:12 CEST 2021
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20210517/bcea9a9e/attachment.htm>
More information about the sr-users
mailing list