<html>
<head>
<meta content="text/html; charset=windows-1251"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix"><tt>Hi,<br>
<br>
The quotes in the example are there because of the string format
:).<br>
<br>
Anyhow, using the s.select may be a bit dangerous (versus simply
stripping out the first and last char) as " char may be present
(quoted) inside a display name -> it will generate a false
match for you.<br>
<br>
Regards, <br>
</tt>
<pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
On 27.03.2014 14:21, Alexander Mustafin wrote:<br>
</div>
<blockquote
cite="mid:FB2D1183-8C26-4C3F-801C-EA1A88772DD2@gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1251">
Tnanks, Bogdan.
<div><br>
</div>
<div>I was confused by explanation in official document about
transformations:</div>
<div><br>
</div>
<div>
<h4>1.2 {s.int}</h4>
<p>Return integer value of a string-represented number
</p>
<pre class="escaped">$var(x) = "1234";
if($(var(x){s.int})==1234) {
...
}
</pre>
<div><br>
</div>
<div>I solved this problem this way: {s.select,1,"}</div>
<div><br>
</div>
<div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); font-family: Helvetica;
font-style: normal; font-variant: normal; font-weight:
normal; letter-spacing: normal; line-height: normal;
orphans: 2; text-align: -webkit-auto; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; -webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px; word-wrap: break-word;
-webkit-nbsp-mode: space; -webkit-line-break:
after-white-space; ">
<div>Best regards,</div>
<div>Alexander Mustafin</div>
<div><a moz-do-not-send="true"
href="mailto:mustafin.aleksandr@gmail.com">mustafin.aleksandr@gmail.com</a></div>
<div><br>
</div>
</div>
<br class="Apple-interchange-newline">
<br class="Apple-interchange-newline">
</div>
<br>
<div>
<div>27 ìàðòà 2014 ã., â 14:25, Bogdan-Andrei Iancu <<a
moz-do-not-send="true" href="mailto:bogdan@opensips.org">bogdan@opensips.org</a>>
íàïèñàë(à):</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<meta content="text/html; charset=windows-1251"
http-equiv="Content-Type">
<div bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix"><tt>Hello,<br>
<br>
The nameaddr.name transformation will return the
"77777" string along the quotes. The s.int is to
transform a number from string representation to
integer - so it is a missusage of this transformation
here. You just want to get rid of the quotes, right ?<br>
<br>
You could do something simple like:<br>
</tt><br>
<tt>$avp(name) =
$(hdr(P-Asserted-Identity){nameaddr.name})<br>
# if string starts with '"", get rid of the first and
last char from the string.<br>
if ( $(avp(name){s,substr,0,1})=='"' )<br>
</tt><tt><tt>$avp(name)</tt> := </tt><tt><tt>$(avp(name){s.substr,1,-1});</tt>
<br>
<br>
Regards,<br>
</tt>
<pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.opensips-solutions.com/">http://www.opensips-solutions.com</a></pre>
On 25.03.2014 15:15, Alexander Mustafin wrote:<br>
</div>
<blockquote
cite="mid:974C6ED1-DCEA-4777-8DB8-4F4E36B845B8@gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1251">
Hello.
<div><br>
</div>
<div>I’ve got the header in message:
P-Asserted-Identity: «777777" <<a
moz-do-not-send="true" href="sip:777777@5.5.5.5">sip:777777@5.5.5.5</a>></div>
<div><br>
</div>
<div>And I need to parse «name» part for future used,
but without quotes.</div>
<div><br>
</div>
<div>I’m trying:</div>
<div><br>
</div>
<div>$avp(name) =
$(hdr(P-Asserted-Identity){nameaddr.name}{s.int});</div>
<div><br>
</div>
<div>but $avp(name) is null after this transformation.</div>
<div><br>
</div>
<div>How to delete quotes from this field? </div>
<div><br>
</div>
<div><br>
<div apple-content-edited="true">
<div style="font-family: Helvetica; font-style:
normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal;
orphans: 2; text-align: -webkit-auto; text-indent:
0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; word-wrap:
break-word; -webkit-nbsp-mode: space;
-webkit-line-break: after-white-space;">
<div>Best regards,</div>
<div>Alexander Mustafin</div>
<div><a moz-do-not-send="true"
href="mailto:mustafin.aleksandr@gmail.com">mustafin.aleksandr@gmail.com</a></div>
<div><br>
</div>
</div>
<br class="Apple-interchange-newline">
<br class="Apple-interchange-newline">
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>