private void CallEstablishCompleted(IAsyncResult ar) { Call call = ar.AsyncState as Call; RealTimeException ex = null; try { call.EndEstablish(ar); Console.WriteLine("The call with Local Participant: " + call.Conversation.LocalParticipant + " and Remote Participant: " + call.RemoteEndpoint.Participant + " is now in the established state."); } catch (OperationFailureException opFailEx) { // OperationFailureException: Indicates failure to connect the // call to the remote party. // TODO (Left to the reader): Add error handling code here. ex = opFailEx; } catch (RealTimeException exception) { // RealTimeException may be thrown on media or link-layer failures. // TODO (Left to the reader): Add error handling code here. ex = exception; } finally { if (ex != null) { Console.WriteLine(ex.ToString()); Console.WriteLine("Terminating the application due to failure"); _sampleCompleted.Set(); } } }
private void TransferringCallEstablishCompleted(IAsyncResult ar) { AudioVideoCall call = ar.AsyncState as AudioVideoCall; RealTimeException ex = null; try { call.EndEstablish(ar); Console.WriteLine(""); Console.WriteLine("Now beginning the transfer..."); Console.WriteLine(""); // Now that both calls are connected and have been accepted by // the called participant, we can use the transferor endpoint to // transfer the call from the initial to the final. Note that the // transferor endpoint retains it's position of control over both // calls. This form of transfer is most suitable for a proxy // application, where the proxying agent needs to remain in the // signaling channel (For instance, for quality assurance purposes.) call.BeginTransfer(_avCallTransferringtoInitial, TransferCallCompleted, call); Console.WriteLine("The call with Local Participant: " + call.Conversation.LocalParticipant + " and Remote Participant: " + call.RemoteEndpoint.Participant + " is now in the established state."); } catch (OperationFailureException opFailEx) { // OperationFailureException: Indicates failure to connect the // call to the remote party. // TODO (Left to the reader): Add error handling code here. ex = opFailEx; } catch (RealTimeException exception) { // RealTimeException may be thrown on media or link-layer failures. // TODO (Left to the reader): Add error handling code here. ex = exception; } finally { if (ex != null) { Console.WriteLine(ex.ToString()); Console.WriteLine("Terminating the application due to failure"); _sampleCompleted.Set(); } } }
private void CallEstablishCompleted(IAsyncResult ar) { Call call = ar.AsyncState as Call; RealTimeException ex = null; try { call.EndEstablish(ar); Console.WriteLine("The call with Local Participant: " + call.Conversation.LocalParticipant + " and Remote Participant: " + call.RemoteEndpoint.Participant + " is now in the established state."); // Setup the call object for the second call (AV), reusing the // original conversation, and place the call (synchronously). // Reuse of the conversation allows for effortless modality // management. Either endpoint could add the new modality and // place the call below. AudioVideoCall audioVideoCall = new AudioVideoCall(_conversation); audioVideoCall.BeginEstablish(AVCallEstablishCompleted, audioVideoCall); } catch (OperationFailureException opFailEx) { // OperationFailureException: Indicates failure to connect the // call to the remote party. // TODO (Left to the reader): Add error handling code here ex = opFailEx; } catch (RealTimeException exception) { // RealTimeException may be thrown on media or link-layer failures. // TODO (Left to the reader): Add error handling code here ex = exception; } finally { if (ex != null) { Console.WriteLine("Completing application with error"); Console.WriteLine(ex.ToString()); _sampleCompleted.Set(); } } }