Routing irregular numerical range

Greetings to you, colleagues!

Sometimes it is necessary to route an irregular number range that cannot be uniquely described with a traditional wildcard.
For example: from +X(YYY)0000000 to +X(YYY)0002017

Is it possible to set in the dialplan not a wildcard, but a numerical range?
Something like:

exten => _XXXXXXX,1,If((${EXTEN} >= 0 && ${EXTEN} <= 2017)?Goto(context111,${EXTEN},1))
same  => n,If((${EXTEN} >= 2018 && ${EXTEN} <= 5894)?Goto(context222,${EXTEN},1))

Thank you in advance for the answer to the essence of the question.

Ogogon.

You would need to use : to take a substring of ${EXTEN} an the pattern needs to end in . or be the full length.

You ca n always do:

exten => _+xyyy000200X,n,Goto(match)
exten => _+xyyy000201[0-7],s,Goto(match)

Thank you, but you, unfortunately, did not answer my question.
You have proposed to describe several wildcards to describe one range in order to compensate for its irregularity.
If you need to route a large set of not completely adjacent ranges, there may be a case that cannot be described by this method.

I want to explain that this is not my aesthetic whim.
I need to route several hundred of such ranges. And do not get the situation of ambiguity. And then edit these routing and be sure that the uniqueness of the rules is preserved.

So please answer my question. Is there a possibility in the dialplan language to explicitly set irregular numerical ranges?
Or I can not avoid using alternative methods, such as dialplan on lua? Or he also can not?

Ogogon.

Numbers are only a subset that can be described with the vocabulary of extensions. Even if an extension consists only of digits, it is not a number.

I am not sure what you are trying to accomplish. To me it looks that it is easy to match the source extension. I’d probably start with a simple lookup table (e.g. using the system sqlite database) to map the destination extension. The mapping may be optimized in case the destination extensions correlate to the source extensions.

Problem solved. I thank everyone who gave advice and recommendations.
I compare ranges with a specific EXTEN value. It turns out quite clearly and unambiguously.

Ogogon.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.