From 91657faf24615736d0cdf7a6c0a9d3e98443b21e Mon Sep 17 00:00:00 2001 From: Russ Handorf Date: Sat, 13 Feb 2016 19:12:34 -0500 Subject: [PATCH] initial commit --- README | 36 ++++++++++++++++++++++ spoof.agi | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 README create mode 100644 spoof.agi diff --git a/README b/README new file mode 100644 index 0000000..e677e4b --- /dev/null +++ b/README @@ -0,0 +1,36 @@ +############################################################################### +# The MIT License (MIT) +# Copyright (c) Russell Handorf +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +############################################################################### + +I've had some people ask me "how do you spoof your caller ID yourself?" Well, here it is... + +1. Find an IAX or SIP provider that is asterisk compatible +2. Install asterisk +3. Install Festival or SWIFT. I prefer SWIFT, but for those who dont want to pay, this one works for Festival. Replace 'festivle' with 'swift' to make it use SWIFT. +4. Edit your extendions.conf somehow to have: + exten => XXX,1,Answer() + exten => XXX,2,AGI(/etc/asterisk/spoof.agi,${CALLERID(num)}) + + Where XXX is your internal extension number +5. Edit the 'trusted' array to include the caller ID's and extensions of folks who will be allowed to execute this script. +6. Get permission to test, dont break the law, and then try it. diff --git a/spoof.agi b/spoof.agi new file mode 100644 index 0000000..70e0eae --- /dev/null +++ b/spoof.agi @@ -0,0 +1,92 @@ +#!/usr/bin/perl + +use Asterisk::AGI; + +$AGI = new Asterisk::AGI; + +my $callerid=$ARGV[0]; +my @trusted=("1112223333","2223334444"); +my $size= scalar @trusted; +my $match=0; + +while ($size>0) { + $size--; + if ($callerid eq $trusted[$size]) { + $match=1; + } +} + +if ($match==1) { + $AGI->exec('Festival', '"Please. Enter. the. source. number"'); + + my %input = $AGI->ReadParse(); + + my $finished = 0; + + while (!$finished) { + my $input = chr($AGI->wait_for_digit('5000')); + if ($input =~ /^[0-9\*\#]$/) { + if ($input =~ /^[\*\#]$/) { + $x++; + if ($x > 10) { + $finished = 1; + } else { + $code.= ''; + } + } else { + $code .= $input; + } + } + + if ( length($code) > 10) { + $finished = 1; + } + } + + $AGI->exec('Festival', '"Please. Enter. the. destination. number"'); + `echo "$code">/tmp/code`; + + my $finished2 = 0; + `echo "here">/tmp/code`; + while (!$finished2) { + my $input = chr($AGI->wait_for_digit('5000')); + if ($input =~ /^[0-9\*\#]$/) { + if ($input =~ /^[\*\#]$/) { + $x2++; + if ($x2 > 10) { + $finished2 = 1; + } else { + $code2.= ''; + } + } else { + $code2 .= $input; + } + } + + if ( length($code2) > 10) { + $finished2 = 1; + } + } + +$AGI->setcallback(\&callback); + +$AGI->exec('Festival', '"I will now dial "'); +$AGI->exec('Festival', $code2); +$AGI->exec('Festival', '"with"'); +$AGI->exec('Festival', $code); +#Your IAX/SIP dialing instruction go here... For Example: +#$code2="IAX2/1234\@iax2provider/$code2"; +#$code2="SIP/$code2\@sipprovider"; +$code2=""; +$AGI->set_callerid($code); +$AGI->exec('Dial', $code2); +} else { + $AGI->exec('Festival', '"Unauthorized. Attempt logged."'); +} + +sub callback(){ + warn "The call has ended\n"; + set_context($context); + exit; +} + -- 2.17.1