If you could qualify the calls (by area/country code) that would or would not use the 555-1234 number, you could use context to add or not add the extra digits.
I’d figure out which is the smaller or easier group of digits to classify. (Probably the local numbers.) Put those digits into their own context like this:
[local7]
exten => _NXXXXXX,1,Macro(diallocal)
[local10]
exten => _NXXNXXXXXX,1,Macro(diallocal)
[longdistance]
exten => _1NXXNXXXXXX,1,Macro(diallong)
[tollfree]
exten => _1888NXXXXXX,1,Macro(diallocal)
exten => _1877NXXXXXX,1,Macro(diallocal)
exten => _1866NXXXXXX,1,Macro(diallocal)
exten => _1855NXXXXXX,1,Macro(diallocal)
exten => _1800NXXXXXX,1,Macro(diallocal)
[international]
exten => _011.,1,Macro(diallong)
[blockedcalls]
exten => _1900NXXXXXX,1,Congestion
exten => _1NXX976XXXX,1,Congestion
Then you’d create macros that would dial the calls for you either putting in the digits, or leaving them out:
[macro-diallocal]
exten => s,1,Dial(ZAP/1/${MACRO_EXTEN})
exten => s,2,Congestion
exten => s,102,Busy
[macro-diallong]
exten => s,1,Dial(ZAP/1/5551234${MACRO_EXTEN})
exten => s,2,Congestion
exten => s,102,Busy
Use a series of include statements in your default context. Each context is checked until a match to the digits that you dialed is made. The order that the include statements are listed is the order in which they checked. After a match is made to digits dialed, your call moves to that context and runs the listed macro.
The order that you list the include statements is EXTREMELY important.
For example, this is wrong:
[default]
include => local7
include => local10
include => longdistance
include => tollfree
include => international
include => blockedcalls
The blockedcalls numbers that are 10 or 11 digits long would match the dialing scheme of the local10 or longdistance contexts FIRST (before the blockedcalls context), and the calls would proceed.
This is correct.
[default]
include => blockedcalls
include => local7
include => local10
include => longdistance
include => tollfree
include => international
The blocked calls are matched immediately, and their treatment is followed. (In this case, they are given the congestion treatment.)
You should check each list of numbers from the smallest, most inclusive group of numbers dialed up to the largest. This will make sure that the calls are blocked or placed using the most cost effective manner.