"prerouting" context

Is it possible to make special context in extensions.conf, so any call from any peer pass this context BEFORE its own context defined in sip.conf? How to do this?


(I suppose you could change the source code, but I’m not sure how you would exit the early context.)

On the other hand, at least for SIP, you could define a channel variable and populate it with the real context, and configure precontext as the actual context, and exit with a Goto.

The normal way, though, would be to call precntext as a subroutine.

OK, maybe other way? How to “jump” to other context, and after this other context it should return to context from which it came?

GoSub, but you need an explicit Return.

GoSub requires extension number to jump to, and if i want just to jump to_context_ without specifying extension (there may be ANY number)?

Maybe I try to do it totally wrong, I need ability to disable (when needed) ALL calls to some specific prefix passing through this Asterisk machine. In Yate I just add “denying” rule in “prerouting” and it’s done. How to do same trick in Asterisk?

Use ${EXTEN}. You can also use macros, but they are deprecated.