[OpenSIPS-Users] Problem with {s.int] transformation

Bogdan-Andrei Iancu bogdan at opensips.org
Thu Mar 27 17:30:41 CET 2014


Hi,

The quotes in the example are there because of the string format :).

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.

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 27.03.2014 14:21, Alexander Mustafin wrote:
> Tnanks, Bogdan.
>
> I was confused by explanation in official document about transformations:
>
>
>         1.2 {s.int}
>
> Return integer value of a string-represented number
>
> $var(x) = "1234";
> if($(var(x){s.int})==1234) {
>    ...
> }
>
> I solved this problem this way:    {s.select,1,"}
>
> Best regards,
> Alexander Mustafin
> mustafin.aleksandr at gmail.com <mailto:mustafin.aleksandr at gmail.com>
>
>
>
>
> 27 марта 2014 г., в 14:25, Bogdan-Andrei Iancu <bogdan at opensips.org 
> <mailto:bogdan at opensips.org>> написал(а):
>
>> Hello,
>>
>> 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 ?
>>
>> You could do something simple like:
>>
>> $avp(name) = $(hdr(P-Asserted-Identity){nameaddr.name})
>> # if string starts with '"", get rid of the first and last char from 
>> the string.
>> if ( $(avp(name){s,substr,0,1})=='"' )
>> $avp(name) := $(avp(name){s.substr,1,-1});
>>
>> Regards,
>> Bogdan-Andrei Iancu
>> OpenSIPS Founder and Developer
>> http://www.opensips-solutions.com
>> On 25.03.2014 15:15, Alexander Mustafin wrote:
>>> Hello.
>>>
>>> I’ve got the header in message:  P-Asserted-Identity: «777777" 
>>> <sip:777777 at 5.5.5.5>
>>>
>>> And I need to parse «name» part for future used, but without quotes.
>>>
>>> I’m trying:
>>>
>>> $avp(name) = $(hdr(P-Asserted-Identity){nameaddr.name}{s.int});
>>>
>>> but $avp(name) is null after this transformation.
>>>
>>> How to delete quotes from this field?
>>>
>>>
>>> Best regards,
>>> Alexander Mustafin
>>> mustafin.aleksandr at gmail.com <mailto:mustafin.aleksandr at gmail.com>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> 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/20140327/d7a38aaa/attachment.htm>


More information about the Users mailing list