I am building a dial plan where the need is to drop calls to premium toll numbers, such as 900/976 in the US. There is an elegant solution to this which is a much better user-friendly solution.
Due to our infrastructure, I can't really implement that fix. Ideally, I need to block the call before it ever gets routed anywhere. I need it blocked at the dial plan. Fortunately, I found a way to do this within Regular Expressions. As this was a new RegEx trick to me, I thought I'd share it.
The challenge here is not to be able to simply block 900 numbers, but to allow all calls unless they are 900 numbers. To accomplish this, I discovered the Regular Expression construct of negative lookahead assertion. The construct is simple and looks like so:
To use that with Lync and blocking premium numbers in the US, you could go with something like this:
If the user dials 9001234567 the negative lookahead assertion fires. When testing this while in the "Edit Normalization Rule" screen of Lync Control Panel, you should see the heartwarming "No match exists for the regular expression that you built." message. Yet when you dial anything else, then you will have a successful match.
To build on this, assume you are in South Korea and assume that you have to dial 111 to route your call to a 3rd party long distance provider. Further, assume users could dial either an 8 or a 9 before dialing as that was their habit on the PBX from which they are being migrated. In South Korea, the premium toll numbers are 001, 002, and 00700. The following is what I put together and appears to work fine so far in our testing:
So if the user dials 8111001xxxxxx or 9111002xxxx or 1110070xxxxx or many other permutations, the call gets dropped by the dial plan as there is no match. However, if the user dials 8111356xxxxx or 9111202xxxxxx or 1110060xxxx or many other such permutations, Lync will find a RegEx match and forward the call on to ultimately be routed to its endpoint destination.