I set up sending the outgoing Caller ID using the PAI method, but in the chan_sip module.
To do this, certain settings are prescribed in "extensions_custom.conf".
This works for me for a regular SIP trunk. I don't know if this will work for the PJSIP trunk.
The "extensions_custom.conf" file includes the context [macro-outbound-callerid -...] extracted from the "extensions_additional.conf" file.
Lines have been added to this file between lines 18 and 19:
[macro-outbound-callerid-...]
....
18th line: exten => s,n(hidecid), ExecIf($["${CALLERID(name)}"="hidden"]?Set(CALLERPRES()=prohib_passed_screen))
;----------------------------------------------------------------------
exten => s,n,ExecIf($["${CALLERID(name)}"="hidden"]?Set(CALLERID(num-pres)=prohib_passed_screen))
exten => s,n,Noop(USEROUTCID ${USEROUTCID})
exten => s,n,SipAddHeader(P-Asserted-Identity:<sip:${USEROUTCID}@IP-address provider:port>)
;----------------------------------------------------------------------
19th line: exten => s, n, Set (CDR(outbound_num)=${CALLERID (num)})
exten => s,n,Set(CDR(outbound_cnam)=${CALLERID(name)})
;--== end of [macro-outbound-callerid-...] ==--;
In turn, the information is passed to the [macro-outbound-callerid]...] context from the [macro-dialout-trunk -...] context, which is also located in the "extensions_custom.conf" file.