[HELP] Routing Calls to extensions based on CID /LDAP

Hello,
I need some guidelines on how i can route incoming calls to the appropriate extension. We have about 8000 clients stored in a proprietary database(Advantage SQL 8.1). Every agent is responsible for certain clients. So what am trying to do is: Get the number of the dialer, if the number is in the database(planning to use a phone directory on Mysql/LDAP) route the call to the appropriate agent else route to default extension.

Is this possible? Any help is appreciated. Thanks a lot in advance.

P.S
I forgot to mention for every client i have <agent_id>

Hello,

Think you could use the func_odbc for this.

Create a query that will return an extension based on the cli of the caller.

Should not be that difficult.

Goodluck.