Inserting a PSTN usage into a Voice Policy

Voice Policies are assigned to users, and they control what a user is permitted to do in terms of voice functionality and calling. The “calling” part is determined by an ordered list of PSTN Usages within the Voice Policy.

Usages in VoicePolicy

The PSTN Usages are evaluated from top to bottom, until a call completes or the end of the list is reached.

If you’re using the Control Panel GUI and have just a few PSTN Usages and Voice Policies, it’s straight forward to edit this list. However, in the land of PowerShell, your only options are to remove a PSTN Usage, or to add one. The add function appends the PSTN Usage to the end of the list of usages, which isn’t ideal given that this is an ordered list.

I recent had to insert a new PSTN Usages into a large number of Voice Policies, and wrote this script to do that.

It’s straight forward to use. Create your new PSTN Usage, then run something like this:

Insert-PSTNUsage -CsVoicePolicy <VoicePolicy> -AddUsage <UsagetoAdd> -Priority <Priority>


-CsVoicePolicy is the Voice Policy that you want to add the PSTN Usage to.

-AddUsage is the PSTN Usage that you want to add to the Voice Policy

-Priority is where the PSTN Usage should be added to the list of existing PSTN Usages. 0 is the start, and if you enter a value larger than the number of existing PSTN Usages, it’ll append to the end.

For example:

Insert-PSTNUsage -CsVoicePolicy VancouverStaff -AddUsage LongDistance -Priority 5 -verbose

This script returns no output to the console unless you use -verbose, in which case it will output the same information that’s also recorded to a log file:

Adding PstnUsage: LongDistance
To CsVoicePolicy: VancouverStaff
At priority: 2
Current Number of Usages: 6
Current Usages: zero One Two Three Four Five
Usages before insertion point: zero One
Usages after insertion point: Two Three Four Five
Restore Command: Set-CsVoicePolicy test -PstnUsages zero,One,Two,Three,Four,Five
Resulting in new usages: zero One LongDistance Two Three Four Five

  • The first three items are simply logging the parameters that you’ve provided.
  • Current Number of Usages is the number of PSTN Usages assigned to the Voice Policy before insertion.
  • Current Usages: a list of PSTN Usages assigned to the Voice Policy before insertion
  • Usages before insertion point and Usage after insertion point: Lists of usages before and after the spot where the new PSTN Usage will be inserted
  • Restore Command: this is a command that you can cut and paste into a PowerShell session to undo the Insert-CsPstnUsage command. The ability to back out your changes is something that I always like! (It might have wrapped in the above output, it’s not wrapped in the log file).
  • Resulting in new usages: this is a Get of the new list of PSTN Usages in the Voice Policy so that you can check your work.

I hope you find this useful, and I welcome your feedback!


Main Number Handling – Putting it all Together

A number of months ago, I kicked off what I thought would be a short and simple overview of the various ways you could handle a main number in SfB. As it turns out, there was nothing short about the process! However, now that we’ve covered the various components that you can use to handle calls to main numbers, it’s time to tackle some common main number scenarios that I see in organizations I work with. Along the way, I’ll throw in some tips and tricks from my list of ways to make life easier.

Before we do that, you should hop back to my first post in this series, where I talk about some of the non-technical things you should consider, and how you should approach designing a solution to handle your main numbers. You shouldn’t just rush in and set things up, as some of them take time. It’s also important to ensure that you’re getting the best SfB solution for your users, and not just a clone of what they had previously.

“I find that it’s often the case that SfB has all of the functionality to meet the same goals as users expected from a previous PBX. However, that functionality is often implemented differently.  That’s not because SfB is weird, but rather because it’s a UC system and not a PBX. There are multiple modalities to consider, as well as things like mobility and presence.  Tag for status change alerts is a good replacement for “Camp on” in the PBX world. While it may require you to take the additional step of click “call”, this does give you the opportunity to use a different modality to contact the user once they’re available, such as IM. Of course, you could always choose to IM the user who’s on the phone and thus avoid the entire requirement for Camp on functionality”

The Solutions

The first solution that I’m going to list, will also be the first one that I recommend that you not implement, and that’s to simply use the receptionist’s phone as your main line. If your receptionist goes on a break or vacation, then someone needs to know their password to check voicemails. That’s bad for security, but it also sucks for the privacy of the receptionist’s account. And what greeting gets used – the receptionists, or the organizations? Yuck, better to just move on to the next solution.

The second solution is suitable for small offices. You setup a standalone or “phantom” account for the main number, and leave the receptionist with their own account. We had a look at the good and the bad around this solution here so I won’t rehash that discussion.

Up next, we’ll have a look at options for scaling up to larger offices.