Lync 2010 SDK:如何获取用户的语音邮件URI?

时间:2012-06-07 23:55:00

标签: c# lync-2010 voicemail

我正在编写一个简单的C#应用​​程序来应答Lync调用,并根据数据库值将其转发到另一个电话号码。这非常有效。但是,有时我想将呼叫转发到用户的语音邮件。我无法弄清楚如何获取语音信箱的URI:(

假设我在ConversationAdded事件的处理程序中。我试过这个:

Conversation conv = args.Conversation;
string voicemailURI = String.Format("{0};opaque=app:voicemail",conv.SelfParticipant.Contact.Uri);
// the contact returned here, however, does not contain the opaque=app:voicemail
Contact forwardContact = lync.ContactManager.GetContactByUri(voicemailURI);

此外:

Conversation conv = args.Conversation;
// following throws ArgumentException: Value does not fall within the expected range
Phone voicemail = lync.Self.GetPhone(ContactEndpointType.VoiceMail);
string voicemailURI = voicemail.Endpoint.Uri
Contact forwardContact = lync.ContactManager.GetContactByUri(voicemailURI);

UC语音邮件已设置并正常工作。我不确定这个术语究竟是什么,但它由Exchange处理,消息显示在我的收件箱中。如果我只是让手机响铃,它最终会进入语音信箱,但我的应用知道它应该立即转到那里,所以我想立即转发它。

1 个答案:

答案 0 :(得分:0)

我想我不太确定你为什么要关心联系?您的第一个示例将为您提供直接转到语音邮件的URI。那时你可以这样做:

        var automation = LyncClient.GetAutomation();
        var conversationModes = AutomationModalities.Audio;
        var conversationSettings = new Dictionary<AutomationModalitySettings, object>();
        List<string> participants = new List<string>();
        Conversation conv = args.Conversation;            
        string voicemailURI = String.Format("{0};opaque=app:voicemail",conv.SelfParticipant.Contact.Uri);
        participants.Add(voicemailUri);
        automation.BeginStartConversation(AutomationModalities.Audio, participants, null, StartConversationCallback, automation);