Dial outbound zap with large local calling area

I have 60+ local call exchanges that I’d like to route outbound to a
TDM400 fxo on the pstn.

Within the dial plan, can a gotoif reasonably handle a sizeable or’ed
search pattern, like:

exten => _NXXXXXX,1,GoToIf([_123XXXX|_456XXXX|_789XXX|(many more]?2:3)

or a big global

DOLE=_123XXXX|_456XXXX|_789XXX|(many more)|_987XXX

exten => _NXXXXXX,1,GoToIf($[${DOLE}]?2:3)
exten => _NXXXXXX,2,Dial(${ZAPTRUNK}/${EXTEN})
exten => _NXXXXXX,3,Dial(${IAXTRUNK}/${EXTEN})

obviously I could list them individually in the outboung dial plan. A
variable, or read-from-a-file would be nice to have, I could use an
include with the variable and values in it.

Other suggestions?

Thanks, Andy

Answering my own questions, I could not get gotoif to parse or’ed strings
quite the way I wanted (hoped), thus the result follows for now.

I whacked around a half dozen scenarios - one can do it any way they
like, even as ugly as the following - and maybe this is ugly and labourious
to the cpu, but it stuffs all the local exchanges into one variable, or an
include file, or a db table for access, which makes it a bit easier to
manage, although you have to keep up with the code below, too. I could
(maybe) work in some auto-incrementing $dole locations with another if
and goto, until $dole="". I quite probably have missed an easier way…


; dial-out local exchanges

; Local area-code seven-digit dialing

exten => _NXXXXXX,1,SetCallerID(1234567890)

; if it’s a local exchange got to the zap trunk

exten => _NXXXXXX,2,GoToIf($[$["${EXTEN:0:3}" = “${DOLE:0:3}”] | $["${EXTEN:0:3}" = “${DOLE:4:3}”] | $["${EXTEN:0:3}" = “${DOLE:8:3}”] | $["${EXTEN:0:3}" = “${DOLE:12:3}”] | $["${EXTEN:0:3}" = “${DOLE:16:3}”]]?19:4)

exten => _NXXXXXX,3,GoToIf($[$["${EXTEN:0:3}" = “${DOLE:20:3}”] | $["${EXTEN:0:3}" = “${DOLE:24:3}”] | $["${EXTEN:0:3}" = “${DOLE:28:3}”] | $["${EXTEN:0:3}" = “${DOLE:32:3}”] | $["${EXTEN:0:3}" = “${DOLE:36:3}”]]?19:5)

exten => _NXXXXXX,4,GoToIf($[$["${EXTEN:0:3}" = “${DOLE:40:3}”] | $["${EXTEN:0:3}" = “${DOLE:44:3}”] | $["${EXTEN:0:3}" = “${DOLE:48:3}”] | $["${EXTEN:0:3}" = “${DOLE:52:3}”] | $["${EXTEN:0:3}" = “${DOLE:56:3}”]]?19:6)

… many more excluded, fortunately a pattern to edit

exten => _NXXXXXX,16,GoToIf($[$["${EXTEN:0:3}" = “${DOLE:280:3}”] | $["${EXTEN:0:3}" = “${DOLE:284:3}”] | $["${EXTEN:0:3}" = “${DOLE:288:3}”] | $["${EXTEN:0:3}" = “${DOLE:292:3}”] | $["${EXTEN:0:3}" = “${DOLE:296:3}”]]?19:18)

exten => _NXXXXXX,17,GoToIf($[$["${EXTEN:0:3}" = “${DOLE:300:3}”] | $["${EXTEN:0:3}" = “${DOLE:304:3}”]]?19:21)

exten => _NXXXXXX,18,NoOp ; space

exten => _NXXXXXX,19,Dial(${ZAPTRUNK1}/${EXTEN}) ; zap/1
exten => _NXXXXXX,20,Dial(${ZAPTRUNK2}/${EXTEN}) ; zap/2
exten => _NXXXXXX,21,Dial(${IAXTRUNK1}/1222${EXTEN})
exten => _NXXXXXX,22,Dial(${IAXTRUNK2}/1222${EXTEN})
exten => _NXXXXXX,23,Dial(${SIPTRUNK1}/1222${EXTEN})
exten => _NXXXXXX,24,Dial(${SIPTRUNK2}/1222${EXTEN})