Outbound Route with an OR condition

Status
Not open for further replies.

Mike Loiterman

New Member
Jan 23, 2018
23
1
3
47
I'm trying to do an outbound route with an "OR". I want the route to apply if one of two conditions is applicable:

1. Destination Number is true for REGEX ^94(.*)$
2. Extension initiating call is 203

Seems like I could do this with a regex tag in the outbound route, but I can't figure out how to format the Dialplan entry in the GUI.
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,038
556
113
I'm not sure about ORs. The easy way I suppose it to duplicate the outbound rout and change the condition.
 

Mike Loiterman

New Member
Jan 23, 2018
23
1
3
47
I'm not sure about ORs. The easy way I suppose it to duplicate the outbound rout and change the condition.

Of course. But this must be over engineered... :)

This is the way you would do it with regular FreeSWITCH:

<condition regex="any">
<!-- If either of these is true then the subsequent actions are added to execute list -->
<regex field="caller_id_name" expression="Some User"/>
<regex field="caller_id_number" expression="^1001$"/>
<action application="log" data="INFO At least one of the conditions matched!"/>
<!-- If *none* of the regexes is true then the anti-actions are added to the execute list -->
<anti-action application="log" data="WARNING None of the conditions matched!"/>
</condition>

How can that be reproduced in the Outbound Route GUI?

I can see how to do a REGEX in the GUI, but I can't figure out how to format everything.
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,038
556
113
@Mike Loiterman

Create a dummy outbound route first then edit it. Select a dummy condition and click into another filed, then you should be able to click into the condition field and freely type.

I think this is the result you are looking for?
regex.jpg
 

Mike Loiterman

New Member
Jan 23, 2018
23
1
3
47
That didn't work...

FreeSWITCH says:
Dialplan: sofia/internal/100@$DOMAIN.net Regex (FAIL) [$PROVIDER] regex() =~ /any/ break=on-false

Screen Shot 2018-02-25 at 2.08.30 PM.png
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,038
556
113
Just checked the db and the regex didn't get put in for my example:

-------------------------------------------------------------------------------------------------
<extension name="transfer.0" continue="false" uuid="8ecbfe0a-1533-4939-b188-e4f60982fe63"> +
<condition field="regex" expression="any"> +
<action application="log" data="INFO At least one of the conditions matched!"/>+
<anti-action application="log" data="WARNING None of the conditions matched!"/>+
</condition> +
</extension>
 

Mike Loiterman

New Member
Jan 23, 2018
23
1
3
47
Just checked the db and the regex didn't get put in for my example:

-------------------------------------------------------------------------------------------------
<extension name="transfer.0" continue="false" uuid="8ecbfe0a-1533-4939-b188-e4f60982fe63"> +
<condition field="regex" expression="any"> +
<action application="log" data="INFO At least one of the conditions matched!"/>+
<anti-action application="log" data="WARNING None of the conditions matched!"/>+
</condition> +
</extension>

There's that, and then I think I need to do a condition set destinatio_number=$1. Fixing these SHOULD allow the 94 prefix, but how would I ALSO do a condition username = 203?
 

Mike Loiterman

New Member
Jan 23, 2018
23
1
3
47
Right ^94(.*)$ would be the prefix to match. 203 is the extension that I want to route. The fields would be different.
 
Status
Not open for further replies.