Compare number of caller with one in database

Hi there
I am new to asterisk. I want to compare the number of caller (calling from anywhere to our asterisk, lets suppose he/she is calling by using his/her mobile phone) and I have already stored this mobile phone number in MySQL database. Can anyone please guide me how to compare this mobile phone number of caller to the record in database.

Thanks in Advance
Atif Majid