The situation:
We’re a SIP-PSTN gateway for our users. As such, all our users have real PSTN phone numbers, so incoming calls have extensions like:
[local]
exten => 6045551234,1,Dial(SIP/foo1|25)
…
exten => 6045551235,1,Dial(SIP/foo2|25)
…
exten => 2505551234,1,Dial(SIP/foo3|25)
…
And outgoing calls look like:
[outgoing]
; Toll free example
exten => _1888NXXXXXX,1,Dial(Zap/g1/${EXTEN},100)
exten => _1888NXXXXXX,2,Hangup
; Local call example, usually 604 area code
exten => _NXXNXXXXXX,1,Dial(Zap/g1/${EXTEN})
exten => _NXXNXXXXXX,2,Noop(LOCAL CALL THRU TRUNK)
exten => _NXXNXXXXXX,3,Hangup
; Long distance example
exten => _1NXXNXXXXXX,1,Dial(SIP/${EXTEN}@ldprovider1)
exten => _1NXXNXXXXXX,2,Dial(SIP/${EXTEN}@ldprovider2)
exten => _1NXXNXXXXXX,3,Hangup
How would I make the technically-long-distance-but-local-to-us calls between 250 and 604 area codes first check with the extensions in [local], before dialing out on the local or long distance channels? Aside from repeating every extension in [local] under the [outgoing] context (there’s really a lot of them).