[*-CA] CID Lookup

Nabeel Jafferali nabeel at x2n.ca
Sat May 7 18:02:40 EDT 2005


For my Unlimitel DID, I have the following:

[from-unlimitel]
exten => 6477226900,1,AGI(callerid.agi,${CALLERIDNUM})
exten => 6477226900,2,SetCIDName(${googlename})
exten => 6477226900,3,SetCIDNum(1${CALLERIDNUM})
exten => 6477226900,4,Dial(SIP/nabeel1)
etc.

--
Nabeel Jafferali
X2 Networks
www.x2n.ca
T: 1.647.722.6900
   1.877.VOIP.X2N
F: 1.866.655.6698
FWD: 46990


> -----Original Message-----
> From: Paul Fielding [mailto:paul.fielding at shaw.ca]
> Sent: May 7, 2005 5:44 PM
> To: nabeel at x2n.ca
> Subject: Re: [*-CA] CID Lookup
> 
> Dumb question if I may - having never used AGI scripts before, how do I
> most
> easily implement this script? :)
> 
> later,
> 
> Paul
> 
> ----- Original Message -----
> From: "Nabeel Jafferali" <asterisk-lists at x2n.ca>
> To: <asterisk at uc.org>
> Cc: <asterisk-canada at lists.syonex.com>
> Sent: Saturday, May 07, 2005 3:36 PM
> Subject: [*-CA] CID Lookup
> 
> 
> > Jim Meehan had posted something to asterisk-users a couple of months ago
> > that looked up CID info from Google and, failing that, got the NPA/NXX
> > info
> > from areacodedownload.com. I modified his script to look up Google, then
> > look up 411.com, since the latter has Canadian listings. I left Google
> in
> > because it's significantly faster. I removed the reversing first/last
> > names
> > and the NPA/NXX lookup. Here the code, if anyone is interested:
> >
> >
> > #!/usr/bin/perl
> > use Asterisk::AGI;
> > $AGI = new Asterisk::AGI;
> > $number = $ARGV[0];
> > $found = 0;
> >
> > open(RESULTS, "/usr/bin/curl -s -m 2 -A Mozilla/4.0
> > http://www.google.com/search?q=phonebook:$number |");
> > while (<RESULTS>) {
> >  if (m/Residential Phonebook/ || m/Business Phonebook/) {
> >    $found = 1;
> >    @fields = split(/>/);
> >    @result = split(/-/, $fields[35]);
> >    chop($result[0]);
> >    $name = $result[0];
> >  }
> >  if (m/did not match any/) {
> >    $found = 0;
> >  }
> > }
> >
> > if ($found == 0) {
> >  open(RESULTS, "/usr/bin/curl -s -m 2 -A Mozilla/4.0
> > http://www.411.com/10668/search/Reverse_Phone?phone=$number |");
> >  while (<RESULTS>) {
> >    if (m/__FIRST/) {
> >      $found = 1;
> >      @fname = split(/\"/);
> >    }
> >    elsif (m/__LAST/) {
> >      @lname = split(/\"/);
> >      $name = $fname[1] . " " .$lname[1];
> >    }
> >  }
> > }
> >
> > $AGI->set_variable('googlename', "\"$name\"");
> >
> > --
> > Nabeel Jafferali
> > X2 Networks
> > www.x2n.ca
> > T: 1.647.722.6900
> >   1.877.VOIP.X2N
> > F: 1.866.655.6698
> > FWD: 46990
> >
> >
> >
> > _______________________________________________
> > Asterisk-Canada mailing list
> > Asterisk-Canada at lists.syonex.com
> > http://lists.syonex.com/mailman/listinfo/asterisk-canada
> >
> 
> 




More information about the Asterisk-Canada mailing list