Keep SIP Agent After Transfer

Hello my friends , i have a dialplan that transfer to an AGI that captures callerid and channel , but i need to get the sip agente that makes the transfer , is there a way to do that ?

;Dial Plan
exten => s,1,Answer
exten => s,2,Background(encuesta)

exten => 2,1,Wait(1)
exten => 2,n,AGI(/root/test.php)

#!/usr/bin/php -q

<?PHP require('/var/lib/asterisk/agi-bin/phpagi.php'); $agi = new AGI(); $clid = $agi->request['agi_callerid']; $clid2 = $agi->request['agi_channel']; (Here gets the sip agent that make the transfer); $agi->verbose("Caller ID is $clid"); $agi->verbose("Channel is $clid2"); (Here shows the sip agent); ?>

Thank you very much