//Launches an instant message. Text of the message depends on the parameter value.
        public void UcmaIM(Int32 choice)
        {
            helper       = new UCMASampleHelper();
            userEndpoint = helper.CreateEstablishedUserEndpoint("SampleUser");
            Console.WriteLine("endpoint owned by " + userEndpoint.OwnerUri + " is established/registered");

            ConversationSettings conversationSettings = new ConversationSettings();

            conversationSettings.Subject = conversationSubject;
            Conversation conversation = new Conversation(userEndpoint, conversationSettings);

            ImCall = new InstantMessagingCall(conversation);
            ImCall.InstantMessagingFlowConfigurationRequested += new EventHandler <InstantMessagingFlowConfigurationRequestedEventArgs>(ImCall_InstantMessagingFlowConfigurationRequested);

            Int32 helloChoice   = 1;
            Int32 goodbyeChoice = 2;

            if (choice == helloChoice)
            {
                messageText = "hello";
            }
            else if (choice == goodbyeChoice)
            {
                messageText = "goodbye";
            }
            else
            {
                messageText = "press 1 or press 2";
            }

            string targetURI = ConfigurationManager.AppSettings["UserURI1"];

            ImCall.BeginEstablish(targetURI, null, CallEstablishCompleted, null);
            completedEvent.WaitOne();
        }
Пример #2
0
        /// <summary>
        /// Helper method to create new web conversation.
        /// </summary>
        /// <param name="request">Create conversation request.</param>
        /// <param name="conversationCallback">Conversation callback.</param>
        /// <param name="contextChannel">Context channel.</param>
        /// <returns>WebConversation.</returns>
        internal WebConversation CreateNewWebConversation(CreateConversationRequest request, IConversationCallback conversationCallback, IContextChannel contextChannel)
        {
            WebConversation webConversation = null;

            ConversationSettings convSettings = new ConversationSettings();

            convSettings.Subject = request.ConversationSubject;

            //First create a ucma conversation.
            Conversation ucmaConversation = new Conversation(this.ApplicationEndpoint, convSettings);

            ucmaConversation.Impersonate(WebConversationManager.CreateUserUri(this.ApplicationEndpoint.DefaultDomain), null /*phoneUri*/, request.DisplayName);

            //Register for state changes.
            ucmaConversation.StateChanged += this.UcmaConversation_StateChanged;

            //Now create a web conversation.
            webConversation = new WebConversation(ucmaConversation, conversationCallback, request.ConversationContext, contextChannel);

            //Add conversation to local cache.
            lock (m_conversationDictionary)
            {
                m_conversationDictionary.Add(webConversation.Id, webConversation);
            }

            return(webConversation);
        }
Пример #3
0
 /// <summary>
 /// Initialize a new instance of CommitAgentDialog.
 /// </summary>
 public CommitAgentDialog()
 {
     this.convSettings          = new ConversationSettings();
     this.convSettings.Priority = conversationPriority;
     this.convSettings.Subject  = conversationSubject;
     InstanceId = Guid.NewGuid();
 }
Пример #4
0
        public void Run()
        {
            // Initialize and register the endpoint, using the credentials of the user the application will be acting as.
            _helper       = new UCMASampleHelper();
            _userEndpoint = _helper.CreateEstablishedUserEndpoint("B2BCall Sample User" /*endpointFriendlyName*/);
            _userEndpoint.RegisterForIncomingCall <AudioVideoCall>(inboundAVCall_CallReceived);

            // Conversation settings for the outbound call (to the agent).
            ConversationSettings outConvSettings = new ConversationSettings();

            outConvSettings.Priority = _conversationPriority;
            outConvSettings.Subject  = _outConversationSubject;

            // Create the Conversation instance between UCMA and the agent.
            _outboundConversation = new Conversation(_userEndpoint, outConvSettings);

            // Create the outbound call between UCMA and the agent.
            _outboundAVCall = new AudioVideoCall(_outboundConversation);

            // Register for notification of the StateChanged event on the outbound call.
            _outboundAVCall.StateChanged += new EventHandler <CallStateChangedEventArgs>(outboundAVCall_StateChanged);

            // Prompt for called party - the agent.
            _calledParty = UCMASampleHelper.PromptUser("Enter the URI of the called party, in sip:User@Host form or tel:+1XXXYYYZZZZ form => ", "RemoteUserURI1");

            _outboundCallLeg = new BackToBackCallSettings(_outboundAVCall, _calledParty);

            // Pause the main thread until both calls, the BackToBackCall, both conversations,
            // and the platform are shut down.
            _waitUntilOneUserHangsUp.WaitOne();

            // Pause the console to allow for easier viewing of logs.
            Console.WriteLine("Press any key to end the sample.");
            Console.ReadKey();
        }
Пример #5
0
 /// <summary>
 /// Initialize a new instance of OutBoundInstantMessagingCall.
 /// Throws ArgumentNullException if appEndPoint or conversationSettings or destinationUri is null
 /// </summary>
 /// <param name="appEndPoint"></param>
 /// <param name="csettings"></param>
 /// <param name="destinationUri"></param>
 public OutBoundInstantMessagingCall(ApplicationEndpoint appEndPoint, ConversationSettings csettings, string destinationUri)
     : this()
 {
     this.AppEndPoint    = appEndPoint;
     this.ConvSettings   = csettings;
     this.DestinationUri = destinationUri;
 }
Пример #6
0
        public void Run()
        {
            //Initialize and register the endpoint, using the credentials of the user the application will be acting as.
            _helper       = new UCMASampleHelper();
            _userEndpoint = _helper.CreateEstablishedUserEndpoint("AVCall Sample User" /*endpointFriendlyName*/);

            //Set up the conversation and place the call.
            ConversationSettings convSettings = new ConversationSettings();

            convSettings.Priority = _conversationPriority;
            convSettings.Subject  = _conversationSubject;

            //Conversation represents a collection of modalities in the context of a dialog with one or multiple callees.
            Conversation conversation = new Conversation(_userEndpoint, convSettings);

            _audioVideoCall = new AudioVideoCall(conversation);

            //Call: StateChanged: Only hooked up for logging.
            _audioVideoCall.StateChanged += new EventHandler <CallStateChangedEventArgs>(audioVideoCall_StateChanged);

            //Subscribe for the flow configuration requested event; the flow will be used to send the media.
            //Ultimately, as a part of the callback, the media will be sent/received.
            _audioVideoCall.AudioVideoFlowConfigurationRequested += this.audioVideoCall_FlowConfigurationRequested;

            // Prompt for called party
            _calledParty = UCMASampleHelper.PromptUser("Enter the URI for the user logged onto Microsoft Lync, in the sip:User@Host format or tel:+1XXXYYYZZZZ format => ", "RemoteUserURI");

            //Place the call to the remote party.
            _audioVideoCall.BeginEstablish(_calledParty, null, EndCallEstablish, _audioVideoCall);

            //Sync; wait for the call to complete.
            Console.WriteLine("Calling the remote user...");
            _waitForCallToEstablish.WaitOne();

            // Terminate the call, and then the conversation.
            // Terminating these additional objects individually is made redundant by shutting down the platform right after, but in the multiple call case,
            // this is needed for object hygene. Terminating a Conversation terminates all it's associated calls, and terminating an endpoint will terminate
            // all conversations on that endpoint.
            _audioVideoCall.BeginTerminate(EndTerminateCall, _audioVideoCall);
            Console.WriteLine("Waiting for the call to get terminated...");
            _waitForCallToTerminate.WaitOne();
            _audioVideoCall.Conversation.BeginTerminate(EndTerminateConversation, _audioVideoCall.Conversation);
            Console.WriteLine("Waiting for the conversation to get terminated...");
            _waitForConversationToTerminate.WaitOne();

            //Now, cleanup by shutting down the platform.
            Console.WriteLine("Shutting down the platform...");
            _helper.ShutdownPlatform();

            // Pause the console to allow for easier viewing of logs.
            Console.WriteLine("Please hit any key to end the sample.");
            Console.ReadKey();
        }
Пример #7
0
        public AudioVideoFlow CreateAudioVideoFlow(EventHandler <AudioVideoFlowConfigurationRequestedEventArgs> audioVideoFlowConfigurationRequestedEventHandler, EventHandler <MediaFlowStateChangedEventArgs> audioVideoFlowStateChangedEventHandler)
        {
            _audioVideoFlowConfigurationRequestedEventHandler = audioVideoFlowConfigurationRequestedEventHandler;
            _audioVideoFlowStateChangedEventHandler           = audioVideoFlowStateChangedEventHandler;

            UCMASampleHelper UCMASampleHelper = new UCMASampleHelper();
            UserEndpoint     userEndpoint     = UCMASampleHelper.CreateEstablishedUserEndpoint("AudioVideoFlowHelper");

            // If application settings are provided via the app.config file, then use them
            if (ConfigurationManager.AppSettings.HasKeys() == true)
            {
                _calledParty = "sip:" + ConfigurationManager.AppSettings["CalledParty"];
            }
            else
            {
                // Prompt user for user URI
                string prompt = "Please enter the Called Party URI in the User@Host format => ";
                _calledParty = UCMASampleHelper.PromptUser(prompt, "Remote User URI");
                _calledParty = "sip:" + _calledParty;
            }

            // Setup the conversation and place the call.
            ConversationSettings convSettings = new ConversationSettings();

            convSettings.Priority = _conversationPriority;
            convSettings.Subject  = _conversationSubject;

            // Conversation represents a collection of modes of communication (media types)in the context of a dialog with one or multiple callees.
            Conversation   conversation   = new Conversation(userEndpoint, convSettings);
            AudioVideoCall audioVideoCall = new AudioVideoCall(conversation);

            //Call: StateChanged: Only hooked up for logging.
            audioVideoCall.StateChanged += new EventHandler <CallStateChangedEventArgs>(audioVideoCall_StateChanged);

            //Subscribe for the flow configuration requested event; the flow will be used to send the media.
            //Ultimately, as a part of the callback, the media will be sent/recieved.
            audioVideoCall.AudioVideoFlowConfigurationRequested += new EventHandler <AudioVideoFlowConfigurationRequestedEventArgs>(audioVideoCall_FlowConfigurationRequested);

            //Place the call to the remote party, with the default call options.
            audioVideoCall.BeginEstablish(_calledParty, null, EndCallEstablish, audioVideoCall);

            //Sync; wait for the call to complete.
            _waitForAudioVideoCallEstablishCompleted.WaitOne();

            //Sync; wait for the AudioVideoFlow goes Active
            _waitForAudioVideoFlowStateChangedToActiveCompleted.WaitOne();

            return(_audioVideoFlow);
        }
Пример #8
0
        /// <summary>
        /// Establishes the call anchor for a customer session.
        /// </summary>
        /// <param name="callback"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public IAsyncResult BeginEstablish(RealTimeAddress helpdeskNumber, AsyncCallback callback, object state)
        {
            EstablishAsyncResult establishAsyncResult = null;

            if (helpdeskNumber == null)
            {
                throw new ArgumentNullException("helpdeskNumber");
            }
            lock (this.syncRoot)
            {
                if (this.pendingEstablishAsyncResult != null)
                {
                    throw new InvalidOperationException("Already a pending async result is in progress");
                }
                if (this.customerRemoteParticipant == null)
                {
                    throw new InvalidOperationException("Customer has already left the conversation");
                }

                if (this.trustedConversation == null)
                {
                    ConversationSettings settings = new ConversationSettings(ConversationPriority.Normal, "Dialout", "<" + this.CustomerUri + ">");
                    this.trustedConversation = new Conversation(this.customerConversation.Endpoint, settings);

                    // Config change: We cannot impersonate with user endpoint.
                    if (!Boolean.Parse(System.Configuration.ConfigurationManager.AppSettings["UseUserEndPoint"]))
                    {
                        this.trustedConversation.Impersonate(this.customerRemoteParticipant.Uri, this.customerRemoteParticipant.PhoneUri, this.customerRemoteParticipant.DisplayName);
                    }
                    this.RegisterTrustedConversationEventHandlers(this.trustedConversation);
                }

                establishAsyncResult             = new EstablishAsyncResult(this, this.trustedConversation, this.customerConversation, helpdeskNumber, this.logger, callback, state);
                this.pendingEstablishAsyncResult = establishAsyncResult;
            }

            establishAsyncResult.Process();

            return(establishAsyncResult);
        }
Пример #9
0
        public Location(int id, string name, string fileName, LocalEndpoint endpoint)
        {
            if (!File.Exists(fileName))
                throw new FileNotFoundException(fileName);

            _id = id;
            _Name = name;
            _FileName = fileName;
            _Endpoint = endpoint;

            ConferenceScheduleInformation csi = new ConferenceScheduleInformation()
            {
                AccessLevel = ConferenceAccessLevel.Everyone,
                Description = _Name,
                ExpiryTime = DateTime.Now.AddYears(5),
                AutomaticLeaderAssignment = AutomaticLeaderAssignment.Everyone
            };

            csi.Mcus.Add(new ConferenceMcuInformation(McuType.AudioVideo));

            _Endpoint.ConferenceServices.BeginScheduleConference(csi,
                ar =>
                {
                    try
                    {
                        _conference = _Endpoint.ConferenceServices.EndScheduleConference(ar);

                        Log("Conference " + _conference.ConferenceId + " scheduled. Starting music...");

                        Log(_conference.ConferenceUri);

                        ConversationSettings cs = new ConversationSettings()
                        {
                            Subject = _Name
                        };

                        _conversation = new Conversation(_Endpoint, cs);

                        ConferenceJoinOptions cjo = new ConferenceJoinOptions()
                        {
                            JoinMode = JoinMode.TrustedParticipant
                        };

                        _conversation.ConferenceSession.BeginJoin(_conference.ConferenceUri,
                            cjo,
                            ar1 =>
                            {
                                try
                                {
                                    _conversation.ConferenceSession.EndJoin(ar1);

                                    _avCall = new AudioVideoCall(_conversation);
                                    _avCall.AudioVideoFlowConfigurationRequested +=
                                        new EventHandler<AudioVideoFlowConfigurationRequestedEventArgs>(_avCall_AudioVideoFlowConfigurationRequested);

                                    AudioVideoCallEstablishOptions options = new AudioVideoCallEstablishOptions()
                                    {
                                        UseGeneratedIdentityForTrustedConference = true,
                                        SupportsReplaces = CapabilitySupport.Supported
                                    };

                                    _avCall.BeginEstablish(
                                        options,
                                        ar2 =>
                                        {
                                            try
                                            {
                                                _avCall.EndEstablish(ar2);
                                            }
                                            catch (Exception ex)
                                            {
                                                Log(ex.ToString());
                                            }
                                        },
                                        null);
                                }
                                catch (Exception ex)
                                {
                                    Log(ex.ToString());
                                }
                            },
                            null);
                    }
                    catch (Exception ex)
                    {
                        Log(ex.ToString());
                    }
                },
                null);
        }
Пример #10
0
        /**
         *
         */
        public void sendMessage(String subject, String content, String sendtos)
        {
            _sendCount = 0;

            if (subject != null)
            {
                _conversationSubject = subject;
            }
            if (content != null)
            {
                String htmlMessage = "<html><body ><div>" + content + "</div></body></html>";
                _messageToSend = htmlMessage;
            }
            Exception ex = null;

            try
            {
                //Create the UserEndpoint
                _helper       = new OCSHelper();
                _userEndpoint = _helper.CreateEstablishedUserEndpoint();

                //Setup the conversation and place the call
                ConversationSettings convSettings = new ConversationSettings();
                convSettings.Priority = _conversationPriority;
                convSettings.Subject  = _conversationSubject;


                if (sendtos != null)
                {
                    String[] sendtoArray = sendtos.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    if (sendtoArray != null && sendtoArray.Length > 0)
                    {
                        _sentTotal            = sendtoArray.Length;
                        _instantMessagingCall = new InstantMessagingCall[_sentTotal];
                        for (int i = 0; i < sendtoArray.Length; i++)
                        {
                            Conversation conversation = new Conversation(_userEndpoint, convSettings);
                            _instantMessagingCall[i] = new InstantMessagingCall(conversation);
                            _instantMessagingCall[i].StateChanged += this.InstantMessagingCall_StateChanged;
                            _instantMessagingCall[i].InstantMessagingFlowConfigurationRequested +=
                                this.InstantMessagingCall_FlowConfigurationRequested;
                            String _sendToAccount = "sip:" + sendtoArray[i] + "@mediatek.com";
                            _instantMessagingCall[i].BeginEstablish(_sendToAccount, new ToastMessage("Hello Toast"), null,
                                                                    CallEstablishCompleted, _instantMessagingCall[i]);
                        }
                    }
                }
            }
            catch (InvalidOperationException iOpEx)
            {
                ex = iOpEx;
            }finally{
                if (ex != null)
                {
                    _helper.log(ex.ToString());
                    _helper.log("Shutting down platform due to error");
                    _helper.ShutdownPlatform();
                }
            }
            _OCSCompletedEvent.WaitOne();
        }
Пример #11
0
        public void Run()
        {
            //Initalize and startup the platform.
            ClientPlatformSettings clientPlatformSettings = new ClientPlatformSettings(_applicationName, _transportType);

            _collabPlatform = new CollaborationPlatform(clientPlatformSettings);
            _collabPlatform.BeginStartup(EndPlatformStartup, _collabPlatform);

            // Get port range
            NetworkPortRange portRange = CollaborationPlatform.AudioVideoSettings.GetPortRange();

            Console.WriteLine("Port range is from " + portRange.LocalNetworkPortMin + " to " + portRange.LocalNetworkPortMax);

            // Modifying port range
            portRange.SetRange(1500, 2000);
            CollaborationPlatform.AudioVideoSettings.SetPortRange(portRange);
            Console.WriteLine("Port range now is from " + portRange.LocalNetworkPortMin + " to " + portRange.LocalNetworkPortMax);

            //Sync; wait for the startup to complete.
            _autoResetEvent.WaitOne();


            //Initalize and register the endpoint, using the credentials of the user the application will be acting as.
            UserEndpointSettings userEndpointSettings = new UserEndpointSettings(_userURI, _userServer);

            userEndpointSettings.Credential = _credential;
            _userEndpoint = new UserEndpoint(_collabPlatform, userEndpointSettings);
            _userEndpoint.BeginEstablish(EndEndpointEstablish, _userEndpoint);

            //Sync; wait for the registration to complete.
            _autoResetEvent.WaitOne();


            //Setup the conversation and place the call.
            ConversationSettings convSettings = new ConversationSettings();

            convSettings.Priority = _conversationPriority;
            convSettings.Subject  = _conversationSubject;
            //Conversation represents a collection of modalities in the context of a dialog with one or multiple callees.
            Conversation conversation = new Conversation(_userEndpoint, convSettings);

            _audioVideoCall = new AudioVideoCall(conversation);

            //Call: StateChanged: Only hooked up for logging.
            _audioVideoCall.StateChanged += new EventHandler <CallStateChangedEventArgs>(audioVideoCall_StateChanged);

            //Subscribe for the flow configuration requested event; the flow will be used to send the media.
            //Ultimately, as a part of the callback, the media will be sent/recieved.
            _audioVideoCall.AudioVideoFlowConfigurationRequested += this.audioVideoCall_FlowConfigurationRequested;


            //Place the call to the remote party;
            _audioVideoCall.BeginEstablish(_calledParty, null, EndCallEstablish, _audioVideoCall);

            //Sync; wait for the call to complete.
            _autoResetEvent.WaitOne();

            // Shutdown the platform
            _collabPlatform.BeginShutdown(EndPlatformShutdown, _collabPlatform);

            //Wait for shutdown to occur.
            _autoResetShutdownEvent.WaitOne();
        }
Пример #12
0
        private void Run()
        {
            // Initialize and startup the platform.
            Exception ex = null;

            try
            {
                // Create the UserEndpoint

                _helper       = new UCMASampleHelper();
                _userEndpoint = _helper.CreateEstablishedUserEndpoint(
                    "IMCall Sample User" /*endpointFriendlyName*/);

                Console.Write("The User Endpoint owned by URI: ");
                Console.Write(_userEndpoint.OwnerUri);
                Console.WriteLine(" is now established and registered.");

                // Setup the conversation and place the call.
                ConversationSettings convSettings = new ConversationSettings();
                convSettings.Priority = _conversationPriority;
                convSettings.Subject  = _conversationSubject;

                // Conversation represents a collection of modes of communication
                // (media types)in the context of a dialog with one or multiple
                // callees.
                Conversation conversation = new Conversation(_userEndpoint, convSettings);
                _instantMessagingCall = new InstantMessagingCall(conversation);

                // Call: StateChanged: Only hooked up for logging. Generally,
                // this can be used to surface changes in Call state to the UI
                _instantMessagingCall.StateChanged += this.InstantMessagingCall_StateChanged;

                // Subscribe for the flow created event; the flow will be used to
                // send the media (here, IM).
                // Ultimately, as a part of the callback, the messages will be
                // sent/received.
                _instantMessagingCall.InstantMessagingFlowConfigurationRequested +=
                    this.InstantMessagingCall_FlowConfigurationRequested;

                // Get the sip address of the far end user to communicate with.
                String _calledParty = "sip:" +
                                      UCMASampleHelper.PromptUser(
                    "Enter the URI of the user logged onto Microsoft Lync, in the User@Host format => ",
                    "RemoteUserURI");

                // Place the call to the remote party, without specifying any
                // custom options. Please note that the conversation subject
                // overrides the toast message, so if you want to see the toast
                // message, please set the conversation subject to null.
                _instantMessagingCall.BeginEstablish(_calledParty, new ToastMessage("Hello Toast"), null,
                                                     CallEstablishCompleted, _instantMessagingCall);
            }
            catch (InvalidOperationException iOpEx)
            {
                // Invalid Operation Exception may be thrown if the data provided
                // to the BeginXXX methods was invalid/malformed.
                // TODO (Left to the reader): Write actual handling code here.
                ex = iOpEx;
            }
            finally
            {
                if (ex != null)
                {
                    // If the action threw an exception, terminate the sample,
                    // and print the exception to the console.
                    // TODO (Left to the reader): Write actual handling code here.
                    Console.WriteLine(ex.ToString());
                    Console.WriteLine("Shutting down platform due to error");
                    _helper.ShutdownPlatform();
                }
            }

            // Wait for sample to complete
            _sampleCompletedEvent.WaitOne();
        }
Пример #13
0
        public Location(int id, string name, string fileName, LocalEndpoint endpoint)
        {
            if (!File.Exists(fileName))
            {
                throw new FileNotFoundException(fileName);
            }

            _id       = id;
            _Name     = name;
            _FileName = fileName;
            _Endpoint = endpoint;

            ConferenceScheduleInformation csi = new ConferenceScheduleInformation()
            {
                AccessLevel = ConferenceAccessLevel.Everyone,
                Description = _Name,
                ExpiryTime  = DateTime.Now.AddYears(5),
                AutomaticLeaderAssignment = AutomaticLeaderAssignment.Everyone
            };

            csi.Mcus.Add(new ConferenceMcuInformation(McuType.AudioVideo));

            _Endpoint.ConferenceServices.BeginScheduleConference(csi,
                                                                 ar =>
            {
                try
                {
                    _conference = _Endpoint.ConferenceServices.EndScheduleConference(ar);

                    Log("Conference " + _conference.ConferenceId + " scheduled. Starting music...");

                    Log(_conference.ConferenceUri);

                    ConversationSettings cs = new ConversationSettings()
                    {
                        Subject = _Name
                    };

                    _conversation = new Conversation(_Endpoint, cs);

                    ConferenceJoinOptions cjo = new ConferenceJoinOptions()
                    {
                        JoinMode = JoinMode.TrustedParticipant
                    };

                    _conversation.ConferenceSession.BeginJoin(_conference.ConferenceUri,
                                                              cjo,
                                                              ar1 =>
                    {
                        try
                        {
                            _conversation.ConferenceSession.EndJoin(ar1);

                            _avCall = new AudioVideoCall(_conversation);
                            _avCall.AudioVideoFlowConfigurationRequested +=
                                new EventHandler <AudioVideoFlowConfigurationRequestedEventArgs>(_avCall_AudioVideoFlowConfigurationRequested);

                            AudioVideoCallEstablishOptions options = new AudioVideoCallEstablishOptions()
                            {
                                UseGeneratedIdentityForTrustedConference = true,
                                SupportsReplaces = CapabilitySupport.Supported
                            };

                            _avCall.BeginEstablish(
                                options,
                                ar2 =>
                            {
                                try
                                {
                                    _avCall.EndEstablish(ar2);
                                }
                                catch (Exception ex)
                                {
                                    Log(ex.ToString());
                                }
                            },
                                null);
                        }
                        catch (Exception ex)
                        {
                            Log(ex.ToString());
                        }
                    },
                                                              null);
                }
                catch (Exception ex)
                {
                    Log(ex.ToString());
                }
            },
                                                                 null);
        }
Пример #14
0
        private void PerformSupervisedTransfer()
        {
            ConversationSettings settings = new ConversationSettings()
            {
                Subject = "Supervised transfer"
            };

            Conversation newConversation = new Conversation(_appEndpoint, settings);

            AudioVideoCall newCall = new AudioVideoCall(newConversation);

            try
            {
                newCall.BeginEstablish(_destinationSipUri, null,
                    ar =>
                    {
                        try
                        {
                            newCall.EndEstablish(ar);

                            ReplaceNewCallWithIncomingCall(newCall);
                        }
                        catch (RealTimeException rtex)
                        {
                            _logger.Log("Failed establishing second call.", rtex);
                        }
                    },
                    null
                );
            }
            catch (InvalidOperationException ioex)
            {
                _logger.Log("Failed establishing second call.", ioex);
            }
        }