How to have multiple condition destination_number in an inbound route?

Status
Not open for further replies.
Feb 1, 2017
29
2
3
107
I need to apply a destination number condition to route a long list of numbers with no obvious pattern. So I could cram them all in to a single regex like

condition destination_number ^(01324334832|01742743501|01550239421)$

but it's going to be unreadable [at least 15 numbers on this one route] so I really don't want to do it like this.
So I add another condition destination_number row, and it stops working. I assume it's ANDing them together? Is there a way to OR them? I hope that Break or Inline is something to do with this but struggling to find any documentation which explains those columns.
 

agree

Member
Aug 26, 2018
135
24
18
The only way to or conditions in xml dialplan is by using the regex=any condition style.

XML:
<condition regex="any">
    <regex field="destination_number" expression="^01324334832$"/>
    <regex field="destination_number" expression="^01742743501$"/>
    <action application="transfer" data="3000 XML ${domain_name}"/>
</condition>
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,070
577
113
But why not just create separate destinations for each number? If later you need to change the destination it is easier?
 
Feb 1, 2017
29
2
3
107
Is it? To me, the most readable approach would be one inbound route for each thing that I want to route calls to, with one number per line. It sounds like agree's approach would achieve this.

For some context, this is a PBX and SIP trunk consolidation project. The inbound route is not sending calls to an extension, it is bridging them to a downstream PBX. There are going to be ~35 of these, most will be one simple regex matching the first five digits, but about eight of the downstream systems have just "random" destination numbers and I really don't want to be creating routes for every number:pBX pair, or routes to PBXs with a ~100 character regex :eek:

It is not mission-critical to be able to what I am asking for, just a sanity-preserving measure.
 
Status
Not open for further replies.