How to combine complex OR and AND conditions

Let's say you want to test if a call is to any of your service lines other than UK or Ireland and that the caller also selected a specific service option, e.g. "Sales".

If we translate this into a logical expression we have (NOT (UK OR Ireland) ) AND (service option is "Sales").

In order to this in a trigger, you can use a regular expression to test that a dialed number does not start with 44 or 353, i.e. the UK and Irish country codes.

Such a regular expression looks like this: 


The bit [0-9]*$ says match any number of digits up to the end of the text string, i.e. $ is the end of string marker.

^ is the start of string marker

?! means "not preceded by ..." (also known in geek speak as "negative lookahead")

So only a string of digits will match this expression, if the first digits do not contain either "353" or "44".

You can test such java (or javascript") type regular expressions on sites like the following: 

So our complete trigger will look something like this:

The first condition uses the operator "matches" to check if the regular expression returns true for the "To: number", i.e. it checks if the support line that the caller dialed starts with 353 or 44, i.e. that the caller phoned one of the Irish or UK lines.

The second condition tests that the caller pressed 1 in the simpleMenu, i.e. in our example here that IVR menu offers something like "Press 1 to talk to someone in Sales ...".

Give it a try. You can implement lots of use cases with combinations of regular expressions and other conditions.


Have more questions? Submit a request