简体   繁体   English

返回新的来电uri

[英]Return new incoming call uri

I'm using this simple code to get incoming call and Uri of caller. 我正在使用此简单的代码来获取来电和呼叫者的Uri。 If user have multiple Lync sessions open it always return first one because of static index. 如果用户有多个Lync会话打开,则由于静态索引,它总是返回第一个。 How I'm able to get new connection index so that I would get proper uri of caller? 我如何能够获得新的连接索引,以便获得正确的呼叫者uri?

    Imports Microsoft.Lync.Model
Imports Microsoft.Lync.Model.Conversation
Imports Lync = Microsoft.Lync.Model.Conversation


Public Class myLync
    Private _LyncClient As LyncClient
    Public WithEvents _ConversationMgr As Microsoft.Lync.Model.Conversation.ConversationManager
    Public WithEvents _conv As Conversation

 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try
            _LyncClient = LyncClient.GetClient()
            _ConversationMgr = _LyncClient.ConversationManager
        Catch ex As Exception
        End Try
 End Sub

 Private Sub _ConversationMgr_ConversationAdded(ByVal sender As Object, ByVal e As Microsoft.Lync.Model.Conversation.ConversationManagerEventArgs) Handles _ConversationMgr.ConversationAdded
        AddHandler e.Conversation.Modalities(ModalityTypes.AudioVideo).ModalityStateChanged, AddressOf AVModalityStateChanged
 End Sub

 Private Sub AVModalityStateChanged(ByVal sender As Object, ByVal e As ModalityStateChangedEventArgs)
        Select Case e.NewState
            Case ModalityState.Notified
                Dim Uri = _ConversationMgr.Conversations.Item(0).Participants.Item(1).Contact.Uri
        End Select
 End Sub

In AVModalityStateChanged(ByVal sender As Object, ByVal e As ModalityStateChangedEventArgs) the sender parameter can be cast to type AVModality from there you can access participant. AVModalityStateChanged(ByVal sender As Object, ByVal e As ModalityStateChangedEventArgs) ,可以将sender参数AVModality转换为AVModality类型,从那里您可以访问参与者。

Excuse my c# but it would look something like:- 不好意思,我的C#看起来像:

  private void Participant_ModalityStateChanged(object sender, ModalityStateChangedEventArgs e)
    {
        if (e.NewState == ModalityState.Connected)
        {
            var modality = (AVModality) sender;
            var participant = modality.Participant;
            var uri = participant.Contact.Uri;
        }
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM