Exemple #1
0
 private QLCallManager()
 {
     deviceManager = QLDeviceManager.GetInstance();
     qlConfig      = QLConfigManager.GetInstance();
     callView      = QLCallView.GetInstance();
     _callList     = new ObservableCollection <QLCall>();
 }
Exemple #2
0
 public static QLDeviceManager GetInstance()
 {
     if (null == _instance)
     {
         lock (lockObj)
         {
             if (_instance == null)
             {
                 _instance = new QLDeviceManager();
             }
         }
     }
     return(_instance);
 }
Exemple #3
0
        private void SetToolsStatus()
        {
            if (null == call)
            { //当前呼叫为空时,按钮不可用
                btnMic.Enabled = false;
                btnMic.Image   = Properties.Resources.mic_mute;

                btnVideo.Enabled = false;
                btnVideo.Image   = Properties.Resources.camera_mute;

                this.Close();
            }
            else
            {
                switch (call.CallState)
                {
                case CallState.SIP_UNKNOWN:
                case CallState.SIP_OUTGOING_FAILURE:
                case CallState.SIP_CALL_CLOSED:
                case CallState.SIP_INCOMING_INVITE:
                case CallState.SIP_OUTGOING_TRYING:
                case CallState.SIP_OUTGOING_RINGING:
                {         //非活动状态,不可用
                    btnMic.Enabled  = false;
                    btnMic.Image    = Properties.Resources.mic_mute;
                    this.btnMic.Tag = "麦克风不可用";

                    btnVideo.Enabled  = false;
                    btnVideo.Image    = Properties.Resources.camera_mute;
                    this.btnVideo.Tag = "摄像头不可用";
                }
                break;

                case CallState.SIP_CALL_HOLD:
                case CallState.SIP_CALL_HELD:
                case CallState.SIP_CALL_DOUBLE_HOLD:
                case CallState.SIP_INCOMING_CONNECTED:
                case CallState.SIP_OUTGOING_CONNECTED:
                {         //活动呼叫
                    var deviceManager = QLDeviceManager.GetInstance();
                    #region AudioInputDevice
                    if (null != deviceManager.CurrentAudioInputDevice)
                    {
                        this.btnMic.Enabled = true;
                        this.btnMic.Image   = Properties.Resources.mic;
                        this.btnMic.Image   = call.MuteMic ? Properties.Resources.mic_mute : Properties.Resources.mic;
                        this.btnMic.Tag     = call.MuteMic ? "去打开麦克风" : "去关闭麦克风";
                    }
                    else
                    {
                        this.btnMic.Enabled = false;
                        this.btnMic.Image   = Properties.Resources.mic_mute;
                        this.btnMic.Tag     = "麦克风不可用";
                    }
                    #endregion

                    #region VideoInputDevice
                    if (null != deviceManager.CurrentVideoInputDevice)
                    {
                        switch (call.CallMode)
                        {
                        case CallMode.VIDEO:
                        {
                            this.btnVideo.Enabled = true;
                            this.btnVideo.Image   = call.MuteVideo ? Properties.Resources.camera_mute : Properties.Resources.camera;
                            this.btnMic.Tag       = call.MuteMic ? "去打开摄像头" : "去关闭摄像头";
                        }
                        break;

                        case CallMode.AUDIO:
                        {
                            this.btnVideo.Enabled = false;
                            this.btnVideo.Image   = Properties.Resources.camera_mute;
                            this.btnVideo.Tag     = "摄像头不可用";
                        }
                        break;
                        }
                    }
                    else
                    {
                        this.btnVideo.Enabled = false;
                        this.btnVideo.Image   = Properties.Resources.camera_mute;
                        this.btnVideo.Tag     = "摄像头不可用";
                    }
                    #endregion
                }
                break;
                }
            }
        }