Validate a number keyed from handset

Is there a relatively simple way to use a MySQL table to validate this customer number against a small customer number database? Instead of just checking for the correct length like it does now??

[custom-digits]
exten => s,1,Wait(1)
exten => s,n,Read(custno,enter-customer-number,0,3,10)
exten => s,n,Gotoif($["${LEN(${custno})}" = “6”]?s,20)
exten => s,n,Noop(Not 6 digits)
exten => s,n,Hangup()
exten => s,20,Noop(6 digits entered, forwarding to techs)
exten => s,n,Dial(SIP/6005)

It’s being used to screen Tech Support agents from being called after hours by demo clients who don’t have a valid/paid license for their product.

It’s running under:

Asterisk 1.6.2.15
Dahdi 2.4.0
Ubuntu 10.4LTS

This may help?

savelono.com/linux/asterisk- … -odbc.html