Hi,
I am quite happy with our FreePBX. However I have one Routing problem.
We have 10 Salesguys - Extension 10-20. And some other 2 digit / 4 digit extensions.
Currently I am working with fixed inbound routes - but I would like to route the extensions via a MySQL Database.
So normally 10 => 10, 11 => 11 etc. However in cases of holiday / illness etc. I would like to route 10 => 201 (ringgroup).
I already setup dynamic routing - but do I really have to add all possible outcomes? I wanted to do it with the Number that comes back from the database.
You can setup a default route for no matches, other than that there needs to be a match. Can you do something more clever, sure, but it depends on your unique use case.
You can do this by assigning the dynroute lookup result to an Asterisk channel variable, such as lookup_result. Then create a Custom Destination with the target set to
from-internal,${lookup_result},1
The quick and easy way is now to configure the dynroute only with the default destination set to this new custom destination, no dynamic route entries. The caller will be sent to whatever dial string comes back from the mysql lookup.
To get a more fault tolerant setup, you need a separate Dynamic Route entry for each acceptable reply back from the mysql, and branch the call to the appropriate destination without using the custom destination. That way the default destination can be used to send the caller to an acceptable place if the sql returns a value that is bad or fails to return a value at all.