Custom Context for sets of extensions

We are trying to semi-isolate sets of extensions on our server using contexts. So lets say we have the following sets of extensions:

100-199 (context=alpha)
200-299 (context=beta)
300-399 (context=gamma)
400-499 (context=delta)

We want 100-199 to only be able to call 100-199 and not call the other sets of numbers using the context field. I know this can be done with contexts as I have set it up for a couple sets but for each set I have to edit /etc/asterisk/extensions_custom.conf with its own special context despite it being pretty standardized.

I am wondering if there is a way to give an extension a context, it fails to find a custom defined context for itself (in extensions_custom.conf), so it falls back to some default context that I can standardize. It goes to a “default/fallback” context then I can only allow that extension to call other extensions with the same context. If this is possible then I have a lot of reading to do.

This is how I am thinking it would work:

  • Ext 100 using context alpha calls ext 125
  • Server checks for context alpha in extensions_custom.conf
  • Server does not find context alpha defined so it falls back to a default context
  • Server uses default context and sees that ext 125 has same context so it connects

  • Ext 100 using context alpha calls ext 212
  • Server checks for context alpha in extensions_custom.conf
  • Server does not find context alpha defined so it falls back to a default context
  • Server uses default context and sees that ext 212 has a different context so it hangsup in error

I hope this is making sense so far. I’m used to some other types of programming but asterisk is quite new to me.

<NICE MODE>That should be easily doable. We’ve seen people code these up in the forums many, many times. If only there was a search function at the top of every page… <\NICE MODE>

All kidding aside, we had a guy walk through the logic of this a couple of weeks ago. It should be dead simple to find.

Cool, that kind of thing would really help.

All I find by searching is voicemail context. If it was dead simple I would have gotten it through my searches and wouldn’t have bothered to make a topic about it.