The following guide and screenshots show the settings required to have the DDI number of an extension to show as its caller ID on outbound calls.  This is an example using a Spark trunk. These settings also ensure that an inbound call can be forwarded back out the trunk to an external number. In this example, a mobile number as an always forward from a specific extension.

Following are screenshots of the settings that require configuring on the Yeastar S-series PBX.

Example settings of an extension to display its DDI on outbound calls and forward inbound calls to external mobile.

Trunk settings
Trunk basic settings. Note that the Caller ID number and From User fields are blank.
Trunk advanced settings.  Note the P Asserted Identity and P Preferred Identity fields for outbound and transfer parameter and the From field in Transfer Parameters.

Add a DOD entry for appropriate extensions with their matching DDI number as this will be used in the From field when forwarding a call externally.