Hi,
I want to convert a Hex number string into a Dec number string, e.g. Hex number "123" into Dec number "291". What is the best way? I didn't find any transformation for this.
Thank you! Yufei
On 09/14/2015 11:37 AM, Yufei Tao wrote:
I want to convert a Hex number string into a Dec number string, e.g. Hex number "123" into Dec number "291". What is the best way? I didn't find any transformation for this.
As far as I know, Kamailio has no facility for this. I didn't see one in the transformations or the various utility modules, either.
On 14/09/15 18:16, Alex Balashov wrote:
On 09/14/2015 11:37 AM, Yufei Tao wrote:
I want to convert a Hex number string into a Dec number string, e.g. Hex number "123" into Dec number "291". What is the best way? I didn't find any transformation for this.
As far as I know, Kamailio has no facility for this. I didn't see one in the transformations or the various utility modules, either.
Isn't the s.decode.hexa transformation what it actually needed here?
- http://www.kamailio.org/wiki/cookbooks/4.3.x/transformations#sdecodehexa
Cheers, Daniel
On Monday 14 September 2015 16:37:24 Yufei Tao wrote:
I want to convert a Hex number string into a Dec number string, e.g. Hex number "123" into Dec number "291". What is the best way? I didn't find any transformation for this.
If there is indeed no simple buildin function. You can do it: -"manually", a loop from right to left, stripping characters and doing the powers of 16: 3*16^0+2*16^1+1*16^2
-if you are using something like mysql its conv() https://dev.mysql.com/doc/refman/5.6/en/mathematical-functions.html#function...
-use one of the embedded interpreters app_(lua|perl|python|mono|java)
On 09/14/2015 04:37 PM, Yufei Tao wrote: Hi,
I want to convert a Hex number string into a Dec number string, e.g. Hex number "123" into Dec number "291". What is the best way? I didn't find any transformation for this.
Thank you! Yufei
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.orgmailto:sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hi Yufei,
Use app_python and python scripts contains somthing like that:
int("0x123", 16)
Greetings
Konrad
-- Konrad Rozycki Red Embedded
This E-mail and any attachments hereto are strictly confidential and intended solely for the addressee. If you are not the intended addressee please notify the sender by return and delete the message.
You must not disclose, forward or copy this E-mail or attachments to any third party without the prior consent of the sender.
Red Embedded Design, Company Number 06688253 Registered in England: The Wave, 1 View Croft Road, Shipley, West Yorkshire, BD17 7DU