Dynroutes is an option
Another would be a completely custom context that you connect to an inbound route. go to if Callerid(num) matches dbresult.