Disable transfers on outgoing calls

I’d like to disable transfers on outgoing calls except for a couple of local SIP extensions.

So in General Settings I put the T option in the Outbound Dial command and in my outbound-allroutes-custom I defined all outgoing patterns and put conditions such as this one to block transfers:

exten => _[89]ZXXXXXXX,1,GotoIf($[ “${BLINDTRANSFER:4:4}” = “4053” ]?skiptrcheck)
exten => _[89]ZXXXXXXX,n,GotoIf($[ ${LEN(${BLINDTRANSFER})} > 0 ]?custom-CANNOT_TRANSFER,${EXTEN},1)
exten => _[89]ZXXXXXXX,n(skiptrcheck),Macro(dialout-trunk,2,00${EXTEN},)

this works fine for blind transfers but it doesn’t work for attended transfers.

How can I let everyone call outside but only allow a couple of local extensions to transfer external calls? I also want everyone to be able to transfer internal calls.

I’m sure this issue is quite common but I haven’t come up with anything on the web yet.

Help appreciated.