Sending all extension calls out a trunk

I have FreePBX deployed as a switch for my office, and it trunks on behalf of some users as registered endpoints to our softswitch platform. I need a way so that all XXXX based calls are sent outbound to the softswitch. I can then use short codes to send the call back to FreePBX and then inbound route rules to make sure that the call ends up back at the proper extension. The problem is that my users who have registration on the softswitch need to have it control when to cut the call and send to our voicemail platform, and other users on FreePBX do not loop out, which causes the call to land on an unprovisioned voicemail box in FreePBX. Does anyone have an idea how to make all XXXX based dialing get sent out of a trunk to the softswitch? All other number translation, and looping back to the PBX I have figured out, but this one last piece is hanging me up.

I did some additional thinking on this as well. Another viable solution would be if I could set behavior for “No answer>Voicemail” to send an invite to the other voicemail platform with a diversion header of the fully provisioned number within the voicemail system, that this could also be a viable option.

I either need a way to send all extension-based dialing out side trixbox, which I can then loop back to Trixbox for required extensions, or I need an elegant way to forward voicemail invites to another server with a diversion header.