How to combine complex OR and AND conditions (V2)

Let's say you want to test if a call is made 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").

To configure 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: 

^(?!(353|44))[0-9]*$

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 ..." (in geek speak also known as "negative lookahead")

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

You can test such java (or javascript) type regular expressions on sites like the following: http://myregexp.com/ 

Our Trigger will then look something like this:

mceclip0.png

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, meaning the caller called one of the Irish or UK lines.

The second condition tests if the caller pressed 1 in the Input Reader. In our example the 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