Change call flow based on results of a custom destination

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?

I use spam filtering that is similar. Callers in the phonebook ring through, others are sent to an IVR (leading to voicemail if they fail to press the correct key). See [SOLVED]Inbound routing for code sample.

Third party module dynroutes can do this. That is the only way I know of apart from custom dial plan.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.