Capture calling extension in a variable & query database

hi 2 all
i am newbie to asterisk.
i am using asterisk 1.2.18 and mysql server and
i want to capture the calling extensions from extension.conf file into a variable and then i want to pick up information from database on basis of calling number.
kindly help and guide me.
a bundle of thanks in advance

maani janjua

one way to do this is to use asterisk AGI functionality.

have your AGI script read the callerID (or called extensions… whatever your trying to key on) do a database action for whatever you are trying to do then pass the call as normal.

you’ll need to do some coding based on whatever you are trying to accomplish.

for example. I use a database and the callerID and called number/extension to decide whether to turn on call recording or not.


Thank You dear for your responce i will try to capture that via AGI and if there is any problem i will consult you again.
maani janjua