/// <summary>
        /// Handle answer call button click
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Routed Event Argument</param>
        private async void answerCall_Click(object sender, RoutedEventArgs e)
        {
            speaker.Stop();
            speaker.Dispose();
            await RequestBuilder.StartIntercom();

            Frame.Navigate(typeof(Call));
        }
Exemplo n.º 2
0
 public void Dispose()
 {
     Abort();
     if (Speaker != null)
     {
         Speaker.Dispose();
     }
 }
Exemplo n.º 3
0
        static void CloseDevices()
        {
            microphone.Dispose();
            speaker.Dispose();

            mediaReceiver.Detach();
            mediaSender.Detach();
            connector.Dispose();
        }
Exemplo n.º 4
0
        static void CloseDevices()
        {
            Console.WriteLine("CloseDevices()");
            //phoneLine.Dispose(); // nowo dodane

            microphone.Dispose();
            speaker.Dispose();

            mediaReceiver.Detach();
            mediaSender.Detach();
            connector.Dispose();
        }
Exemplo n.º 5
0
 public void Dispose()
 {
     Try(() => _call?.HangUp());
     Try(() => _softphone?.UnregisterPhoneLine(_phoneLine));
     Try(() => _phoneLine.Dispose());
     Try(() => _mediaReceiver.Dispose());
     Try(() => _mediaSender.Dispose());
     Try(() => _connector.Dispose());
     Try(() => _speaker.Dispose());
     Try(() => _microphone.Dispose());
     Try(() => _softphone.Close());
 }
        public void CloseDevices()
        {
            Console.WriteLine("closeDevices");

            phoneLine.Dispose();
            microphone.Dispose();
            speaker.Dispose();
            mediaReceiver.Detach();
            mediaSender.Detach();
            connector.Dispose();

            mp3Player.Stop();
            mp3Player.Dispose();
        }
Exemplo n.º 7
0
        /// <summary>
        /// Changes the speaker device and sets the volume and muted property of the new device.
        /// </summary>
        public void ChangeSpeaker(DeviceInfo deviceInfo)
        {
            if (!initialized)
            {
                return;
            }

            float prevVolume = 0;
            bool  prevMuted  = false;

            if (Speaker != null)
            {
                // same device
                if (Speaker.DeviceInfo.Equals(deviceInfo))
                {
                    return;
                }

                // backup settings
                prevVolume = Speaker.Volume;
                prevMuted  = Speaker.Muted;

                // dispose previous device
                audioConnector.Disconnect(speakerMixer, Speaker);
                UnsubscribeFromSpeakerEvents();
                Speaker.Dispose();

                AudioEnhancer.SetEchoSource(null);
            }

            // create new microphone
            Speaker = Speaker.GetDevice(deviceInfo);

            if (Speaker != null)
            {
                SubscribeToSpeakerEvents();
                audioConnector.Connect(speakerMixer, Speaker);

                // set prev device settings
                Speaker.Volume = prevVolume;
                Speaker.Muted  = prevMuted;
                Speaker.Start();

                AudioEnhancer.SetEchoSource(Speaker);
            }

            OnPropertyChanged("Speaker");
        }
        /// <summary>
        /// Changes the speaker device and sets the volume and muted property of the new device.
        /// </summary>
        public void ChangeSpeaker(AudioDeviceInfo deviceInfo)
        {
            if (!_initialized)
            {
                return;
            }

            float prevVolume = 0;
            bool  prevMuted  = false;

            if (Speaker != null)
            {
                // backup settings
                prevVolume = Speaker.Volume;
                prevMuted  = Speaker.Muted;

                // dispose previous device
                _audioConnector.Disconnect(_phoneCallAudioReceiver, Speaker);
                _audioConnector.Disconnect(_ringtonePlayer, Speaker);
                _audioConnector.Disconnect(_ringbackPlayer, Speaker);
                _audioConnector.Disconnect(_dtmfPlayer, Speaker);
                UnsubscribeFromSpeakerEvents();
                Speaker.Dispose();

                AudioEnhancer.SetEchoSource(null);
            }

            // create new microphone
            Speaker = Speaker.GetDevice(deviceInfo);

            if (Speaker != null)
            {
                SubscribeToSpeakerEvents();
                _audioConnector.Connect(_phoneCallAudioReceiver, Speaker);
                _audioConnector.Connect(_ringtonePlayer, Speaker);
                _audioConnector.Connect(_ringbackPlayer, Speaker);
                _audioConnector.Connect(_dtmfPlayer, Speaker);

                // set prev device settings
                Speaker.Volume = prevVolume;
                Speaker.Muted  = prevMuted;
                Speaker.Start();

                AudioEnhancer.SetEchoSource(Speaker);
            }

            OnPropertyChanged("Speaker");
        }
Exemplo n.º 9
0
        public void Dispose()
        {
            // audio
            if (audioCollection != null)
            {
                audioCollection.Dispose();
            }

            if (audioConnector != null)
            {
                audioConnector.Dispose();
            }

            if (Microphone != null)
            {
                UnsubscribeFromMicrophoneEvents();
                Microphone.Dispose();
            }

            if (Speaker != null)
            {
                UnsubscribeFromSpeakerEvents();
                Speaker.Dispose();
            }

            if (wavRecorder != null)
            {
                wavRecorder.Dispose();
            }

            if (wavPlayer != null)
            {
                wavPlayer.Dispose();
            }

            if (mp3StreamPlayback != null)
            {
                mp3StreamPlayback.Dispose();
            }

            if (ringtonePlayer != null)
            {
                ringtonePlayer.Dispose();
            }

            if (ringbackPlayer != null)
            {
                ringbackPlayer.Dispose();
            }

            // video
            if (videoCollection != null)
            {
                videoCollection.Dispose();
            }

            if (videoConnector != null)
            {
                videoConnector.Dispose();
            }

            if (WebCamera != null)
            {
                WebCamera.Dispose();
            }
        }
Exemplo n.º 10
0
        public void Dispose()
        {
            // audio
            if (_audioConnector != null)
            {
                _audioConnector.Dispose();
            }

            if (Microphone != null)
            {
                UnsubscribeFromMicrophoneEvents();
                Microphone.Dispose();
            }

            if (Speaker != null)
            {
                UnsubscribeFromSpeakerEvents();
                Speaker.Dispose();
            }

            if (_wavRecorder != null)
            {
                _wavRecorder.Dispose();
            }

            if (_wavPlayer != null)
            {
                _wavPlayer.Dispose();
            }

            if (_mp3StreamPlayback != null)
            {
                _mp3StreamPlayback.Dispose();
            }

            if (_ringtonePlayer != null)
            {
                _ringtonePlayer.Dispose();
            }

            if (_ringbackPlayer != null)
            {
                _ringbackPlayer.Dispose();
            }

            if (AudioEnhancer != null)
            {
                AudioEnhancer.Dispose();
            }

            if (_dtmfPlayer != null)
            {
                _dtmfPlayer.Dispose();
            }

            //if (outgoingDataMixer != null)
            //    outgoingDataMixer.Dispose();

            //if (speakerMixer != null)
            //    speakerMixer.Dispose();

            //if (recordDataMixer != null)
            //    recordDataMixer.Dispose();

            if (_phoneCallAudioSender != null)
            {
                _phoneCallAudioSender.Dispose();
            }

            if (_phoneCallAudioReceiver != null)
            {
                _phoneCallAudioReceiver.Dispose();
            }


            // video
            if (_videoConnector != null)
            {
                _videoConnector.Dispose();
            }

            if (WebCamera != null)
            {
                WebCamera.Dispose();
            }

            if (_phoneCallVideoReceiver != null)
            {
                _phoneCallVideoReceiver.Dispose();
            }

            if (_phoneCallVideoSender != null)
            {
                _phoneCallVideoSender.Dispose();
            }
        }