Mysql IVR Customer Identification

I would like to implement an IVR menu to see if the call comes in and announces a text waiting 6 numbers. Then the number 6 is controlled by a MySQL database. If “Active” or “Valid” the status will be forwarded to an extension, If you do not, or can not find it send the voicemail line. Asterisk in version 1.8.


code status
445252 Active
555355 Valid
545422 Active
155222 Expired


Use the Job forum for step by step help, otherwise share your dialplan and where is failing.

Assuming the password is 3 digits this code should work, I have tested it on my server, before post it “NOTE THIS IS JUST AN EXAMPLE OF MYSQL AUTHENTICATION USING ASTERISK, NOT AN STEP BY STEP GUIDE”. You need to modify the code in order this meets your needs.



same=>n,Set(id=${SHELL(mysql --user=root --password=‘mypass’ --skip-column-names asterisk -e ‘select password from users where password=’${pass}’ limit 0,1 ')})

same=>n,verbose( the value of ${id} is=${pass})

same => n,GotoIf($[${id:0:3}=${pass}]?internal,0,1)

same=>n,verbose( the value of id is=${id})