How to match Phone numbers to external database


Newbie asterisk administrator here. I’m running Asterisk 1.4.42 on a CentOS 5.7, and i have been given a task to have the IVR do the following:

1 - check caller’s phone number against a table containing three columns: Number, PIN code, and a boolean flag we’ll call eligibility
2 - if number not present, ask caller to enter PIN number.
3 - once client is matched by either method, check the boolean. If it’s 1, put the caller through to support. If it’s 0, play a message and disconnect the call.

While i have some idea of how to edit IVR menus, i have no clue how to make them look up an external database (can it search MySQL, or something else?. Also, does ASTERISK have the means to the logic described above, or should/can i call an external script for it?

Thank you for reading, and i’m thankful for your reply, as i have not much time to do this, so any help would be appreciated.

Best regards,


You can use func_odbc to do this.

There is a good chapter in the Asterisk book about using ODBC for hotdesking that may help you as well.

Also you can use an AGI script to do that.