Пример #1
0
        void IMCall_EstablishCompleted(IAsyncResult result)
        {
            try
            {
                InstantMessagingCall imCall = result.AsyncState as InstantMessagingCall;
                imCall.EndEstablish(result);

                Message m = new Message("InstantMessagingCall Established. Call state: " + _instantMessagingCall.State.ToString() + ". CallId: " + _instantMessagingCall.CallId + ".",
                                        _instantMessagingCall.RemoteEndpoint.Participant.DisplayName, _instantMessagingCall.RemoteEndpoint.Participant.UserAtHost,
                                        _instantMessagingCall.RemoteEndpoint.Participant.Uri,
                                        MessageType.InstantMessage, _transcriptRecorder.Conversation.Id, MessageDirection.Incoming);
                _transcriptRecorder.OnMessageReceived(m);

                _transcriptRecorder.OnRemoteParticipantAdded(null, imCall.RemoteEndpoint);
            }
            catch (RealTimeException ex)
            {
                NonBlockingConsole.WriteLine("Error: imCall.EndEstablish failed. Exception: {0}", ex.ToString());
                // TODO: error message
            }
            finally
            {
                _state = TranscriptRecorderState.Active;
                this._waitForIMCallEstablished.Set();
            }
        }