Dialplan when Call Transfered, Call Forwarded

Hello,

How can I change the dialplan in extensions.conf, if I want to make special headers only when call is transfered or forwarded?

So that below code would only be executed when I make call transfer on my SIP phone?

exten => _1.,1,SIPAddHeader(Diversion: <sip:${CALLERID(dnid)}@172.30.100.15:5060>\;reason=unconditiona\;privacy=full) exten => _1.,2,Dial(SIP/${EXTEN})