Calling an Exchange UM voicemail box directly

A few posts ago I explained how you can determine whether a call placed by your UCMA application has been answered by an Exchange voicemail box. In this post I want to share another quick tip on UCMA and voicemail: how to place a call directly to a voicemail box. If you use the Lync client much you're probably aware that you can call a contact's Exchange voicemail box directly by selecting one of the options in the "call" menu next to the person''s name. This comes in handy from time to time when you want to leave someone a message without actually calling them and waiting for the phone to ring or possibly disturbing them.

Call voicemail button in LyncWhat if you want to do the same thing -- call someone''s voicemail box directly -- from a UCMA application? If you've ever looked for a built-in way to do this in UCMA, you were probably disappointed. There is no BeginCallVoicemail method, and no DirectToVoicemail flag on AudioVideoCallEstablishOptions. So how do you do it?

As it turns out, you can call an Exchange UM voicemail box directly by tacking on ;opaque=app:voicemail to the end of the corresponding Lync user's SIP URI. So, for example, to call the voicemail box of sip:user@domain.local, you would do something like this:

[csharp] Conversation conversation = new Conversation(_endpoint); AudioVideoCall avCall = new AudioVideoCall(conversation);

avCall.BeginEstablish("sip:user@domain.local;opaque=app:voicemail", OnCallEstablished, null); [/csharp]

That's all there is to it. Instead of ringing to the user's various active endpoints, it will go straight to the voicemail box. You can use the same SIP URI format for other operations, like transfers.