Beispiel #1
0
        /// <summary>
        /// Initializes the video handlers (camera, image providers etc.).
        /// </summary>
        private void InitVideo()
        {
            // ----- CREATE -----
            WebCamera = WebCamera.GetDefaultDevice();

            LocalImageProvider  = new BitmapSourceProvider();
            RemoteImageProvider = new BitmapSourceProvider();

            phoneCallVideoReceiver = new PhoneCallVideoReceiver();
            phoneCallVideoSender   = new PhoneCallVideoSender();

            // ----- CONNECT -----
            videoConnector.Connect(phoneCallVideoReceiver, RemoteImageProvider);
            if (WebCamera != null)
            {
                videoConnector.Connect(WebCamera, LocalImageProvider);
                videoConnector.Connect(WebCamera, phoneCallVideoSender);
            }

            // add to collection
            Dictionary <string, VoIPMediaHandler> collection = new Dictionary <string, VoIPMediaHandler>();

            collection.Add("LocalImageProvider", LocalImageProvider);
            collection.Add("RemoteImageProvider", RemoteImageProvider);
            collection.Add("PhoneCallVideoReceiver", phoneCallVideoReceiver);
            collection.Add("PhoneCallVideoSender", phoneCallVideoSender);
            videoCollection = new MediaHandlerCollection(videoConnector, collection);
        }
Beispiel #2
0
        public MediaHandlerCollection CreateSoftPhoneVideoCallListener()
        {
            var phonecallVideoReceiver = new PhoneCallVideoReceiver();
            var phonecallVideoSender   = new PhoneCallVideoSender();
            ImageProvider <Image> remoteImageHandler = new DrawingImageProvider();
            ImageProvider <Image> localImageHandler  = new DrawingImageProvider();
            var webCamera = WebCamera.GetDefaultDevice();


            if (webCamera != null)
            {
                mediaConnector.Connect(webCamera, phonecallVideoSender);
                mediaConnector.Connect(webCamera, localImageHandler);
            }
            mediaConnector.Connect(phonecallVideoReceiver, remoteImageHandler);

            var mediaHandlers = new Dictionary <string, VoIPMediaHandler>
            {
                { "RemoteImageHandler", remoteImageHandler },
                { "LocalImageHandler", localImageHandler },
                { "VideoSender", phonecallVideoSender },
                { "VideoReceiver", phonecallVideoReceiver }
            };

            if (webCamera != null)
            {
                mediaHandlers.Add("WebCamera", webCamera);
            }


            return(new MediaHandlerCollection(mediaConnector, mediaHandlers));
        }
Beispiel #3
0
        public SoftphoneEngine()
        {
            AlarmList  = new ObservableCollection <string>();
            alarmCalls = new List <OutGoingCallEngine>();

            _connector   = new MediaConnector();
            _videoSender = new PhoneCallVideoSender();
            _audioSender = new PhoneCallAudioSender();

            Softphone = SoftPhoneFactory.CreateSoftPhone(5000, 10000);
            Softphone.IncomingCall += softphone_IncomingCall;
        }
		public SoftphoneEngine()
		{
            AlarmList = new ObservableCollection<string>();
            alarmCalls = new List<OutGoingCallEngine>();

            _connector = new MediaConnector();
            _videoSender = new PhoneCallVideoSender();
            _audioSender = new PhoneCallAudioSender();

			Softphone = SoftPhoneFactory.CreateSoftPhone(5000, 10000);
			Softphone.IncomingCall += softphone_IncomingCall;
		}
        public OutGoingCallEngine(string dialedNumber, ISoftPhone softPhone, IPhoneLine phoneLine)
        {
            _connector = new MediaConnector();
            _videoSender = new PhoneCallVideoSender();
            _audioSender = new PhoneCallAudioSender();

            var dial = new DialParameters(dialedNumber) { CallType = CallType.AudioVideo };
            Call = softPhone.CreateCallObject(phoneLine, dial);
            Call.CallStateChanged += _call_CallStateChanged;        

            _videoSender.AttachToCall(Call);
            _audioSender.AttachToCall(Call);
        }
        public OutGoingCallEngine(string dialedNumber, ISoftPhone softPhone, IPhoneLine phoneLine)
        {
            _connector   = new MediaConnector();
            _videoSender = new PhoneCallVideoSender();
            _audioSender = new PhoneCallAudioSender();

            var dial = new DialParameters(dialedNumber)
            {
                CallType = CallType.AudioVideo
            };

            Call = softPhone.CreateCallObject(phoneLine, dial);
            Call.CallStateChanged += _call_CallStateChanged;

            _videoSender.AttachToCall(Call);
            _audioSender.AttachToCall(Call);
        }
        /// <summary>
        /// Initializes the video handlers (camera, image providers etc.).
        /// </summary>
        private void InitVideo()
        {
            // ----- CREATE -----
            WebCamera = WebCameraFactory.GetDefaultDevice();

            LocalImageProvider  = new DrawingImageProvider();
            RemoteImageProvider = new DrawingImageProvider();

            _phoneCallVideoReceiver = new PhoneCallVideoReceiver();
            _phoneCallVideoSender   = new PhoneCallVideoSender();

            // ----- CONNECT -----
            _videoConnector.Connect(_phoneCallVideoReceiver, RemoteImageProvider);
            if (WebCamera != null)
            {
                _videoConnector.Connect(WebCamera.VideoChannel, LocalImageProvider);
                _videoConnector.Connect(WebCamera.VideoChannel, _phoneCallVideoSender);
            }
        }
        /// <summary>
        /// Initializes the video handlers (camera, image providers etc.).
        /// </summary>
        private void InitVideo()
        {
            // ----- CREATE -----
            WebCamera = WebCamera.GetDefaultDevice();

            LocalImageProvider = new BitmapSourceProvider();
            RemoteImageProvider = new BitmapSourceProvider();

            phoneCallVideoReceiver = new PhoneCallVideoReceiver();
            phoneCallVideoSender = new PhoneCallVideoSender();

            // ----- CONNECT -----
            videoConnector.Connect(phoneCallVideoReceiver, RemoteImageProvider);
            if (WebCamera != null)
            {
                videoConnector.Connect(WebCamera, LocalImageProvider);
                videoConnector.Connect(WebCamera, phoneCallVideoSender);
            }

            // add to collection
            Dictionary<string, VoIPMediaHandler> collection = new Dictionary<string, VoIPMediaHandler>();
            collection.Add("LocalImageProvider", LocalImageProvider);
            collection.Add("RemoteImageProvider", RemoteImageProvider);
            collection.Add("PhoneCallVideoReceiver", phoneCallVideoReceiver);
            collection.Add("PhoneCallVideoSender", phoneCallVideoSender);
            videoCollection = new MediaHandlerCollection(videoConnector, collection);
        }
        public MediaHandlerCollection CreateSoftPhoneVideoCallListener()
        {
            var phonecallVideoReceiver = new PhoneCallVideoReceiver();
             var phonecallVideoSender = new PhoneCallVideoSender();
             ImageProvider<Image> remoteImageHandler = new DrawingImageProvider();
             ImageProvider<Image> localImageHandler = new DrawingImageProvider();
             var webCamera = WebCamera.GetDefaultDevice();

             if (webCamera != null)
             {
                 mediaConnector.Connect(webCamera, phonecallVideoSender);
                 mediaConnector.Connect(webCamera, localImageHandler);
             }
             mediaConnector.Connect(phonecallVideoReceiver, remoteImageHandler);

             var mediaHandlers = new Dictionary<string, VoIPMediaHandler>
                                     {
                                         {"RemoteImageHandler", remoteImageHandler},
                                         {"LocalImageHandler", localImageHandler},
                                         {"VideoSender", phonecallVideoSender},
                                         {"VideoReceiver", phonecallVideoReceiver}

                                     };
             if (webCamera != null)
             {
                 mediaHandlers.Add("WebCamera", webCamera);
             }

             return new MediaHandlerCollection(mediaConnector, mediaHandlers);
        }
        /// <summary>
        /// Creates the incoming and outgoing media handlers such as microphone or speaker
        /// </summary>
        private void CreateMediaHandlers()
        {
            MediaHandlerFactory factory = new MediaHandlerFactory();
            activeAudioCallListener = factory.CreateSoftPhoneCallListener();
            activeVideoCallListener = factory.CreateSoftPhoneVideoCallListener();

            phoneCallAudioReceiver = activeAudioCallListener.GetComponent("AudiReceiver") as PhoneCallAudioReceiver;
            phoneCallAudioSender = activeAudioCallListener.GetComponent("AudioSender") as PhoneCallAudioSender;

            phonecallVideoSender = activeVideoCallListener.GetComponent("VideoSender") as PhoneCallVideoSender;
            phonecallVideoReceiver = activeVideoCallListener.GetComponent("VideoReceiver") as PhoneCallVideoReceiver;

            mediaConnector = activeAudioCallListener.MediaConnector;

            microphone = activeAudioCallListener.GetComponent("Microphone") as Microphone;
            if (microphone != null)
            {
                microphone.LevelChanged += (Microphone_LevelChanged);
            }

            speaker = activeAudioCallListener.GetComponent("Speaker") as Speaker;
            if (speaker != null)
            {
                speaker.LevelChanged += (Speaker_LevelChanged);
            }

            incomingDataMixer = activeAudioCallListener.GetComponent("SpeakerMixer") as AudioMixerMediaHandler;
            camera = activeVideoCallListener.GetComponent("WebCamera") as WebCamera;

            remoteImageHandler = activeVideoCallListener.GetComponent("RemoteImageHandler") as ImageProvider<Image>;
            localImageHandler = activeVideoCallListener.GetComponent("LocalImageHandler") as ImageProvider<Image>;

            AudioProcessor = activeAudioCallListener.GetComponent("AudioProcessor") as AudioQualityEnhancer;
            outgoingDataMixer = activeAudioCallListener.GetComponent("OutGoingDataMixer") as AudioMixerMediaHandler;
            RecordDataMixer = activeAudioCallListener.GetComponent("RecordDataMixer") as AudioMixerMediaHandler;

            dtmfEventWavePlayer = activeAudioCallListener.GetComponent("DTMF") as DtmfEventWavePlayer;
            ringtoneWavePlayer = activeAudioCallListener.GetComponent("Ringtones") as PhoneCallStateWavePlayer;

            Stream basicRing = Assembly.GetExecutingAssembly().GetManifestResourceStream(
                "OzekiDemoSoftphone.Resources.basic_ring.wav"
                );

            ringtoneWavePlayer.UpdateIncomingStateStream(CallState.Ringing, @"..\..\Resources\basic_ring.wav");
            ringtoneWavePlayer.UpdateOutgoingStateStream(CallState.Ringing, @"..\..\Resources\ringback.wav");
        }