#!/usr/bin/perl # use strict; use warnings; use Data::Dumper; #use Net::DNS; use Net::DNS qw(rrsort); # my @prioritysorted=rrsort("SRV","priority",@rr_array); my $domain = ".e164.org"; my $number = join('.',(reverse(split(//,"18604850042")))) . $domain; print "$number\n"; my $res = Net::DNS::Resolver::UNIX->new( nameservers => ['e164.org'], recurse => 0, debug => 0, ); my $NAPTR = $res->query($number,'NAPTR'); my @rrs_array = ($NAPTR->answer); my @sorted = rrsort("NAPTR","priority",@rrs_array); print Dumper(@rrs); #### #!/usr/bin/perl # use strict; use warnings; use Data::Dumper; use Net::DNS; my $domain = ".e164.org"; my $number = join('.',(reverse(split(//,"18604850042")))) . $domain; print "$number\n"; my $res = Net::DNS::Resolver->new( nameservers => ['e164.org'], recurse => 0, debug => 0, ); my $NAPTR = $res->query($number,'NAPTR'); print Dumper($NAPTR); print "*** " . $NAPTR->{'answer'}->[1]->{'regexp'} . "\n"; #### $VAR1 = bless( { 'answer' => [], 'buffer' => \'üv 24005840681e164org#À # [ bless( { 'qclass' => 'IN', 'qname' => '2.4.0.0.5.8.4.0.6.8.1.e164.org', 'qtype' => 'NAPTR' }, 'Net::DNS::Question' ) ], 'answerfrom' => '208.70.151.161', 'answersize' => 220, 'additional' => [], 'authority' => [], 'header' => bless( { 'nscount' => 0, 'cd' => 0, 'qdcount' => 1, 'ancount' => 2, 'rcode' => 'NOERROR', 'tc' => 0, 'opcode' => 'QUERY', 'ad' => 0, 'ra' => 0, 'qr' => 1, 'arcount' => 0, 'id' => 64630, 'aa' => 1, 'rd' => 0 }, 'Net::DNS::Header' ), 'offset' => 48 }, 'Net::DNS::Packet' ); #### ;; query(2.4.0.0.5.8.4.0.6.8.1.e164.org, NAPTR) ;; Trying to set up a AF_INET6() family type UDP socket with srcaddr: 0.0.0.0 ... done ;; setting up an AF_INET() family type UDP socket ;; send_udp(208.70.151.161:53) ;; answer from 208.70.151.161:53 : 220 bytes ;; HEADER SECTION ;; id = 1301 ;; qr = 1 opcode = QUERY aa = 1 tc = 0 rd = 0 ;; ra = 0 ad = 0 cd = 0 rcode = NOERROR ;; qdcount = 1 ancount = 2 nscount = 0 arcount = 0 ;; QUESTION SECTION (1 record) ;; 2.4.0.0.5.8.4.0.6.8.1.e164.org. IN NAPTR ;; ANSWER SECTION (2 records) 2.4.0.0.5.8.4.0.6.8.1.e164.org. 60 IN NAPTR 100 10 "u" "E2U+X-ADDRESS" "!^.*$!data:,CN=Cory C Cartwright;ST=CT;C=United States!" . 2.4.0.0.5.8.4.0.6.8.1.e164.org. 60 IN NAPTR 100 10 "u" "E2U+SIP" "!^\+18604850042$!sip:6200@superiordesign.homelinux.net!" . ;; AUTHORITY SECTION (0 records) ;; ADDITIONAL SECTION (0 records) $VAR1 = bless( { 'answer' => [ bless( { 'flags' => 'u', 'ttl' => 60, 'name' => '2.4.0.0.5.8.4.0.6.8.1.e164.org', 'service' => 'E2U+X-ADDRESS', 'rdata' => 'd E2U+X-ADDRESS7!^.*$!data:,CN=Cory C Cartwright;ST=CT;C=United States!', 'preference' => 10, 'rdlength' => 77, 'regexp' => '!^.*$!data:,CN=Cory C Cartwright;ST=CT;C=United States!', 'order' => 100, 'type' => 'NAPTR', 'class' => 'IN', 'replacement' => '' }, 'Net::DNS::RR::NAPTR' ), bless( { 'flags' => 'u', 'ttl' => 60, 'name' => '2.4.0.0.5.8.4.0.6.8.1.e164.org', 'service' => 'E2U+SIP', 'rdata' => 'd uE2U+SIP7!^\\+18604850042$!sip:6200@superiordesign.homelinux.net!', 'preference' => 10, 'rdlength' => 71, 'regexp' => '!^\\+18604850042$!sip:6200@superiordesign.homelinux.net!', 'order' => 100, 'type' => 'NAPTR', 'class' => 'IN', 'replacement' => '' }, 'Net::DNS::RR::NAPTR' ) ], 'buffer' => undef, 'question' => [ bless( { 'qclass' => 'IN', 'qname' => '2.4.0.0.5.8.4.0.6.8.1.e164.org', 'qtype' => 'NAPTR' }, 'Net::DNS::Question' ) ], 'answerfrom' => '208.70.151.161', 'answersize' => 220, 'additional' => [], 'authority' => [], 'header' => bless( { 'nscount' => 0, 'cd' => 0, 'qdcount' => 1, 'ancount' => 2, 'rcode' => 'NOERROR', 'tc' => 0, 'opcode' => 'QUERY', 'ad' => 0, 'ra' => 0, 'qr' => 1, 'arcount' => 0, 'id' => 1301, 'aa' => 1, 'rd' => 0 }, 'Net::DNS::Header' ), 'offset' => undef }, 'Net::DNS::Packet' ); *** !^\+18604850042$!sip:6200@superiordesign.homelinux.net!