You can e.g. add context=from-sip-provider to your trunk, and then add this to your extensions_custom.conf:
[from-sip-provider]
exten => _56789XXX,1,Goto(from-did-direct,${EXTEN:-3},1)
The [from-sip-provider] is an arbitrary name, the from-did-direct context is built into FreePBX to do what you require.
Explained more in detail here:
or here: