Finally found the answer here How do I modify the P-asserted Identity
It turns out the code I was using in the macro-dialout-trunk-predial-hook was for ChanSIP so was making no difference as I was using PJSIP trunks out to my provider.
When I changed back to ChanSIP trunks I used the following code in FreePBX - Config Edit
extensions_custom.conf
The NoOp lines give you some information in your FreePBX Asterisk Log Files to see which code gives you the right one to use in the SipAddHeader line.
[macro-dialout-trunk-predial-hook]
exten => s,1,NoOp(The caller id name is: ${CALLERID(name)})
exten => s,n,NoOp(The caller id number is: ${CALLERID(num)})
exten => s,n,NoOp(The ampuser is: ${AMPUSER})
exten => s,n,NoOp(The real caller id is: ${REALCALLERIDNUM})
exten => s,n,NoOp(The outbound cli is: ${DB(AMPUSER/${REALCALLERIDNUM}/outboundcid)})
exten => s,n,NoOp(Adding P-Asserted-Identity)
exten => s,n,SipAddHeader(P-Asserted-Identity: sip:${DB(AMPUSER/${REALCALLERIDNUM}/outboundcid)})
exten => s,n(done),MacroExit()
In my “caller withheld” outbound route my Route CID is “hidden”
This worked for me, hope it helps others,
Thx
D