Microsoft Lync and Skype for Business have a rich set of .NET APIs which make it easy to extend the platform and integrate it with other applications. This blog helps explain how to use those APIs.

Prevent Lync calls from going to voice mail

Posted: December 28th, 2012 | Author: | Filed under: Lync Development, UCMA 3.0, UCMA 4.0 | Tags: , , , , , , , | 1 Comment »

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:

CallEstablishOptions options = new CallEstablishOptions();
options.Headers.Add("Ms-Target-Class", "secondary");

avCall.BeginEstablish(targetSipUri, options, 
    OnCallEstablishCompleted, avCall);

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.

One Comment on “Prevent Lync calls from going to voice mail”

  1. 1 Csaba Vegso said at 3:34 pm on January 11th, 2013:

    Hi Michael,

    Based on my experience “ms-sensitivity” header works as expected. If “ms-sensitivity: Private-no-diversion” is included in INVITE then call terminates with reason code 480 Temporarily Unavailable if user does not answer the call. Call is never forwarded e.g. to voicemail. Moreover, “ms-sensitivity” works both for P2P and B2B calls.

    CallEstablishOptions ceo = new CallEstablishOptions();
    ceo.Headers.Add(new SignalingHeader(“ms-sensitivity”, “Private-no-diversion”));

    BackToBackCallSettings b2bSettings = new BackToBackCallSettings(call2, xxx);
    BackToBackCallSettings b2bSettings.CallEstablishOptions = new CallEstablishOptions();
    b2bSettings.CallEstablishOptions.Headers.Add(new SignalingHeader(“ms-sensitivity”, “Private-no-diversion”));

Leave a Reply

  • Note: Comment moderation is in use because of excessive spam. Your comment may not appear immediately.