Since the FTC won't allow you to register more than 6 or so numbers online without having to call... I wrote this in 10 minutes to solve the problem

This commit is contained in:
Brian West 2014-06-17 16:46:58 -05:00
parent 0361bd70a4
commit 24495304c8
1 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,44 @@
#!/usr/bin/perl
#
# Since the FTC only allows a limited set of numbers to be submitted online
# I've decided to use the power of FreeSWITCH to show how easy this is to solve.
#
# numbers.txt is a file with 1 did per line, 10 digits, If it starts with a 1 thats
# it will be stripped.
#
# Remember, Only use this for numbers YOU personally own. I have many different DID
#
#
require ESL;
use Data::Dumper;
my $con = new ESL::ESLconnection("localhost", "8021", "ClueCon");
# one 10 digit number PER LINE.
open(NUMS, "<numbers.txt");
my @nums = <NUMS>;
foreach my $num (@nums) {
chomp $num;
$num =~ s/^1//;
print "Dialing from $num\n";
my @digits = split(//, $num);
my $dial = join('w', @digits);
my $command = "originate {ignore_early_media=true,execute_on_answer_01=\'playback silence_strem://1000\',execute_on_answer_02=\'send_dtmf WWWWW1WWWWWWW1WWWWWWW${dial}w#\',execute_on_answer_03='record_session /tmp/$num.wav',origination_caller_id_number=$num}sofia/gateway/59/18883821222 &park";
my $e = $con->api('bgapi', "$command");
print $e->getBody();
sleep 40;
}
close(NUMS);
print "Done...";