Astcc.agi prepaid app allows numeric accounts, fails on alph


#1

Sbj; astcc.agi prepaid app allows numeric accounts, fails on alphanumeric accounts

	Hello:
I have running  Asterisk s/w pbx and astcc, a prepaid phone cards application available to work with it.  In basic case, a phone or phone line on a zap channel, or an ip phone call will go through. Things function normally, even in CallerIdNumber based authentication for a call, when that account number is completely numeric and has the full configured length (number of digits).  

The calls Fail, however, in a situation I want to use.  First,  the account number, caller ?number? part of caller id, username, account code, are computer keyboard alpha-numeric characters.  Usually, software ip phones or other Asterisk servers can send these while regular telephone keypad input can not.  Second, the number of characters may be less than as the account number length set in ?/var/lib/astcc/astcc-config.conf?.  
Data base ?select? queries thru command line access to mysql, of the table for Cards, under these conditions, returns the requested info for the correct row.  The column titled ?name? is Character(45) for its Mysql data type, not a integer / numeric data type.  

The call attempt fails, with message ?your Card is Invalid - - Goodbye? ivr message from astcc.agi, though.  This is so, despite Asterisk console output, started with asterisk -cgvvvvvvvvvvvv level of verbosity, showing that the ?card number? is both that which was sent as well as that which is defined on the corresponding row of database table.  

In extensions.conf . . .
[thiscntx]
exten => _1X.,1,deadagi(${CALLERIDNUM}, ${EXTEN}, 0)
exten => _1X.,2,Hangup

Query
mysql > use astcc;
mysql > select number, length(number) from cards;

Example cases . . .
number . . . length(number)
15029876543 . . . 15
19372345678 . . . 15
bobntoms . . . . . . . 8

It is the last case which fails, while the first 2 succeed.  How can things be set (configurations, or agi code patches) for the third case to also work?  

	Thank you in advance for assistance.  

- - octimotor - - 3/17/2006;

#2

Disclaimer: I have not used astcc so I may be completely wrong but this is from me looking at the astcc.agi code in svn (http://svn.digium.com/view/astcc/trunk/astcc.agi?annotate=40).

I think the message you are getting appears in 2 parts of the code (Lines 463-475 & 484-491), both of which are doing:

$carddata = &getcard($cardno); if (!$carddata->{number}) { ....

I would 1st check to see what the $cardno is within the getcard sub. Print it out to STDERR to see it on the console. If it actually is the card you want. Run the exact query against your database.

If that works, I would then verify what is contained in $carddata.

$carddata = &getcard($cardno);
use Data::Dumper;
print STDERR Dumper(\$carddata);
if (!$carddata->{number}) {
            ....

That should print out the data structure for $carddata to the asterisk console.

Hope this helps you.