This must exist…
A system variable holding the value of the extension you’ve just come from. I know you can get ${INVALID_EXTEN} when in the default i extension but what about when you jump from one extension to ‘s’ in another context… ${EXTEN} will just return ‘s’.
I know you could set your own variable before moving to each new extension but that would be quite a big code rewrite for me.