I'm not in the lab so can't test this but I think that this can be done by using digit stripping at the route pattern level.
For example with local calls
Enter you route pattern as 21.55551234
set digit discard to "predot".
Then on your route list, insert a prefix of 21 to restore the digits sent to the gateway.