I don’t think you mean a trunk; I think you mean an internet telephony service provider.
DID is a term that is abused in the VoIP world. I think you really mean using the user part of the To header for DNID (dialled number indication). My Google searches suggest that
is still correct, and there is no way of doing this with chan_pjsip.
As I recall it, there is a, little used, dialstring parameter for chan_sip which allows you to set the To header.