[Asterisk-cvs] asterisk/contrib/scripts lookup.agi,NONE,1.1
markster
markster
Tue Aug 30 14:40:29 CDT 2005
- Previous message: [Asterisk-cvs] asterisk/include/asterisk acl.h, 1.15, 1.16 adsi.h,
1.9, 1.10 aes.h, 1.2, 1.3 agi.h, 1.2, 1.3 alaw.h, 1.3,
1.4 app.h, 1.37, 1.38 ast_expr.h, 1.2, 1.3 astdb.h, 1.2,
1.3 astmm.h, 1.2, 1.3 astobj.h, 1.17, 1.18 astosp.h, 1.3,
1.4 callerid.h, 1.12, 1.13 causes.h, 1.8, 1.9 cdr.h, 1.28,
1.29 channel.h, 1.97, 1.98 chanvars.h, 1.6, 1.7 cli.h, 1.8,
1.9 compiler.h, 1.1, 1.2 config.h, 1.22, 1.23 crypto.h, 1.6,
1.7 devicestate.h, 1.2, 1.3 dlfcn-compat.h, 1.1, 1.2 dns.h,
1.3, 1.4 dnsmgr.h, 1.1, 1.2 dsp.h, 1.8, 1.9 dundi.h, 1.9,
1.10 endian.h, 1.3, 1.4 enum.h, 1.5, 1.6 features.h, 1.5,
1.6 file.h, 1.25, 1.26 frame.h, 1.54, 1.55 fskmodem.h, 1.1,
1.2 image.h, 1.3, 1.4 indications.h, 1.4, 1.5 inline_api.h,
1.1, 1.2 io.h, 1.7, 1.8 linkedlists.h, 1.16, 1.17 localtime.h,
1.2, 1.3 lock.h, 1.33, 1.34 logger.h, 1.13, 1.14 manager.h,
1.16, 1.17 md5.h, 1.4, 1.5 module.h, 1.22, 1.23 monitor.h, 1.4,
1.5 musiconhold.h, 1.4, 1.5 netsock.h, 1.1, 1.2 options.h,
1.16, 1.17 pbx.h, 1.51, 1.52 poll-compat.h, 1.1, 1.2 privacy.h,
1.1, 1.2 res_odbc.h, 1.4, 1.5 rtp.h, 1.22, 1.23 say.h, 1.12,
1.13 sched.h, 1.9, 1.10 slinfactory.h, 1.1, 1.2 srv.h, 1.3,
1.4 strings.h, 1.7, 1.8 tdd.h, 1.3, 1.4 term.h, 1.3,
1.4 time.h, 1.7, 1.8 transcap.h, 1.1, 1.2 translate.h, 1.8,
1.9 ulaw.h, 1.3, 1.4 unaligned.h, 1.2, 1.3 utils.h, 1.41,
1.42 vmodem.h, 1.19, 1.20 config_old.h, 1.1, NONE cvsid.h, 1.4, NONE
- Next message: [Asterisk-cvs] asterisk/apps Makefile,1.108,1.109
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /usr/cvsroot/asterisk/contrib/scripts
In directory mongoose.digium.com:/tmp/cvs-serv21659/contrib/scripts
Added Files:
lookup.agi
Log Message:
Add lookup script for people without CIDNAME plus rich variables...
--- NEW FILE: lookup.agi ---
#!/usr/bin/perl
#
# Use Reverse Lookups to populate valuable information
#
# Copyright (C) 2005 Digium, Inc.
#
# Mark Spencer <markster at digium.com>
#
# Based on work of Joe Fratantoni - BrakeDanceJ - Joe at UnrealDestination.com.
#
# This program is Free Software distributed under the terms of the GNU
# General Public License version 2. See LICENSE for details.
#
#
use LWP::UserAgent;
my %AGI;
my $debug = 0;
$|=1;
sub url_decode {
my @args = @_;
s/%([0-9A-F]{2})/chr hex $1/egios for @args;
s/\"//egios for @args;
return wantarray ? @args : $args[0];
}
while(<STDIN>) {
chomp;
last unless length($_);
if (/^agi_(\w+)\:\s+(.*)$/) {
$AGI{$1} = $2;
}
}
alarm(4);
my $number = $AGI{'callerid'};
$number =~ /(\d+)/;
$number = $1;
die("You must specify a number") unless $number;
my $ua = LWP::UserAgent->new;
$ua->agent("Asterisk");
my $req = HTTP::Request->new(POST => 'http://www.411.com/10668/search/Reverse_Phone');
$req->content_type('application/x-www-form-urlencoded');
$req->content("phone=$number");
my $res = $ua->request($req);
if ($res->is_success) {
my $first, $last, $address, $street, $house, $city, $state, $zip, $phone;
if ($res->content =~ /PAGE: PHONE_NOT_FOUND/) {
# Limited Information
$res->content =~ /is a \s+([A-Za-z -]*), ([A-Z]{2}) \s+based phone number and the registered carrier is (.*)\.\s+/;
($city, $state, $last) =
map { url_decode($_) } ($1, $2, $3);
$cidname = "$city, $state";
} else {
# Full Information
$res->content =~ /RM_HTML_FIRST_ESC_=(.*)&_RM_HTML_LAST_ESC_=(.*)&_RM_HTML_ADDRESS_ESC_=(.*)&_RM_HTML_STREET_ESC_=(.*)&_RM_HTML_HOUSE_ESC_=(.*)&_RM_HTML_CITY_ESC_=(.*)&_RM_HTML_STATE_ESC_=(.*)&_RM_HTML_ZIP_ESC_=(.*)&_RM_HTML_PHONE_ESC_=(.*)&CITY=(.*)&STATE=(.*)/;
($first, $last, $address, $street, $house, $city, $state, $zip, $phone) =
map { url_decode($_) } ($1, $2, $3, $4, $5, $6, $7, $8, $9);
my $cidname = $last;
if ($first) {
$cidname = $first . " " . $last;
} else {
$cidname = $last;
}
}
print STDOUT "SET VARIABLE CALLERID(name) \"$cidname\"\n";
<STDIN>;
print STDOUT "SET VARIABLE CALLER_ZIP \"$zip\"\n";
<STDIN>;
print STDOUT "SET VARIABLE CALLER_STATE \"$state\"\n";
<STDIN>;
print STDOUT "SET VARIABLE CALLER_CITY \"$city\"\n";
<STDIN>;
print STDOUT "SET VARIABLE CALLER_ADDRESS \"$address\"\n";
<STDIN>;
print STDOUT "SET VARIABLE CALLER_LAST \"$last\"\n";
<STDIN>;
print STDOUT "SET VARIABLE CALLER_FIRST \"$first\"\n";
<STDIN>;
print STDERR "First: $first\n" .
"Last: $last\n" .
"Address: $address\n" .
"Street: $street\n" .
"House: $house\n" .
"City: $city\n" .
"State: $state\n" .
"Zip: $zip\n" .
"Phone: $phone\n" if $debug;
} else {
print STDERR $res->status_line . "\n";
}
- Previous message: [Asterisk-cvs] asterisk/include/asterisk acl.h, 1.15, 1.16 adsi.h,
1.9, 1.10 aes.h, 1.2, 1.3 agi.h, 1.2, 1.3 alaw.h, 1.3,
1.4 app.h, 1.37, 1.38 ast_expr.h, 1.2, 1.3 astdb.h, 1.2,
1.3 astmm.h, 1.2, 1.3 astobj.h, 1.17, 1.18 astosp.h, 1.3,
1.4 callerid.h, 1.12, 1.13 causes.h, 1.8, 1.9 cdr.h, 1.28,
1.29 channel.h, 1.97, 1.98 chanvars.h, 1.6, 1.7 cli.h, 1.8,
1.9 compiler.h, 1.1, 1.2 config.h, 1.22, 1.23 crypto.h, 1.6,
1.7 devicestate.h, 1.2, 1.3 dlfcn-compat.h, 1.1, 1.2 dns.h,
1.3, 1.4 dnsmgr.h, 1.1, 1.2 dsp.h, 1.8, 1.9 dundi.h, 1.9,
1.10 endian.h, 1.3, 1.4 enum.h, 1.5, 1.6 features.h, 1.5,
1.6 file.h, 1.25, 1.26 frame.h, 1.54, 1.55 fskmodem.h, 1.1,
1.2 image.h, 1.3, 1.4 indications.h, 1.4, 1.5 inline_api.h,
1.1, 1.2 io.h, 1.7, 1.8 linkedlists.h, 1.16, 1.17 localtime.h,
1.2, 1.3 lock.h, 1.33, 1.34 logger.h, 1.13, 1.14 manager.h,
1.16, 1.17 md5.h, 1.4, 1.5 module.h, 1.22, 1.23 monitor.h, 1.4,
1.5 musiconhold.h, 1.4, 1.5 netsock.h, 1.1, 1.2 options.h,
1.16, 1.17 pbx.h, 1.51, 1.52 poll-compat.h, 1.1, 1.2 privacy.h,
1.1, 1.2 res_odbc.h, 1.4, 1.5 rtp.h, 1.22, 1.23 say.h, 1.12,
1.13 sched.h, 1.9, 1.10 slinfactory.h, 1.1, 1.2 srv.h, 1.3,
1.4 strings.h, 1.7, 1.8 tdd.h, 1.3, 1.4 term.h, 1.3,
1.4 time.h, 1.7, 1.8 transcap.h, 1.1, 1.2 translate.h, 1.8,
1.9 ulaw.h, 1.3, 1.4 unaligned.h, 1.2, 1.3 utils.h, 1.41,
1.42 vmodem.h, 1.19, 1.20 config_old.h, 1.1, NONE cvsid.h, 1.4, NONE
- Next message: [Asterisk-cvs] asterisk/apps Makefile,1.108,1.109
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the svn-commits
mailing list