In the external_replaces extension, you will have access to the following channel variables:
SIPTRANSFER: Set This variable is set to "yes" to indicate upon entering the
external_replacesextension, and indicates that a SIP transfer is happening. This is only useful if, for whatever reason, you are using the the
external_replacesextension for additional purposes than a SIP remote attended transfer.
SIPREFERRINGCONTEXT: This is the dialplan context in which the
external_replacesextension was found. This may be useful if your
external_replacesextension calls into subroutines or jumps to other contexts.
SIPREFERTOHDR: This is the SIP URI in the Refer-To header in the REFER request sent by the transferring party.