Esempio n. 1
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 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();
            }
        }