private void EstablishServiceChannel(AsyncTask task, object state) { task.DoOneStep( delegate() { m_serviceChannelCall = new AudioVideoCall(m_serviceHub.Conversation); var options = new AudioVideoCallEstablishOptions(); // Ee need to use generated user identity for the call as this is hidden participant // of the conference for service purpose. options.UseGeneratedIdentityForTrustedConference = !this.IsPrimaryServiceChannel; if (!this.IsPrimaryServiceChannel) { this.RegisterServiceCallHandlers(); // Service call does not need to be in default mix of the conference. The purpose is to service a specific target user in the conference. options.AudioVideoMcuDialInOptions.RemoveFromDefaultRouting = true; } m_serviceChannelCall.BeginEstablish( options, delegate(IAsyncResult ar) { task.DoFinalStep( delegate() { m_serviceChannelCall.EndEstablish(ar); }); }, null); }); }
private void EstablishAvCallAndAudioRouteForNewAttendee(ParticipantEndpoint newAttendeeParticipantEndpoint) { AudioVideoCall newAttendeeCall = new AudioVideoCall(_trustedParticipantConversation); // Save the new Attendee Participant Endpoint in the Application // Context. newAttendeeCall.ApplicationContext = newAttendeeParticipantEndpoint; AudioVideoCallEstablishOptions avCallEstablishOptions = new AudioVideoCallEstablishOptions(); // Remove the call from the default Mcu route because we will be // specifying custom routes after the call is established. avCallEstablishOptions.AudioVideoMcuDialInOptions.RemoveFromDefaultRouting = true; // When the Flow is active, add the tone handler newAttendeeCall.AudioVideoFlowConfigurationRequested += new EventHandler < AudioVideoFlowConfigurationRequestedEventArgs>( NewAttendeeCall_AudioVideoFlowConfigurationRequested); newAttendeeCall.BeginEstablish(avCallEstablishOptions, NewAttendeeCallEstablishCompleted, newAttendeeCall); // Add the call to the collection so it can be retrieved later. _trustedParticipantCalls.Add(newAttendeeParticipantEndpoint.Uri, newAttendeeCall); }
void EstablishControlCall() { AudioVideoCallEstablishOptions ceo = new AudioVideoCallEstablishOptions() { UseGeneratedIdentityForTrustedConference = true }; _controlAVCall = new AudioVideoCall(_location.Conversation); _controlAVCall.AudioVideoFlowConfigurationRequested += new EventHandler <AudioVideoFlowConfigurationRequestedEventArgs>(_controlAVCall_AudioVideoFlowConfigurationRequested); _controlAVCall.BeginEstablish(ceo, ar => { try { _controlAVCall.EndEstablish(ar); List <IncomingAudioRoute> routesin = new List <IncomingAudioRoute>(); List <OutgoingAudioRoute> routesout = new List <OutgoingAudioRoute>(); ParticipantEndpoint localEndpoint = GetLocalParticipant().GetEndpoints()[0]; ParticipantEndpoint remoteEndpoint = _controlAVCall.RemoteEndpoint; routesin.Add(new IncomingAudioRoute(localEndpoint)); routesin.Add(new IncomingAudioRoute(remoteEndpoint)); routesout.Add(new OutgoingAudioRoute(localEndpoint)); routesout.Add(new OutgoingAudioRoute(remoteEndpoint)); _controlAVCall.AudioVideoMcuRouting.BeginUpdateAudioRoutes(routesout, routesin, ar2 => { try { _controlAVCall.AudioVideoMcuRouting.EndUpdateAudioRoutes(ar2); } catch (Exception ex) { Log(ex.ToString()); } }, null); } catch (Exception ex) { Log(ex.ToString()); } }, null); }
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); }
void EstablishControlCall() { AudioVideoCallEstablishOptions ceo = new AudioVideoCallEstablishOptions() { UseGeneratedIdentityForTrustedConference = true }; _controlAVCall = new AudioVideoCall(_location.Conversation); _controlAVCall.AudioVideoFlowConfigurationRequested += new EventHandler<AudioVideoFlowConfigurationRequestedEventArgs>(_controlAVCall_AudioVideoFlowConfigurationRequested); _controlAVCall.BeginEstablish(ceo, ar => { try { _controlAVCall.EndEstablish(ar); List<IncomingAudioRoute> routesin = new List<IncomingAudioRoute>(); List<OutgoingAudioRoute> routesout = new List<OutgoingAudioRoute>(); ParticipantEndpoint localEndpoint = GetLocalParticipant().GetEndpoints()[0]; ParticipantEndpoint remoteEndpoint = _controlAVCall.RemoteEndpoint; routesin.Add(new IncomingAudioRoute(localEndpoint)); routesin.Add(new IncomingAudioRoute(remoteEndpoint)); routesout.Add(new OutgoingAudioRoute(localEndpoint)); routesout.Add(new OutgoingAudioRoute(remoteEndpoint)); _controlAVCall.AudioVideoMcuRouting.BeginUpdateAudioRoutes(routesout, routesin, ar2 => { try { _controlAVCall.AudioVideoMcuRouting.EndUpdateAudioRoutes(ar2); } catch (Exception ex) { Log(ex.ToString()); } }, null); } catch (Exception ex) { Log(ex.ToString()); } }, null); }
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); }
private void CreateSupervisorB2BCall(AudioVideoCall incomingCall, Conversation conferenceConversation) { Console.WriteLine("Creating a supervisor B2B call."); // Create a new audio call on the back-end call leg AudioVideoCall callToConference = new AudioVideoCall(conferenceConversation); // Set up the call to be automatically removed from the default audio mix in the A/V MCU. AudioVideoCallEstablishOptions establishOptions = new AudioVideoCallEstablishOptions(); establishOptions.AudioVideoMcuDialInOptions.RemoveFromDefaultRouting = true; // Create a back to back call between the supervisor and the conference BackToBackCallSettings frontEndB2BSettings = new BackToBackCallSettings(incomingCall); BackToBackCallSettings backEndB2BSettings = new BackToBackCallSettings(callToConference); backEndB2BSettings.CallEstablishOptions = establishOptions; BackToBackCall supervisorB2BCall = new BackToBackCall(frontEndB2BSettings, backEndB2BSettings); try { // Establish the B2B call supervisorB2BCall.BeginEstablish( establishAsyncResult => { try { supervisorB2BCall.EndEstablish(establishAsyncResult); CreateManualAudioRoutes(callToConference); } catch (RealTimeException ex) { Console.WriteLine(ex); } }, null); } catch (InvalidOperationException ex) { Console.WriteLine(ex); } }