This simple AGI Perl script allows you to validate a credit card number entered by a caller.
It uses Asterisk perl agi and a CCVS Perl module http://www.analysisandsolutions.com/software/ccvs/.
use Asterisk::AGI;
use ccvs;
$AGI = new Asterisk::AGI;
my %input = $AGI->ReadParse();
my $Form = new CreditCardValidationSolution();
my @Accepted = (‘Visa’, ‘JCB’);
$AGI->stream_file(‘other/please-enter-the’);
$card_number = $AGI->get_data(‘card-number’, 15000, 16);
if ($Form->validateCreditCard($card_number, ‘en’, \@Accepted, ‘N’)) {
$AGI->stream_file(‘auth-thankyou’);
}
else {
$AGI->stream_file(‘your’);
$AGI->stream_file(‘card-is-invalid’);
}
See Also
Credit Card Dialplan for Asterisk