#!/usr/bin/perl # Spoofer.agi # by ntheory # This script spoofs flex ANI via NuFone. It is (obviously) not designed with security in mind # because it has no password prompt. Security is up to you. # # This script requires two GSM files to operate properly. One is "flexani.gsm" and the other # is "numberyourecalling.gsm". Mine say "Please enter the Flex ANI you are using for this call" # and "Please enter the number you're calling", respectively. # Use the Asterisk <-> Perl AGI stuff. use Asterisk::AGI; # Create an instance of the AGI object. $AGI = new Asterisk::AGI; # Get all the environment data. %AGIData = $AGI->ReadParse (); # Get the incoming Flex ANI (AGI considers it CLID) and read it back to the user. This is not necessary. $IncomingFlexANI = $AGIData {'callerid'}; $IncomingFlexANI =~ s/[^0-9]//g; # If the caller ID is unknown don't pass it to say_digits! if ($IncomingFlexANI ne "") { $AGI->say_digits ($IncomingFlexANI); } do { # Prompt the user for the Flex ANI. $AGI->stream_file ("flexani"); $Digits = $AGI->get_data ('beep', -1, 10); # Read the digits back to the user. $AGI->say_digits ($Digits); $Digit = $AGI->get_data ('beep', -1, 1); } while ($Digit != '#'); $AGI->set_callerid ($Digits); do { # Prompt the user for the number they're calling. $AGI->stream_file ("numberyourecalling"); $Digits = $AGI->get_data ('beep', -1, 10); # Read the digits back to the user. $AGI->say_digits ($Digits); $Digit = $AGI->get_data ('beep', -1, 1); } while ($Digit != '#'); # Prepend a "1" to the outgoing number. $Digits = "1" . $Digits; # Dial via NuFone. $AGI->exec ("Dial", "IAX2/ntheory\@NuFone/$Digits"); # Hangup when it is all over. $AGI->hangup ();