Dialplan Help needed

hi,
I’d like to know the way that how can I search the caller id from the mysql db and if I found than accept some input (DTMF)
from the caller and save that input to mysql table and if could not find the caller id in the mysql table than forward
it into the voicemail.
any direction or tutorial or hint in this regard will be higly appreciated.

AGI - asterisk gateway interface.
There are Perl, PHP and many other realisations of AGI - with examples.
In AGI - you can get CallerID, then look in MySQL, and either ask for digits or jump to other extension.
If you use Perl - you can install asterisk-perl-0.10 and use lot of functions easy way.

With Asterisk 1.4/1.6 you should also be able do this just within the dialplan, without an AGI script; in func_odbc.conf you can define the functions to look for the caller id in the database and to save the data entered, see voip-info.org/wiki/view/Aste … +func_odbc .
So I would use an odbc function to check the caller id, then with GotoIf goto to different sections of the dialplan, to wait for dtmfs with the Read() application and eventually save them in the database through another odbc function (when caller id ok) or goto to the voicemail (when caller id not ok).

Cheers.

Marco Bruni
www.marcobruni.net