Exemple #1
0
 private void btnCamera_Click(object sender, EventArgs e)
 {
     if (true == MuteCamera)
     {
         if (ErrorNumberEnum.PLCM_SAMPLE_OK == WrapperProxy.StartCamera())
         {
             MuteCamera = false;
         }
         else
         {
             UXMessageMask.ShowMessage(this, false, "启动摄像头失败!", MessageBoxButtonsType.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         if (ErrorNumberEnum.PLCM_SAMPLE_OK == WrapperProxy.StopCamera())
         {
             MuteCamera = true;
         }
         else
         {
             UXMessageMask.ShowMessage(this, false, "关闭摄像头失败!", MessageBoxButtonsType.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemple #2
0
        private void tbMicVolume_ValueChanged(object sender, EventArgs e)
        {
            if (null == _currentCall)
            {
                return;
            }
            var volume = tbMicVolume.Value;

            try
            {
                MFWCore.SetMicVolume(volume);
                if (0 == volume)
                {
                    MFWCore.MuteMic(true);
                    this.btnMic.Image = Properties.Resources.mic_mute;
                }
                else
                {
                    MFWCore.MuteMic(false);
                    this.btnMic.Image = Properties.Resources.mic;
                }
            }
            catch (Exception ex)
            {
                Action okAction = () =>
                {
                    volume = MFWCore.GetMicVolume();
                    this.tbMicVolume.Value = volume;
                };
                UXMessageMask.ShowMessage(ownerPnl, false, ex.Message, MessageBoxButtonsType.OK, MessageBoxIcon.Error
                                          , okAction);
            }
        }
Exemple #3
0
 private void btnCamera_Click(object sender, EventArgs e)
 {
     if (true == MuteCamera)
     {
         try
         {
             MFWCore.StartCamera();
             MuteCamera = false;
         }
         catch (Exception ex)
         {
             UXMessageMask.ShowMessage(ownerPnl, false, ex.Message, MessageBoxButtonsType.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         try
         {
             MFWCore.StopCamera();
             MuteCamera = true;
         }
         catch (Exception ex)
         {
             UXMessageMask.ShowMessage(ownerPnl, false, ex.Message, MessageBoxButtonsType.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemple #4
0
        private void tbMicVolume_ValueChanged(object sender, EventArgs e)
        {
            var volume = tbMicVolume.Value;

            if (0 == volume)
            {
                if (ErrorNumberEnum.PLCM_SAMPLE_OK == WrapperProxy.MuteMic(_call.CallHandle, true))
                {
                    this.btnMic.Image = Properties.Resources.mic_mute;
                }
            }
            else
            {
                if (ErrorNumberEnum.PLCM_SAMPLE_OK == WrapperProxy.MuteMic(_call.CallHandle, false))
                {
                    this.btnMic.Image = Properties.Resources.mic;
                }
            }
            if (ErrorNumberEnum.PLCM_SAMPLE_OK != WrapperProxy.SetMicVolume(volume))
            {
                Action okAction = () =>
                {
                    volume = WrapperProxy.GetMicVolume();
                    this.tbMicVolume.Value = volume;
                };
                UXMessageMask.ShowMessage(this, false, "设置麦克风音量失败!", MessageBoxButtonsType.OK, MessageBoxIcon.Error
                                          , okAction);
            }
        }
Exemple #5
0
        /// <summary>
        /// 内容共享
        /// </summary>
        private void btnShare_Click(object sender, EventArgs e)
        {
            if (null == _currentCall)
            {
                return;
            }
            var contentSelectWin = new ContentSelectPanel()
            {
                OKAction = (imageFormat, contentType, contentHandle) => {
                    try
                    {
                        if (null == _currentCall)
                        {
                            throw new Exception("当前呼叫不存在");
                        }
                        _currentCall.StartSendContent(imageFormat, contentType, contentHandle);
                        return(true);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(this, ex.Message, "消息框", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return(false);
                    }
                },
                OnCancel = () => { }
            };

            qlManager.GetApps((apps) => {
                contentSelectWin.BindAppData(apps);
            });
            UXMessageMask.ShowForm(ownerContainer, contentSelectWin);
        }
Exemple #6
0
        private void tbMicVolume_ValueChanged(object sender, EventArgs e)
        {
            if (null == _currentCall)
            {
                return;
            }
            var volume = tbMicVolume.Value;

            try
            {
                deviceManager.SetMicVolume(volume);
                if (0 == volume)
                {
                    _currentCall?.MuteLocalMic(true);
                }
                else
                {
                    _currentCall?.MuteLocalMic(false);
                }
            }
            catch (Exception ex)
            {
                Action okAction = () =>
                {
                    volume = deviceManager.GetMicVolume();
                    this.tbMicVolume.Value = volume;
                };
                UXMessageMask.ShowMessage(ownerContainer, false, ex.Message, MessageBoxButtonsType.OK, MessageBoxIcon.Error
                                          , okAction);
            }
        }
Exemple #7
0
        private void menuItemFECC_Click(object sender, EventArgs e)
        {
            var win = new FECCPanel()
            {
                OnCancel = () => { }
            };

            UXMessageMask.ShowForm(ownerContainer, win);
        }
Exemple #8
0
        private void menuItemDeviceManager_Click(object sender, EventArgs e)
        {
            var deviceWin = new DeviceManagerPanel()
            {
                OKAction = () => {
                },
                OnCancel = () => { }
            };

            UXMessageMask.ShowForm(ownerContainer, deviceWin);
        }
Exemple #9
0
 /// <summary>
 /// 摄像头
 /// </summary>
 private void btnCamera_Click(object sender, EventArgs e)
 {
     if (null != _currentCall)
     {
         try
         {
             _currentCall.MuteLocalVideo(!_currentCall.MuteVideo);
         }
         catch (Exception ex)
         {
             UXMessageMask.ShowMessage(ownerContainer, false, ex.Message, MessageBoxButtonsType.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemple #10
0
 /// <summary>
 /// 联系人
 /// </summary>
 private void btnAttender_Click(object sender, EventArgs e)
 {
     try
     {
         var pnl = new HistoryPanel();
         UXMessageMask.ShowForm(ownerContainer, pnl);
         callManager.GetHistoryCalls((calls) => {
             pnl.BindData(calls);
         });
     }
     catch (Exception ex)
     {
         UXMessageMask.ShowMessage(ownerContainer, false, ex.Message, MessageBoxButtonsType.OK, MessageBoxIcon.Error);
     }
 }
Exemple #11
0
 private void btnSignal_Click(object sender, EventArgs e)
 {
     if (null == _currentCall)
     {
         return;
     }
     try
     {
         var signalWin = new SignalPanel();
         UXMessageMask.ShowForm(ownerPnl, signalWin);
     }
     catch (Exception ex)
     {
         UXMessageMask.ShowMessage(ownerPnl, false, ex.Message, MessageBoxButtonsType.OK, MessageBoxIcon.Error);
     }
 }
Exemple #12
0
        private void btnShare_Click(object sender, EventArgs e)
        {
            if (null == _currentCall)
            {
                return;
            }
            var contentSelectWin = new ContentSelectPanel()
            {
                Monitors = deviceManager.GetDevicesByType(DeviceType.MONITOR),
                Apps     = deviceManager.GetDevicesByType(DeviceType.APPLICATIONS),
                OKAction = (type, format, monitor, app) => {
                    try
                    {
                        switch (type)
                        {
                        case "Monitor":
                        {
                            MFWCore.StartShareContent(monitor, app);
                        }
                        break;

                        case "BFCP":
                        {
                            var width  = Screen.PrimaryScreen.Bounds.Width;
                            var height = Screen.PrimaryScreen.Bounds.Height;
                            MFWCore.SetContentBuffer(format, width, height);
                            MFWCore.StartBFCPContent();
                        }
                        break;
                        }
                        return(true);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(this, ex.Message, "消息框", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return(false);
                    }
                },
                OnCancel = () => { }
            };

            UXMessageMask.ShowForm(ownerPnl, contentSelectWin);
        }
Exemple #13
0
 /// <summary>
 /// 查看信号信息
 /// </summary>
 private void btnSignal_Click(object sender, EventArgs e)
 {
     if (null == _currentCall)
     {
         return;
     }
     try
     {
         var signalWin = new SignalPanel();
         UXMessageMask.ShowForm(ownerContainer, signalWin);
         qlManager.GetMediaStatistics((mediaStatistics) => {
             signalWin.BindData(mediaStatistics);
         });
     }
     catch (Exception ex)
     {
         UXMessageMask.ShowMessage(ownerContainer, false, ex.Message, MessageBoxButtonsType.OK, MessageBoxIcon.Error);
     }
 }
Exemple #14
0
        private void btnShare_Click(object sender, EventArgs e)
        {
            var contentSelectWin = new ContentSelectPanel()
            {
                Monitors = deviceManager.GetDevicesByType(DeviceTypeEnum.DEV_MONITOR),
                Apps     = deviceManager.GetDevicesByType(DeviceTypeEnum.APPLICATIONS),
                OKAction = (type, format, monitor, app) => {
                    switch (type)
                    {
                    case "Monitor":
                    {
                        var errno = WrapperProxy.StartShareContent(_call.CallHandle, monitor, app);
                        if (errno != ErrorNumberEnum.PLCM_SAMPLE_OK)
                        {
                            MessageBox.Show(this, "共享内容失败!", "消息框", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(false);
                        }
                    }
                    break;

                    case "BFCP":
                    {
                        var width  = Screen.PrimaryScreen.Bounds.Width;
                        var height = Screen.PrimaryScreen.Bounds.Height;
                        WrapperProxy.SetContentBuffer(format, width, height);
                        var errno = WrapperProxy.StartBFCPContent(_call.CallHandle);
                        if (errno != ErrorNumberEnum.PLCM_SAMPLE_OK)
                        {
                            MessageBox.Show(this, "共享内容失败!", "消息框", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(false);
                        }
                    }
                    break;
                    }
                    return(true);
                },
                OnCancel = () => { }
            };

            UXMessageMask.ShowForm(this, contentSelectWin);
        }
Exemple #15
0
 /// <summary>
 /// 呼叫/挂断
 /// </summary>
 private void btnCall_Click(object sender, EventArgs e)
 {
     if (btnCall.Text == "呼叫")
     {
         var callWin = new CallPanel()
         {
             OKAction = () => {},
             OnCancel = () => { }
         };
         UXMessageMask.ShowForm(ownerContainer, callWin);
     }
     else
     {
         Action hangupAction = () =>
         {
             _currentCall?.HangUpCall();
         };
         UXMessageMask.ShowMessage(ownerContainer, false, "确认要挂断当前通话吗?", MessageBoxButtonsType.OKCancel, MessageBoxIcon.Question
                                   , hangupAction);
     }
 }
Exemple #16
0
        private void CallWindow_FormClosing(object sender, FormClosingEventArgs e)
        {
            bool canDirectClose = false;

            switch (_call.CallState)
            {
            case CallStateEnum.SIP_UNKNOWN:
            case CallStateEnum.SIP_CALL_CLOSED:
            case CallStateEnum.NULL_CALL:
                canDirectClose = true;
                break;

            case CallStateEnum.SIP_INCOMING_INVITE:
            case CallStateEnum.SIP_INCOMING_CONNECTED:
            case CallStateEnum.SIP_CALL_HOLD:
            case CallStateEnum.SIP_CALL_HELD:
            case CallStateEnum.SIP_CALL_DOUBLE_HOLD:
            case CallStateEnum.SIP_OUTGOING_TRYING:
            case CallStateEnum.SIP_OUTGOING_RINGING:
            case CallStateEnum.SIP_OUTGOING_CONNECTED:
                canDirectClose = false;
                break;
            }
            if (!canDirectClose)
            {
                Action okAction = () => {
                    LAL.Hangup(_call);
                    e.Cancel = false;
                };
                Action cancelAction = () =>
                {
                    e.Cancel = true;
                };
                UXMessageMask.ShowMessage(this, true, "当前通话连通中.\r\n确认要关闭退出吗?", MessageBoxButtonsType.OKCancel, MessageBoxIcon.Question
                                          , okAction, cancelAction);
            }
        }
Exemple #17
0
 private void button1_Click(object sender, EventArgs e)
 {
     UXMessageMask.ShowMessage(this, false, "fdasfds", MessageBoxButtonsType.AnswerHangup, MessageBoxIcon.Error);
 }
Exemple #18
0
        public void handleEvent(Call call)
        {
            switch (call.CallEventState)
            {
            case CallEventStateEnum.UNKNOWN: { } break;

            case CallEventStateEnum.INCOMING_INVITE:                        /* UAS received an incoming call. */
            {
                deviceManager.StopSound();
                deviceManager.PlaySound(DeviceManager.IncomingSound, true, 2000);

                var    msg          = string.Format("【{0}】呼入中,是否接听?", this._call.RemoteDisplayName);
                Action answerAction = () => {
                    LAL.Hold(true);
                    LAL.Hangup(true);
                    deviceManager.StopSound();
                    LAL.Answer(this._call, CallModeEnum.PLCM_MFW_AUDIOVIDEO_CALL, true);
                };
                Action hangupAction = () =>
                {
                    LAL.Hangup(this._call);
                };
                UXMessageMask.ShowMessage(this, false, msg, MessageBoxButtonsType.AnswerHangup, MessageBoxIcon.Question
                                          , answerAction, hangupAction);
            }
            break;

            case CallEventStateEnum.INCOMING_CLOSED:                        /* UAS received the call terminated. */
            {
                deviceManager.StopSound();
                deviceManager.PlaySound(DeviceManager.ClosedSound, false, 0);
                Action okAction = () =>
                {
                    this.Close();
                };
                UXMessageMask.ShowMessage(this, false, "呼叫已经关闭!", MessageBoxButtonsType.OK, MessageBoxIcon.Information
                                          , okAction);
            }
            break;

            case CallEventStateEnum.INCOMING_CONNECTED:                     /* UAS received the call connected. */
            {
                deviceManager.StopSound();
                ViewRender();
                UXMessageMask.HideMessage(this);
            }
            break;

            case CallEventStateEnum.INCOMING_HOLD: break;                   /* The call is holding by local site. */

            case CallEventStateEnum.INCOMING_HELD: break;                   /* The call is holding by far site. */

            case CallEventStateEnum.INCOMING_DOUBLE_HOLD: break;            /* The call is holding by both far site and local site. */

            case CallEventStateEnum.INCOMING_CALL_FARSITE_MIC_MUTE:         /* Far site has muted micphone. */
            {
            }
            break;

            case CallEventStateEnum.INCOMING_CALL_FARSITE_MIC_UNMUTE:       /* Far site has unmuted micphone. */
            {
            }
            break;

            case CallEventStateEnum.INCOMING_CONTENT:
            {
            }
            break;

            case CallEventStateEnum.CONTENT_SENDING:
            {
                log.Info("CONTENT_SENDING");
            } break;

            case CallEventStateEnum.CONTENT_CLOSED:
            {
                var contentChannel = _call.Channels.FirstOrDefault(c => c.ChannelType == ChannelType.Content);
                if (null != contentChannel)
                {
                    this._call.RemoveChannel(contentChannel.ChannelID);
                }
                // LAL.detachStreamFromWindow(MediaType.PLCM_MF_STREAM_CONTENT, 0, LAL.getActiveCall().getCallHandle()); /*detach content window*/
            }
            break;

            case CallEventStateEnum.CONTENT_UNSUPPORTED: break;

            case CallEventStateEnum.CONTENT_IDLE: break;

            case CallEventStateEnum.OUTGOING_RINGING:                   /* UAC received far site is ringing.*/
            {
                deviceManager.StopSound();
                deviceManager.PlaySound(DeviceManager.RingingSound, true, 2000);

                Action hangupAction = () =>
                {
                    this.Close();
                };
                UXMessageMask.ShowMessage(this, false, "当前正呼叫中...", MessageBoxButtonsType.Hangup, MessageBoxIcon.Information
                                          , hangupAction);
            }
            break;

            case CallEventStateEnum.OUTGOING_FAILURE:                   /* from CC */
            {
                deviceManager.StopSound();

                Action okAction = () =>
                {
                    this.Close();
                };
                UXMessageMask.ShowMessage(this, false, "呼叫失敗!", MessageBoxButtonsType.OK, MessageBoxIcon.Error
                                          , okAction);
            }
            break;

            case CallEventStateEnum.OUTGOING_CONNECTED:                 /* from CC */
            {
                deviceManager.StopSound();
                ViewRender();
                UXMessageMask.HideMessage(this);
            }
            break;

            case CallEventStateEnum.LOCAL_RESOLUTION_CHANGED: break;

            case CallEventStateEnum.REMOTE_RESOLUTION_CHANGED: break;

            case CallEventStateEnum.SIP_REGISTER_SUCCESS: break;               /* Register to sip server succeed. */

            case CallEventStateEnum.SIP_REGISTER_FAILURE: break;               /* Register to sip server failed. */

            case CallEventStateEnum.SIP_UNREGISTERED: break;                   /* Unregister to sip server. */

            case CallEventStateEnum.NETWORK_CHANGED: break;                    /* Network changed or lost.*/

            case CallEventStateEnum.CALL_AUDIO_ONLY_TRUE:  break;              /* The call is audio only.*/

            case CallEventStateEnum.CALL_AUDIO_ONLY_FALSE: break;              /* The call is not audio only.*/

            case CallEventStateEnum.MFW_INTERNAL_TIME_OUT: break;

            //SVC
            case CallEventStateEnum.REFRESH_ACTIVE_SPEAKER: {
                //  ViewRender(); //重新布局
            } break;

            case CallEventStateEnum.REFRESH_LAYOUT: {
                this._call.ClearRemoteChannels();
            } break;

            case CallEventStateEnum.CHANNEL_STATUS_UPDATE: break;

            case CallEventStateEnum.DISPLAYNAME_UPDATE: break;

            case CallEventStateEnum.CALL_MODE_UPGRADE_REQ: break;

            case CallEventStateEnum.DEVICE_VIDEOINPUT: break;

            case CallEventStateEnum.CERTIFICATE_VERIFY: break;

            case CallEventStateEnum.TRANSCODER_FINISH: break;

            case CallEventStateEnum.ICE_STATUS_CHANGED: break;

            case CallEventStateEnum.AUTODISCOVERY_SUCCESS: break;

            case CallEventStateEnum.AUTODISCOVERY_FAILURE: break;

            case CallEventStateEnum.AUTODISCOVERY_ERROR:
                break;

            case CallEventStateEnum.SIP_CALL_TRYING:
            {
                deviceManager.StopSound();
                deviceManager.PlaySound(DeviceManager.RingingSound, true, 2000);

                Action hangupAction = () => { LAL.Hangup(this._call); };
                UXMessageMask.ShowMessage(this, false, "呼叫中...", MessageBoxButtonsType.Hangup, MessageBoxIcon.Information
                                          , hangupAction);
            }
            break;
            }
        }