This is very easy to accomplish once you understand the ins and outs of regular expressions, and assuming you follow all my best practices regarding number normalization, and Enterprise Voice setup. To summarize, every number a user enters in Lync should be normalized to E.164 standards, which starts with a + followed by the country code, then the area/city code and finally the local subscriber number. A Canadian example (country code 1) would be +14165551111. A UK example (country code 44) would be +442033334444. If you use the Lync Dialing Rule Optimizer to create your Enterprise Voice configuration, you'll be all set.
When all numbers are normalized to E.164, and you already have separate usages and routes for local, national and international calls, it makes it very easy to design regular expressions that meet any specific criteria required by your business.
Say your company is based in North America, and is required to block international calls to Iran (98) and North Korea (850). The Lync Dialing Rule Optimizer routing rule for international calls is this:
This rule allows any number that doesn't start with a 0 or 1 to be routed out. Only North American countries (US/Canada and some Caribbean countries) use the country code 1. All other country codes start with the digits 2-9. So essentially, this rule allows calls to any international destination.
To block calls to Iran and North Korea, modify the rule to look like this (new stuff highlighted in yellow):
This will allow any number starting with 2-9, but excludes numbers that start with 98 or 850 as required.
If you're not in North America and used the Lync Dialing Rule Optimizer to create your Enterprise Voice setup, your international rule looks a little different, because we want to make sure that North American numbers are formatted correctly (as highlighted in blue), while making sure that it does not try to route national numbers as international (using UK +44 as an example, shown in green):
To block calls to Iran and North Korea using this example, modify the rule as follows (new stuff highlighted in yellow again):
Now, anybody who tries to dial a number in Iran or North Korea will be met with a notice that the call couldn't be completed.
This method is pretty granular as you could create separate routes to block countries selectively or for a specific group of users. If you want to just block those numbers globally, you can use Unassigned Numbers to provide an announcement to users that those numbers are not allowed to be dialled. The only downside to that method is that you need to know in advance how long phone numbers are in the country you want to block.
Happy Enterprise Voicing everyone!