tags:

views:

166

answers:

2

Hi

I am currently working on a java application to map the E.164 Telephone Number to DNS name to get a IP address.I dont know how to do this.If any body knows it please help me.

A: 

Shouldn't be too complicated. Here's an extract from the corresponding wikipedia entry:

The ITU ENUM allocates a specific zone, namely "e164.arpa" for use with ENUM E.164 numbers on the IP side of the network. RFC 3761 define how any ENUM number, such as +1 555 42 42 can be transformed into a URI, by reversing the numbers, separating them with dots and adding the e164.arpa suffix thus: 2.4.2.4.5.5.5.1.e164.arpa

Edit

Just in detail:

  1. read the phone number as a String (or convert it to a string)
  2. remove any char that is not a number (whitechars, '+', etc)
  3. revert the string, in this case: 15554242 -> 24245551
  4. put a dot behind each number, here: 24245551 -> 2.4.2.4.5.5.5.1.
  5. append 'e164.arpa'

that's all - you don't need special API, it's just a sort of String transformation

Andreas_D
Thanks for your reply.Theoretically it is ok but i want to implement this concept in java.Like My application has to get a phone number as input and give corresponding IP address as output.This is what i want to do.I read in some article like JSR-161 api is used to do this.But i am struggling to get that api.If any know the link please tell me.
Rajapandian
+2  A: 

The mapping part is really simple,

                    public String getEnum(String number) {
                            String data = number.replaceAll("[^0-9]","");
                            StringBuffer sb = new StringBuffer();
                            for (int i = data.length()-1; i >= 0; i--)
                            {
                                    sb.append(data.charAt(i)).append('.');
                            }
                            sb.append("e164.arpa.");
                            return sb.toString();
                    }
ZZ Coder
Ok fine.After getting this string which is called as DNS query String ,using this i have to get the DNS name corresponding to that phone number.how i can do this?
Rajapandian
This is the DNS name that you can use to do DNS lookup. I guess you need to get the NAPTR record for SIP URI etc. Java doesn't support that. You will need to use Java DNS package http://www.dnsjava.org/ for that.
ZZ Coder
Thanks for your reply.I got some idea.
Rajapandian
(if you find an answer useful, don't hesitate to upvote)
Andreas_D