In your dialplan, use a mask like this:
exten => _9NXXXXXX,1,Dial(${TRUNK}/$[w${EXTEN:${STRIPMSD}}])
Use the same method for other types of calls (800, long distance, etc).
In the globals section put the following:
TRUNK=Zap/g0 ; Trunk interface
STRIPMSD=1 ; MSD digits to strip (usually 1 or 0)
Hope this helps,
ElJay