[OpenSIPS-Users] HEX encoding of a avp value

Vlad Paiu vladpaiu at opensips.org
Fri Jun 29 16:36:31 CEST 2012


Hello,

The transformation internally tries to convert the received input to 
string before applying the hexa encoding. So 3 will be turned to the 
string "3" and then it will be encoded.

Regards,

Vlad Paiu
OpenSIPS Developer
http://www.opensips-solutions.com


On 06/28/2012 04:48 PM, Ali Pey wrote:
> Thank you Vlad.
>
> How can I convert my integer value to string?
>
> Let's say my $avp(id) is 3. How could I convert it to string before I 
> use s.encode.hexa?
>
> Regards,
> Ali Pey
>
>
> On Thu, Jun 28, 2012 at 5:31 AM, Vlad Paiu <vladpaiu at opensips.org 
> <mailto:vladpaiu at opensips.org>> wrote:
>
>     Hello,
>
>     The encode and decode transformations work on strings, not on
>     their integer values.
>     So do not expect to have 19 encoded to hexa to be 13.
>
>     For example, 3 encoded to hexa is 33, because '3' is 51 in ascii,
>     thus converted to hexa it is 33 = 16*3+3 = 51.
>
>     Regards,
>
>     Vlad Paiu
>     OpenSIPS Developer
>     http://www.opensips-solutions.com  
>
>
>     On 06/26/2012 08:19 PM, Ali Pey wrote:
>>     Hi There,
>>
>>     Is there a way to convert an avp variable to hex?
>>
>>     I've tried the following but it's not working.
>>
>>     $(avp(id){s.encode.hexa})
>>
>>     For instance if avp(id) is 11, it returns 3131, if it's 3, it
>>     returns 33.
>>
>>     Am I doing something wrong?
>>     Is there a better way?
>>
>>     Thanks,
>>     Ali Pey
>>
>>
>>     _______________________________________________
>>     Users mailing list
>>     Users at lists.opensips.org  <mailto:Users at lists.opensips.org>
>>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>     _______________________________________________
>     Users mailing list
>     Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> _______________________________________________
> 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/20120629/9168b057/attachment.htm>


More information about the Users mailing list