There are some instances where a call that is sent to a Lync user really shouldn't be going to voice mail, or to the user's cell phone, or anywhere like that. There's nothing that screams "good customer service" to an agitated customer like being dropped into John Smith's cell phone voice mail ("Hi, this is John. Leave a message") after calling the tech support line. Response Group calls seem to magically ward off UM voice mail and call forwarding, and this has led to some questions: if Response Groups can do it, why can't we do it in UCMA applications? Actually, you can. Let's first take a minute to talk about what doesn't work. If you scrutinize the UCMA documentation, you may find an enumeration called PrivacyOptions, which is supposed to control whether a call can be forwarded, sent to voice mail, or rung to team members. This enumeration corresponds to a SIP header called Ms-Sensitivity, and you can add the header to your outgoing calls using the Headers collection on CallEstablishOptions. Supposedly, adding this header with a value of private-no-diversion will prevent a call from going anywhere except to the user's own Lync endpoints (no voice mail, no team ring, etc.).
I have never been able to get Ms-Sensitivity to work by itself. In my experience, if you add it to an outbound call to a Lync user, and let the call go to voice mail, it will still end up at the voice mail box. Team ring and call forwarding will still work. If anyone has had different experiences with this, please post a comment because I'd be very interested to hear about it.
Fortunately, I've had more success with a different SIP header, Ms-Target-Class. Response Groups adds this header as well, with a value of secondary, when calling Response Group agents. Here's how you can do this in your own code:
[csharp] CallEstablishOptions options = new CallEstablishOptions(); options.Headers.Add("Ms-Target-Class", "secondary");
avCall.BeginEstablish(targetSipUri, options, OnCallEstablishCompleted, avCall); [/csharp]
From what I can tell, the value of "secondary" for Ms-Target-Class indicates that this call is not meant for just that one specific user - it's a call that could be answered by other people as well, like a Response Group call. This causes Lync to disable a lot of the features that are only appropriate for direct calls, like voice mail and call forwarding.
Another side effect of adding this SIP header is that these calls no longer generate missed call notifications. On one hand, if you miss the call, there's no indication of what happened. On the other hand, users won't have (possibly unnecessary) missed call notifications piling up in their inboxes for calls from your UCMA application.
This technique can be very handy for UCMA applications that send calls to multiple users. Just remember that there's no way to be selective about which features get disabled by Lync for the call - you can't prevent a call from going to voice mail, but allow it to be forwarded to a cell phone. You can't get rid of missed call notifications but leave voice mail working. If you need to keep some of those features, you may need to either recreate them in your own application (e.g., sending calls to a user's voice mail manually after a certain period of time) or use a different approach instead of Ms-Target-Class, like detecting when a UM voice mail box has answered and ending the call.
Let me know if you have comments or questions about this approach.