Esempio n. 1
0
 private void Sender_CallEvent(object src, CallEventArgs args)
 {
     if (args.Type == CallEventType.ConfigurationComplete)
     {
         Debug.Log("sender: configuration done. Listening on address " + BenchmarkConfig.Address);
         sender.Call(BenchmarkConfig.Address);
     }
     else if (args.Type == CallEventType.ConfigurationFailed)
     {
         Debug.LogError("sender: failed to access the audio device");
     }
     else if (args.Type == CallEventType.ConnectionFailed)
     {
         mIsActive = false;
         Debug.LogError("sender: failed to connect");
     }
     else if (args.Type == CallEventType.CallAccepted)
     {
         Debug.Log("sender CallAccepted");
         CallAcceptedEventArgs ev = args as CallAcceptedEventArgs;
         mToEcho    = ev.ConnectionId;
         mIsActive  = true;
         mStartTime = DateTime.Now;
     }
     else if (args.Type == CallEventType.CallEnded)
     {
         Debug.Log("sender: received CallEnded event");
         mIsActive = false;
     }
     else if (args.Type == CallEventType.DataMessage)
     {
         var margs = args as DataMessageEventArgs;
         OnMessageReceived(margs.Content);
     }
 }
Esempio n. 2
0
 private void Echo_CallEvent(object src, CallEventArgs args)
 {
     if (args.Type == CallEventType.ConfigurationComplete)
     {
         string address = BenchmarkConfig.Address;
         Debug.Log("echo configuration done. Listening on address " + address);
         echo.Listen(address);
     }
     else if (args.Type == CallEventType.WaitForIncomingCall)
     {
         Debug.Log("echo is ready to accept incoming calls");
         mActive = true;
     }
     else if (args.Type == CallEventType.ListeningFailed)
     {
         mActive = false;
         Debug.LogError("echo failed to listen to the address");
         Restart();
     }
     else if (args.Type == CallEventType.CallAccepted)
     {
         Debug.Log("echo CallAccepted");
         CallAcceptedEventArgs ev = args as CallAcceptedEventArgs;
         mToSender  = ev.ConnectionId;
         mConnected = true;
     }
     else if (args.Type == CallEventType.DataMessage)
     {
         var    margs = args as DataMessageEventArgs;
         byte[] data  = margs.Content;
         OnMessageReceived(data);
     }
     else if (args.Type == CallEventType.CallEnded)
     {
         mActive    = false;
         mConnected = false;
         Restart();
     }
 }
 /// <summary>
 /// Event triggers for a new incoming call
 /// (in conference mode there is no difference between incoming / outgoing)
 /// </summary>
 /// <param name="args"></param>
 private void OnNewCall(CallAcceptedEventArgs args)
 {
     SetupVideoUi(args.ConnectionId);
 }