Super CallerID for Austrailia

Original .txt


# - by ro0t2 <>
# Version 3 (Modified to use Greypages XML)

# Based on hacked version of by natas
# shouts also to Strom carlsons and dual, all of whom inspired this is the first
# place.

# This script uses Greypages and ACMA (Australian Communications and Media Authority's)
# Number Register, also filter has been included to only accept numbers in regular
# STD format eg. 0732210987...this is mainly to limit unnecessary requests
# to greypages.

# This is the third recode of this, the code is still very sloppy, i really don't
# know perl at all, although am now starting to learn :P its just written from
# perldoc, google and other scripts including by natas

# Shouts to natas, dual, strom carlson, jasonk and everybody at

# sorry for lack of commenting in the code its all pretty straight forward though
# very simple little script os thought it unnecessary

# Instructions for Unix based machines (sorry windows guys I got NO idea)
# Shell Usage: <phone number>
# chmod +x
# In extentsions.conf add this to imcomming call location
# exten => {PHONENUMBER},1,System(/home/./ ${CALLERIDNUM} > /outputdirectory/super_callerid_output.txt)
# exten => {PHONENUMBER},2,Dial(SIP/PHONE1)
# etc. anyways the lookup takes about 2 rings on my just means that your phone
# wont start ringing for a few extra seconds
# You will need to get the following for this to work
# perl -MCPAN -e "install WWW::Mechanize" and/or
# perl -MCPAN -e "install XML::LibXML"
# perl -MCPAN -e "install MIME::Base64";

use strict;
use WWW::Mechanize;
use MIME::Base64;
use XML::LibXML;

if($ARGV[0] =~ /0[23478]\d\d\d\d\d\d\d\d/){
# filters for Australian number format...mainly to stop it running on VoIP calls and to allow further coding
# that would allow different scripts for different number formats
my $input = $ARGV[0];
my $username = "greypages";
my $password = "9954";

my $mech = WWW::Mechanize->new(autocheck => 1);
my @args = (
Authorization => "Basic " .
MIME::Base64::encode( $username . ':' . $password )

$mech->get("$input", @args);
my $content = $mech->content();
my $parser = XML::LibXML->new();
my $tree = $parser->parse_string($content);
my $root = $tree->getDocumentElement;

my $bussiness_var = $root->getElementsByTagName('COMPANY_NAME');
my $initals = $root->getElementsByTagName('INITIALS');
my $name = $root->getElementsByTagName('SURNAME');
my $fax = $root->getElementsByTagName('FAX_AC_PHONE');
my $address = $root->getElementsByTagName('ADDRESS');
my $suburb = $root->getElementsByTagName('SUBURB');
my $postcode = $root->getElementsByTagName('POSTCODE');
my $state = $root->getElementsByTagName('STATE');
my $longitude = $root->getElementsByTagName('LONGITUDE');
my $latitude = $root->getElem~np~entsByTagName('LATITUDE');

$mech->field("fromNumber", $input);
$mech->field("outputId", 2);
$mech->field("action", 'Search');

my $content = $mech->content();
my $holder;
my $numarea;
my $servarea;
my $alocatedate;
my $service;
if ($content =~
$service = $1;
$holder = $9;
$alocatedate = $8;
$numarea = $11;
$servarea = $12;

my $final_name; # just combines the initials with surname if person or sets to the company name

if ($bussiness_var =~ /[a-z]/){
$final_name = $bussiness_var;
else {
$final_name = $initals." ".$name;

print "\n Caller ID: \t\t"."$input\n\n";
print " Name: \t\t"."$final_name\n";
print " Address:
print " Longitude: \t\t"."$longitude\n";
print " Latitude: \t\t"."$latitude\n";
print " Fax No: \t\t"."$fax\n";
print " Service Type: \t"."$service\n";
print " Allocatee: \t\t"."$holder\n";
print " Allocation Date: \t"."$alocatedate\n";
print " Service Area: \t"."$servarea\n";
print " Numbering Area: \t"."$numarea\n";
print "\n";

Created by: kFuQ, Last modification: Sun 02 of Oct, 2005 (14:43 UTC)
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+