Multiple Endpoints, Silverlight Extension Context Data

Unanswered Multiple Endpoints, Silverlight Extension Context Data

  • Tuesday, April 24, 2012 9:58 PM
     
     

    Hello!

    This is in some ways a follow up to a previous post, where I am trying to deal with an issue that has got me a little confused. I'll try not to make this too cumbersome to read, in hopes of a reply!

    I have a Workflow application that has an "acceptCallActivity." This application does various things for an inbound caller, including IVR and a custom queue that finds an available agent.

    I'm at a point in the code where all of this works fine except for the addition of a Silverlight app I am working on adding for the agents for contextual data. In our organization we utilize Polycom CX700 phones. We've established that when these phones are in use and controlled by a computer, the ParticipantEndpoint represents the phone. By adding another modality, for example, Instant Messaging, we can get additional ParticipantEndpoints that represent the Lync client (and unfortunately the mobile clients!).

    So here is my struggle. I have two active, established calls, one is "OutsideCaller" and the other is "AgentCall". I would like to be able to provide the AgentCall with the context data (all the Silverlight extension requires is the initial data, no further communication after that), specifically targeting the endpoint that represents the computer that is connected to the Polycom phone. If there is no such computer, then we just shouldn't do anything with the context data.

    After the context data is provided, I would like to transfer OutsideCaller to AgentCall, and preferably have my UCMA app be completely removed from the conversation from that point forward. If that's not possible, that's fine, however. I would also like for the agent receiving the call to only have one Lync window open to represent the conversation, transferred call and context data when this is complete.

    Does anyone have any ideas on how to accomplish this? I recognize this scenario may be a bit difficult to understand.

    Thank you!

All Replies

  • Tuesday, April 24, 2012 11:45 PM
     
      Has Code

    I think this would work with a supervised transfer, a.k.a. transfer with Replaces. In UCMA, this is the transfer that looks something like this:

    call1.BeginTransfer(call2, OnTransferCompleted, call1);

    Is this what you're trying right now? If so, what happens when you try to perform the transfer?


    Michael Greenlee | linkedin: http://www.linkedin.com/in/michaelgreenlee | blog: http://blog.greenl.ee

  • Wednesday, April 25, 2012 4:38 PM
     
      Has Code

    This is exactly what I am trying right now. I apologize that my code is in VB.NET... if we were to start over on this project we'd have utilized C#. Here are a few exerpts with comments to perhaps make it clear as to what's going on:

       Private Sub AttemptAgentCallCompleted(ByVal ar As IAsyncResult)
            Dim AgentCall As AudioVideoCall = DirectCast(ar.AsyncState, Microsoft.Rtc.Collaboration.AudioVideo.AudioVideoCall)
    
            Try
                AgentCall.EndEstablish(ar)
    
                If AgentCall.State = CallState.Established Then
    
                    ' Set up IM modality, send context data
                    Dim imc As New InstantMessagingCall(AgentCall.Conversation)
                    imc.EndEstablish(imc.BeginEstablish(Nothing, Nothing))
    
    
                    For Each rp As ConversationParticipant In AgentCall.Conversation.RemoteParticipants
                        For Each re As ParticipantEndpoint In rp.GetEndpoints()
                            Try
                                Dim ccc As ConversationContextChannel
                                ccc = New ConversationContextChannel(AgentCall.Conversation, re)
                                Dim ccceo As New ConversationContextChannelEstablishOptions()
    
                                ccceo.ApplicationInstallerPath = "https://blah.com/"
                                ccceo.ApplicationName = "LyncSideTab"
                                ccceo.ContextualData = CallerID
                                ccceo.SimpleLink = ""
                                ccceo.Toast = "Account information lookup"
                                ccceo.RemoteConversationId = AgentCall.Conversation.Id
    
                                ccc.EndEstablish(ccc.BeginEstablish(My.Settings.CWEAppID, ccceo, Nothing, ccc))
    
                            Catch ex As Exception
                                LogEvent("Exception occurred when sending context data to an endpoint.")
                                LogEvent(ex.Message.ToString())
                            End Try
                        Next
                    Next
    
    		'OutsideCaller below is an AudioVideoCall. Calling OutsideCaller.BeginTransfer has a similar effect
                    AgentCall.BeginTransfer(OutsideCaller, AddressOf TransferCallCompleted, AgentCall)
    
                End If
            Catch ex As Exception
                Debug.WriteLine("Error occurred in AttemptAgentCallCompleted.")
                Debug.WriteLine(ex.Message)
            End Try
    
        End Sub
    
        Private Sub TransferCallCompleted(ByVal ar As IAsyncResult)
            Dim AgentCall As AudioVideoCall = DirectCast(ar.AsyncState, Microsoft.Rtc.Collaboration.AudioVideo.AudioVideoCall)
    
            Try
                AgentCall.EndTransfer(ar)
            Catch ex As Exception
                Debug.WriteLine("Error occurred in TransferCallCompleted.")
                Debug.WriteLine(ex.Message.ToString())
            End Try
        End Sub

    The result of this code is the following:

    Agent receives a call notification toast, and accepts. This puts the code into AttemptAgentCallCompleted. From there, the agent receives ANOTHER toast for the instant messaging conversation. This occurs on all devices, including mobile devices. If the agent accepts on their computer, they then get a communication window open with the workflow, with the side tab. Then, when BeginTransfer is called, the current conversation window on the PC says transferring, and a new window pops up to represent the call between OutsideCaller and AgentCall.

    I think we could accept that when working with a computer plugged into a desk phone, the agent may have two conversation windows. While this isn't optimal, this isn't a deal breaker. However, the need to accept both the call and the instant message is a little bit of a workflow problem, and with the current code design a problem in that until the instant message is accepted the transfer doesn't occur.

    I really appreciate your help on this!


    • Edited by nolanga Wednesday, April 25, 2012 6:07 PM typo
    •  
  • Monday, April 30, 2012 10:22 PM
     
     
    Just thought I'd check in to see if anyone had any good ideas on this. Thanks!
  • Wednesday, May 02, 2012 11:00 PM
     
     

    The fact that they are getting the second (IM) toast on all devices makes me think the reason for the second toast is that it's being forked to all registered endpoints. 

    If you can figure out the GRUU that's being used by the agent's PC, you could target the IM call to the Lync client on the PC specifically which might eliminate the second toast.

    I have to think about how you would get that GRUU, though, given that the IP phone is the endpoint answering the call.

    Do you get the same double-toast behaviour if the agent is only signed in from one (PC) location?


    Michael Greenlee | linkedin: http://www.linkedin.com/in/michaelgreenlee | blog: http://blog.greenl.ee

  • Thursday, May 03, 2012 5:27 AM
     
     
    I can confirm that without the IP phone (and no Lync mobile), I still get the second toast.  I've been coding at this for most of the day, so I am going to take a break and look again tomorrow. Maybe I'll see something then that makes sense... finding some way to distinguish between endpoints is all I need!
  • Thursday, May 03, 2012 8:03 PM
     
     

    To distinguish between the endpoints, you can look at the User-Agent header on the SIP responses. The ones from the phone will include "Microsoft Lync 2010 Phone Edition". 

    To get the individual SIP headers from the 200 OK response when the call is answered, look at the CallMessageData object that's returned by AudioVideoCall.EndEstablish. You can find them in the CallMessageData.MessageData.SignalingHeaders collection.

    If you want to look at the different endpoints where the call is ringing, create an event handler for AudioVideoCall.ProvisionalResponseReceived and examine the headers on the messages with a ResponseCode of 180.


    Michael Greenlee | linkedin: http://www.linkedin.com/in/michaelgreenlee | blog: http://blog.greenl.ee

  • Friday, May 04, 2012 3:43 AM
     
     

    That will work if I have an established communication modality with an endpoint... but what I really need to be able to do is, by knowing only the agent's URI, determine what devices are connected and the device type, then target my instant message call.

    This still doesn't get me out of this double-toast scenario, however... still working on that one!