private void InitializeSkype()
        {
            s = new Skype();
            _ISkypeEvents_Event events = s;

            events.AttachmentStatus += OnAttachementStatusChanged;
            events.CallStatus       += OnCallStatusChanged;

            s.Attach();
        }
        public SkypeAudioInterceptor(ISkype skype, _ISkypeEvents_Event skypeEvents, ILog log, IAudioProcessor audioProcessor)
        {
            this.log            = log;
            this.audioProcessor = audioProcessor;

            this.timer     = new Timer();
            timer.Interval = 500; // TimeSpan.FromMilliseconds(500);
            timer.Tick    += TimerOnTick;
            InitSockets();

            this.skype = skype;
            if (!skype.Client.IsRunning)
            {
                log.Error("Skype is not running - check you have installed and started the desktop version of Skype");
            }

            skypeEvents.AttachmentStatus += OnSkypeAttachmentStatus;
            skypeEvents.CallStatus       += OnSkypeCallStatus;
            skypeEvents.Error            += OnSkypeError;
            timer.Start();
        }
Exemple #3
0
        public void InitializeEvents(Action <string> onCallStarted, Action <string> onCallEnded)
        {
            Skype skype = new Skype();
            _ISkypeEvents_Event events = skype;

            events.CallStatus += (call, status) => OnCallStatusChanged(call, status, onCallStarted, onCallEnded);
            // TODO: Handle unsubscription.
            // https://msdn.microsoft.com/en-us/library/ms366768.aspx
            // events.CallStatus -= (call, status) => OnCallStatusChanged(call, status, onCallStarted, onCallEnded);

            try
            {
                if (skype.Client.IsRunning)
                {
                    skype.Attach();
                }
            }
            catch (Exception)
            {
                // Ignore any exceptions thrown (TODO: These can be logged to observe later, if needed)
            }
        }
Exemple #4
0
        public SkypeConnector(ILog log, EffectChain effects)
        {
            this.log = log;
            InitSockets();


            skype = new Skype();
            ISkype iSkype = (ISkype)skype;

            if (!iSkype.Client.IsRunning)
            {
                log.Error("Skype is not running");
            }

            _ISkypeEvents_Event events = (_ISkypeEvents_Event)skype;

            events.AttachmentStatus += OnSkypeAttachmentStatus;
            skype.CallStatus        += OnSkypeCallStatus;
            skype.Error             += OnSkypeError;
            skype.Attach(Protocol, false);

            bufferStream = new SkypeBufferStream(44100);
            OutputStream = new EffectStream(effects, bufferStream);
        }