Depending on system/version you could do a few things.
Send DNIS to networking table that routes and inserts extra digits needed. (class 28)

Send DNIS to a spare phone that has call forward to external number (via speedial) which accesses the Asterisk gateway trunks and inserts extra digits.