It sounds like you could use a dialplan tutorial to learn how to route
your outgoing calls and either add (or don't add) extra numbers
depending on the destination. Something like this:
exten => _989NXXXXXX,1,Macro(dialout-trunk,1,0${EXTEN},,)
exten => _989NXXXXXX,n,Macro(outisbusy,)
This example (when added in the correct context, and it assumes that
Zap/g0 is accessible as trunk #1) should add a zero to all numbers
starting with 989 (notice the 0 before ${EXTEN}). There are much
better dialplan writers out there, I have taken this from a
configuration generated by FreePBX in my own system, then modified it
for your application. I hope this helps get you started, but do a
Google search for "asterisk dialplan tutorial" and I think you'll find
a lot of useful information.
Good luck!
Jeremy