I’ve seen several posts over the years asking for variations of this, but no solutions. Basically, when a call comes in, I want to look up some attribute (caller ID number, in my case) in an Asterisk database, and route the call one way or another based on whether a match was found. For example, if it’s after hours, ring through if the caller is in the database, or send them to voice mail if not.
For caller ID in particular, I could do this via inbound routes, but I’d have to code a rule for each caller ID. That’s OK for a few, but if I have 50 or 60 or 1000, I’d rather just have a compact database query rather than that many individual routes to maintain.
One suggestion I found said that the database look-up could be coded in a custom destination. That looks easy enough, but I don’t see that I can branch on return. I suppose the more general question is, can I call some custom code in response to an inbound call, and branch based on a return status from it?