Please hold: your call is
Very important to us.
Music on hold file.
If you're like most people, you're probably sitting in your office right now thinking, "I wonder why those guys who do the Lync Server PowerShell blog never call me. Do they just not like me?"
To begin with, you shouldn't worry about whether we like you or not; we like everybody. (Well, except for you, over there. Sorry, but it's just not working out.) No, the real reason we never call you is because we're afraid we might get put on hold and then we'd have to sit there in silence for a minute or two before you were able to talk to us. In this day and age, what with cable TV, satellite radio, cell phones, and MP3 players, the thought of sitting in silence is just too frightening to contemplate.
Of course, we might be willing to call if we had some assurance that we'd be able to listen to something in case we get put on hold; for example, maybe you could play some music, or maybe you could have some soothing voice remind us how important our call really is to you and assure us that all calls will be answered in the order in which they were received. That would definitely help.
Admittedly, that sounds great; in fact, you're probably thinking how nice it would be to be able to play music any time you need to park a call using Microsoft Lync Server 2010.
There's just one problem: how do you go about importing an audio file to be played any time you park a call, and then how do you go about telling Lync Server to play that particular file any time you park a call? Sounds impossible, doesn't it?
And, to be perfectly honest, it is impossible.
Well, unless you use Set-CsCallParkServiceMusicOnHoldFile.
As you're about to see, while Set-CsCallParkServiceMusicOnHoldFile might be difficult to spell (or at least to type), it's pretty easy to use. The one tricky thing is this: before you can set an audio file as the music on hold file, it needs to be imported to the Application Server that hosts the Call Park application. Oh, and this: you can only have a single audio file per Application Server. That means that the same audio file will be played any time anyone gets put on hold (or at least anyone who gets put on hold via a Call Park orbit assigned to that Application Server).
Here's how you import an audio file and assign it to an Application Server:
$audioFile = Get-Content -ReadCount 0 -Encoding byte "C:\MoHFiles\MusicOnHold.wma"
Set-CsCallParkServiceMusicOnHoldFile -Service ApplicationServer:atl-cs-001.litwareinc.com -Content $audioFile
So what's going on here? Well, in the first line we're using the Get-Content cmdlet to read in the file MusicOnHold.wma and store it in a variable named $audioFile. (By the way, the .WMA format is the only audio format you can use with the Call Park application.) We set the ReadCount parameter to 0 to ensure that the file is read in all at once (otherwise PowerShell would try to read the file line-by-line, which isn't going to work with an audio file) and set the encoding parameter to byte (which lets Get-Content know that we aren't working with, say, a text file). Like we said, all that information gets stashed in the variable $audioFile.
In line 2 we then call Set-CsCallParkServiceMusicOnHoldFile to assign our audio file to the Application Server atl-cs-001.litwareinc.com. And that's all we have to do.
Oh, wait: not quite. We also have to enable music on hold for all the Call Park configurations where we want to use that feature. Fortunately, that can be done using the Set-CsCpsConfiguration cmdlet. For example, to enable music on hold throughout your organization you can use a command like this:
Get-CsCpsConfiguration | Set-CsCpsConfiguration –EnableMusicOnHold $True
Incidentally, Lync Server does ship with a default music on hold file: Cpsmoh.wma. It's unlikely that the Rolling Stones are going to do a cover version of Cpsmoh.wma, but it will work, and – best of all – you don't have to import or configure the thing: just enable music on hold, without specifying a different audio file, and you'll be in business.
Oh, and remember, this just has to be an audio file; it doesn't have to be music that gets played. If you'd like to record a message of some kind and play that instead of music, hey, that's up to you. And if you do decide to play music, well, keep in mind that there could be copyright issues involved here. But we're not lawyers, so we won't get into that.
And so if you configure music on hold for the Call Park application then will we call you? We'll see. We're really busy right now (it's like a fire drill around here), but maybe later, when things start to slow down ….