Tuesday, September 7, 2010

Restricting called numbers in OCS Enterprise Voice

When configuring a route for Enterprise Voice, you want to match long distance numbers but you do not want to match high-risk numbers, such as 900 and 976.

How do you do that in a regular expression?

It looks like this...

^(\+411)|(\+1(?!(900|976|242|246|264|268|284|340|345|441|473|649|664|758|767|784|809|876|868|869|939))(\d{10}))$

This expression is allowing +411 or +1 XXX YYY ZZZZ, but not any number where XXX is 900, or 976, or 242 ... you get the idea. 

Incidentally, the XXX set above is a comprehensive list you can use in your dial plans as a best practice.

So the basic syntax for "except" is ?!().  Anything in the brackets will be excluded in the match processing.

No comments:

Post a Comment