<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello,</p>
<p>the separator has to be a single character as documented:</p>
<p> *
<a class="moz-txt-link-freetext" href="https://www.kamailio.org/wiki/cookbooks/5.5.x/transformations#sselect_index_separator">https://www.kamailio.org/wiki/cookbooks/5.5.x/transformations#sselect_index_separator</a></p>
<p>It does not support variables.</p>
<p>Looking at the code, it also does not support escaped characters,
probably this feature can be useful to introduce.</p>
<p>Cheers,<br>
Daniel<br>
</p>
<div class="moz-cite-prefix">On 17.05.21 12:03, Martin Nyström
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CE2C16BA-4C84-454A-9428-2CA2F0390577@connectel.se">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
mso-fareast-language:EN-US;}div.WordSection1
{page:WordSection1;}</style>
<div class="WordSection1">
<p class="MsoNormal"><span lang="SV">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="SV"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">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?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal">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)}!!<o:p></o:p></p>
<p class="MsoNormal">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)}]<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="SV">Block extracted from .cfg<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB">sdp_get("$avp(sdp)");<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB">$avp(lines)
= $(avp(sdp){line.count});<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB">$var(delimeter)
= "\n";<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB">$var(i) =
0;<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB">while($var(i)
< $avp(lines)) {<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB"> #
This works<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB">
xlog("L_INFO", "==> Position $var(i):
$(avp(sdp){s.select,$var(i),\n}) \n");<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB"> #
This fails<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB">
$var(l1) = $(avp(sdp){s.select,$var(i),$var(delimeter)});<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB"> #
This fails
<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB"> $var(l2)
= $(avp(sdp){s.select,$var(i),\n});<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB"> #
This fails
<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB"> $var(l3)
= $(avp(sdp){s.select,$var(i),\\n});<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB">
</span><span style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB"
lang="EN-US"># Supposed to do something funny with the
$var(line) here<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB">
$var(i) = $var(i) + 1;<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-GB">}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="SV"><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal"><span
style="mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span style="mso-fareast-language:EN-GB"
lang="EN-US">/M</span><o:p></o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* <a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
* <a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - Online
May 17-20, 2021 (Europe Timezone) - June 7-10, 2021 (America Timezone)
* <a class="moz-txt-link-freetext" href="https://www.asipto.com/sw/kamailio-advanced-training-online/">https://www.asipto.com/sw/kamailio-advanced-training-online/</a></pre>
</body>
</html>