[Asterisk-Users] Reverse phone lookup interface with asterisk
Joe Presto
asterisk at desktopguerrillas.com
Wed Mar 30 23:30:50 MST 2005
All hail rentacoder.com - a few bucks poorer I have a perfectly usable
script for reverse phone lookups. I send a jabber message to myself for
every incoming call including data from this reverse phone lookup perl
script.
There's probably a smarter way to post this, let me know and I'll comply.
---------------------
#Script to reverse lookup information
#in http://anywho.com database
#Usage: rl telephone# in format like: 1234567890
#hidden par c
#npa
#telephone
$base_url = 'http://anywho.com/qry/wp_rl';
$get_c_url = 'http://anywho.com/qry/getc.pl';
$timeout = 20;
$referer = '"http://anywho.com/qry/wp_rl"';
$user_agent = '"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Gecko/20041107 Firefox/1.0"';
$curl = "curl -s -m $timeout -e $referer -A $user_agent ";
if($#ARGV+1 == 1)
{
$phone = $ARGV[0];
$cmd = "$curl $get_c_url";
#print "Executing : $cmd\n";
$c = `$cmd`;
$ret = $? >> 8;
if(!$ret)
{
@cvals = $c =~ /value\s=\s"([^"]*?)"/s;
$c = $cvals[0];
#print "Got C value : $c\n";
$npa = substr($phone, 0, 3);
$num = substr($phone, 3);
$xy = 'btnsubmit.x=37&btnsubmit.y=8';
$cmd = "$curl -d \"c=$c&npa=$npa&telephone=$num&$xy\" $base_url";
#print "Getting from: $cmd\n";
$data = `$cmd`;
$ret = $? >> 8;
if(!$ret)
{
#print "$data\n";
#@values = $data =~
/<!--\slisting.*?<B>([^<]+?)<.*?-->\s*([^<]+?)<.*?>\s*([^<]+?)</si;
@values = $data =~
/<!--\slisting.*?<B>([^<]+?)<.*?-->(.*?)<\/div/si;
if($#values > -1)
{
($surename, $name) = split(/, /, $values[0], 2);
$data = $values[1];
$data =~ s/\s+/ /gs;
@vals2 = $data =~ /\s*(.*?)<BR>/sgi;
if($#vals2 == 1)
{
$address = $vals2[0];
($city, $statezip) = split(/, /, $vals2[1], 2);
print(($name ? $name.', ' : '')."$surename, $address,
$city, $statezip\n");
}
else
{
($city, $statezip) = split(/, /, $vals2[0], 2);
print(($name ? $name.', ' : '')."$surename, $city,
$statezip\n");
}
}
else
{
print "Nothing found?\n";
}
}
else
{
print "$ret\n";
}
}
else
{
print "$c\n";
}
}
else
{
print "Usage rl phone#\n";
}
---------------------
> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-
> bounces at lists.digium.com] On Behalf Of Jay Milk
> Sent: Tuesday, February 01, 2005 2:52 AM
> To: 'Asterisk Users Mailing List - Non-Commercial Discussion'
> Subject: RE: [Asterisk-Users] Reverse phone lookup interface with asterisk
>
> Yep -- 'xept that side simply refers you to 411.com, phonenumber.com and
> whitepages.com, which are all three different flavors of the same site
> -- data returned is identical. In comparison, this data seems more
> complete and up-to-date than anywho.com or switchboard (which in turn
> seem identical as well). Can it be that there really only are two
> different sources of phonebook data online?
>
> > -----Original Message-----
> > From: Dr. Matthew Roller [mailto:matthewroller at gmail.com]
> > Sent: Tuesday, February 01, 2005 12:31 AM
> > To: Asterisk Users Mailing List - Non-Commercial Discussion
> > Subject: Re: [Asterisk-Users] Reverse phone lookup interface
> > with asterisk
> >
> >
> > use
> > http://www.reversephonedirectory.com/
> > it works for business as well as residential, I have been
> > using it for years.
> >
> > On Mon, 31 Jan 2005 18:20:11 -0600, Jay Milk <jay at skimmilk.net> wrote:
> > > I got mine done last weekend, using 411.com for lookups and
> > mysql to
> > > customize it. I'll post it when I have a chance. If you plan on
> > > using it, have PHP5 and mySQL ready on your server.
> > >
> > > > -----Original Message-----
> > > > From: Joe Presto [mailto:asterisk at desktopguerrillas.com]
> > > > Sent: Monday, January 31, 2005 4:28 PM
> > > > To: 'Asterisk Users Mailing List - Non-Commercial Discussion'
> > > > Subject: RE: [Asterisk-Users] Reverse phone lookup interface with
> > > > asterisk
> > > >
> > > >
> > > > Just thought I'd post an update on my progress.
> > > >
> > > > - I asked ServiceObjects to create a Perl script - no
> > response yet.
> > > > - I found this reverse lookup script that uses anywho.com:
> > > > http://search.cpan.org/~phocus/revphone-0.01/lib/revphone.pm.
> > > > Managed to integrate it with my email and jabber notification
> > > > scripts without too much hassle. Seems to work well, but for
> > > > residential listings only - doesn't work for businesses.
> > > >
> > > > Missing business listings is not good - I'm going to keep looking
> > > > for pay-for and free solutions.
> > > >
> > > > Thanks - Joe
> > > >
> > > > > -----Original Message-----
> > > > > From: asterisk-users-bounces at lists.digium.com
> > > [mailto:asterisk-users-
> > > > bounces at lists.digium.com] On Behalf Of Joe Presto
> > > > Sent: Tuesday, January 18, 2005 8:46 PM
> > > > To: asterisk-users at lists.digium.com
> > > > Subject: [Asterisk-Users] Reverse phone lookup interface with
> > > > asterisk
> > > >
> > > > I've had some success setting up a crude "screen pops"
> > using Jabber,
> > > > and am pretty happy with it. But I'd love to have it pop
> > up with the
> > > > full name and address of the caller.
> > > >
> > > > The easiest way to do this is using ServiceObjects "GeoPhone" web
> > > > service
> > > > -
> > > > although it's expensive for small shops (free trial, but $50+/mo
> > > > after that). The interface would be pretty simple using Perl and
> > > SOAP::Lite, if
> > > > one knew Perl. Which, after a few hours of tinkering, I
> > can safely
> > > say I
> > > > don't.
> > > >
> > > > My question is twofold:
> > > > Has anyone written an interface to this by any chance?
> > > > Or even better -
> > > > Has anyone written an interface to Google's search, which
> > appears to
> > > > have free reverse # lookup?
> > > >
> > > > Thanks - joe
> > > >
> > >
> > > _______________________________________________
> > > Asterisk-Users mailing list
> > > Asterisk-Users at lists.digium.com
> > > http://lists.digium.com/mailman/listinfo/asterisk-users
> > > To UNSUBSCRIBE or update options visit:
> > > http://lists.digium.com/mailman/listinfo/asterisk-users
> > >
> > > _______________________________________________
> > > Asterisk-Users mailing list
> > > Asterisk-Users at lists.digium.com
> > > http://lists.digium.com/mailman/listinfo/asterisk-users
> > > To UNSUBSCRIBE or update options visit:
> > > http://lists.digium.com/mailman/listinfo/asterisk-users
> > >
> >
> >
> > --
> > Dr. Matthew Roller
> > 9355 S 1300 E
> > Sandy, UT 84094
> > 801-255-3925
> > http://www.rollerchiropractic.com
> > _______________________________________________
> > Asterisk-Users mailing list
> > Asterisk-Users at lists.digium.com
> > http://lists.digium.com/mailman/listinfo/aster> isk-users
> > To
> > UNSUBSCRIBE or update options visit:
> >
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
>
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
More information about the asterisk-users
mailing list