Question on adding custom code to start of "from-internal" context

Rob, thanks for the explanation, however I must admit I am more confused than ever.

The setting of the ALERT_INFO variable was just an example of doing “something”. My real question was regarding the correct way to return to the original context after you have done “something.”

As an example, from-internal first does
include => from-internal-noxfer
but after that statement, there’s another include:
include => from-internal-xfer

My assumption was that there must be some set of circumstances under which the second include would be executed, otherwise there’s no reason to have any includes beyond the first.

But let’s say that (hypothetically) you had something in from-internal-noxfer that would match the current value of the EXTEN variable. But for some reason, whatever that might be, you still wanted to come back and pick up where you had left off in from-internal, and run the from-internal-xfer context. Keep in mind that this is just hypothetically speaking, because I realize you probably wouldn’t do something like that in actual FreePBX code.

What I was attempting to determine was if and how you could return to the original context (from-internal in this example) and run through the rest of the includes, or whatever other code might be in that context. And I had thought you might do that in one of three ways:

  1. Just end the context with no additional statement. My thought was that this would probably NOT work if the value of EXTEN had been matched in a pattern in the first included context, but I wasn’t sure about that.

  2. Insert the next line from the original context. In other words, once there had been a match, you’d abandon all hope of returning to the original (from-internal in this hypothetical) and just duplicate any additional includes you might need within the first included context.

  3. Insert a goto that jumps to whatever would have been the next thing included in the original context. If we had gone into the from-internal-noxfer context and for whatever reason, from there you wanted to jump to from-internal-xfer, rather than duplicate the include you’d use a Goto (example: "exten _.,1,Goto(from-internal-xfer,${exten},1).

Those are the only ways that really make sense to me, but they can’t all be correct. And now it appears you’re saying that none of those will work, which would actually not surprise me.

FreePBX, at least, does still have the file extensions_override_freepbx.conf, which allows you to define your own from-internal context and add code if I want, but even that can get tricky, and as I say, the only real problem with doing that is that if you guys change the original from-internal context then any override code could suddenly “break” things.

I apologize if I am explaining this poorly. In my head I understand exactly what I’m getting at but in trying to write out an explanation I feel as though I’m not really conveying the one question I’m really asking, which is, is there a way within an "include"d context to return to the original context that called the “include” in the first place, and just continue processing with the next line AFTER the that “include”? I THINK you are telling me that’s simply not possible, right?

(Sample contexts:)

[my_main_context]
; I want to run the code in the first include
include => my_first_include
; Then I want to run the code in the second include
include => my_second_include

[my_first_include]
exten => 555,1,NoOp(I am in my_first_include)
; Now what do I put here to return to my_main_context and run my_second_include?

If that’s not clear enough, then again I apologize, but I don’t know how else to explain it.