Caller context

is there a way of getting the context of the caller extension?
e.g

i would like to get the context of caller, as in when call from context A arrives to context B.
is there a way out? coz as far as i know the predefined variable ${CONTEXT} will give the current context = context B as soon as the calls arrive at context B.

i know this is possible in AGI(get the context of caller)
but i believe its very annoying to make a script just to get the caller context.

If you can’t live without AGI_dial_out.php, you can pass a variable to the AGI, then pass it back to context B.