That's what the FreePBX Custom Context Module is all about. It's included in
Incredible PBX 2.0.
Ward, this is just my opinion, so please don't take it personally.
When the Custom Contexts module first came out, I thought it was great! It let us do things that had never been possible in FreePBX before. It was obvious that the author had put a lot of time and effort into it.
BUT after I used it for a while, I realized it had one major problem. It did not automatically follow the priorities of your outbound routes, but instead relied on a bunch of priority dropdowns to set priorities. Now, if you're the type that sets up a system and then never changes a thing for months or years, this is probably not going to bother you a lot. But if you’re the sort that has reason to add or delete outbound routes frequently (especially add them), those things will drive you crazy.
Plus, it was the SLOWEST module to update (after you made any changes) I have ever seen.
The author told me he was working on a version that would do away with the dropdowns, but somehow that never materialized. Then after a time, it appears he more or less abandoned it altogether. One of the FreePBX updates broke it, and that led to the infamous $4000 bounty (where they were requesting contributions from users) to get someone to fix it.
I'm not denying that in certain situations, it may be the perfect tool for the job, though I'd be hard-pressed to say what one of those situations might be. But in situations such as the OP's, it's like only having a monkey wrench when what you really need is a 1/2 inch box wrench. You might actually get the job done with it, but the results are going to be kind of ugly, and you may curse a few times while you are trying to make it work.
There are at least three different methods I'd use before I'd ever go back to Custom Contexts. One is
using the CallerID field in Outbound Routes, the second is Rob Thomas'
Outbound Route Permissions module, and the third is adding
custom dialplan to extensions_custom.conf.
If someone were still actively maintaing Custom Contexts, my suggestion would be to do anything they can to get rid of those stupid dropdowns. Until they do, that module is a huge waste of time and effort, in my personal opinion. It's the only FreePBX module I've ever found painful to use, after the initial novelty wore off (well, except of course for Outbound Routes after they changed the dial pattern entry method, but the
FreePBX Swiss Army Knife Module fixes that
).
Again, this is just my opinion. I'm sure somebody's going to say that in their unique circumstance it really did the job for them. But the OP is not in such a situation, as far as I can tell. It's really just a matter of picking the right tool for the job.