What variable contains the actual trunk being used?

When dialing a number in freepbx, local channel is used, which finds an available trunk to actually dial out.

What variable in the dial plan captures this actual trunk ie zap, sip, iax? I need to change my dialplan behavior based on the trunk being zap or sip/iax.

I tried using custom globally from macrodialout, but with concurrent calls going out, this can be rewritten and incorrect.

${CHANNEL} will work if you put a 2 second wait after answer. There is a definite transition from the local channel to the actual channel (ie zap, iax, sip).

It tried defining a variable in macro-dialout-trunk using
Set(__realtrunk=

but the variable did not seem to persist down the line.