コード例 #1
0
        public static void MuteSpeaker(bool isMute)
        {
            var errno = WrapperProxy.MuteSpeaker(isMute);

            if (ErrorNumber.OK != errno)
            {
                throw new Exception("扬声器静音设置失败,errno=" + errno);
            }
        }
コード例 #2
0
        public static void StopCamera()
        {
            var errno = WrapperProxy.StopCamera();

            if (ErrorNumber.OK != errno)
            {
                throw new Exception("关闭摄像头失败,errno=" + errno);
            }
        }
コード例 #3
0
        public static void SetSpeakerVolume(int volume)
        {
            var errno = WrapperProxy.SetSpeakerVolume(volume);

            if (ErrorNumber.OK != errno)
            {
                throw new Exception("扬声器音量设置失败,errno=" + errno);
            }
        }
コード例 #4
0
 public static void Register(string sipServer, string username, string password, Panel owner, IDictionary <PropertyKey, string> properties = null, string displayName = null)
 {
     #region Valid
     if (string.IsNullOrWhiteSpace(sipServer))
     {
         throw new Exception("服务地址必须");
     }
     if (string.IsNullOrWhiteSpace(username))
     {
         throw new Exception("用户名必须");
     }
     if (string.IsNullOrWhiteSpace(password))
     {
         throw new Exception("密码必须");
     }
     if (null == owner)
     {
         throw new Exception("显示承载容器必须");
     }
     #endregion
     if (null != properties)
     {
         propertyManager.SetProperties(properties);
     }
     var regid = username + "@" + sipServer;
     if (string.IsNullOrWhiteSpace(displayName))
     {
         displayName = regid;
     }
     var ps = new Dictionary <PropertyKey, string>()
     {
         { PropertyKey.PLCM_MFW_KVLIST_KEY_SIP_ProxyServer, sipServer },
         { PropertyKey.PLCM_MFW_KVLIST_KEY_SIP_UserName, username },
         { PropertyKey.PLCM_MFW_KVLIST_KEY_SIP_Password, password },
         { PropertyKey.PLCM_MFW_KVLIST_KEY_REG_ID, regid },
         { PropertyKey.PLCM_MFW_KVLIST_KEY_DisplayName, displayName }
     };
     propertyManager.SetProperties(ps);
     var errno = WrapperProxy.UpdateConfig();
     if (errno != ErrorNumber.OK)
     {
         var errMsg = string.Format("配置失败, Errno={0}", errno);
         log.Error(errMsg);
         throw new Exception(errMsg);
     }
     callView.BindPanel(owner);
     errno = WrapperProxy.RegisterClient();
     if (errno != ErrorNumber.OK)
     {
         var errMsg = string.Format("Register failed, Errno={0}", errno);
         log.Error(errMsg);
         throw new Exception(errMsg);
     }
 }
コード例 #5
0
        public static void StartEventMonitor()
        {
            autoEvent            = new AutoResetEvent(false);
            isRunning            = true;
            mainThreadSynContext = SynchronizationContext.Current;
            var thread = new Thread(() =>
            {
                while (isRunning)
                {
                    log.Info("handle the evt");
                    if (queue.Count <= 0)
                    {
                        lock (synObject)
                        {
                            log.Info("No evt, wait..");
                            autoEvent.WaitOne();
                        }
                    }
                    while (queue.Count > 0)
                    {
                        Event evt = null;
                        lock (synObject)
                        {
                            evt = queue.Dequeue();
                        }
                        // dispatch Event to proper modules
                        if (evt == null)
                        {
                            log.Error("Event is null!");
                            continue;
                        }
                        try
                        {
                            callView.Invoke(new Action(() =>
                            {
                                DoEvent(evt);
                            }));
                            //mainThreadSynContext.Post(new SendOrPostCallback(DoEvent), evt);
                        }
                        catch (Exception ex)
                        {
                            log.Error(ex.Message);
                        }
                        WrapperProxy.FreeEvent(evt.EventHandle);
                    }
                }
            });

            thread.Start();
        }
コード例 #6
0
 public static void StopShareContent()
 {
     if (null != callManager.CurrentCall)
     {
         var errno = WrapperProxy.StopShareContent(callManager.CurrentCall.CallHandle);
         if (ErrorNumber.OK != errno)
         {
             throw new Exception("结束共享内容失败,errno=" + errno);
         }
     }
     else
     {
         throw new Exception("当前呼叫为空,不能结束共享内容");
     }
 }
コード例 #7
0
 public static void StartShareContent(string deviceHandle, IntPtr appWndHandle)
 {
     if (null != callManager.CurrentCall)
     {
         var errno = WrapperProxy.StartShareContent(callManager.CurrentCall.CallHandle, deviceHandle, appWndHandle);
         if (ErrorNumber.OK != errno)
         {
             throw new Exception("开始共享内容失败,errno=" + errno);
         }
     }
     else
     {
         throw new Exception("当前呼叫为空,不能共享内容");
     }
 }
コード例 #8
0
 public static void MuteMic(bool isMute)
 {
     if (null != callManager.CurrentCall)
     {
         var errno = WrapperProxy.MuteMic(callManager.CurrentCall.CallHandle, isMute);
         if (ErrorNumber.OK != errno)
         {
             throw new Exception("麦克风静音设置失败,errno=" + errno);
         }
     }
     else
     {
         throw new Exception("当前呼叫为空,不能进行麦克风静音设置");
     }
 }
コード例 #9
0
        public static void Dial(string callAddr, CallMode callMode)
        {
            log.Info("place call: callername:" + callAddr);
            int callHandleReference = 0;

            propertyManager.SetProperty(PropertyKey.CalleeAddr, callAddr);
            var errno = WrapperProxy.PlaceCall(callAddr, ref callHandleReference, callMode);

            if (errno != ErrorNumber.OK)
            {
                var errMsg = "Dial a Call failed. ErrorNum = " + errno;
                log.Error(errMsg);
                throw new Exception(errMsg);
            }
        }
コード例 #10
0
 public void Hangup(Call call = null)
 {
     if (null == call)
     {
         call = CurrentCall;
     }
     if (null != call)
     {
         var errno = WrapperProxy.TerminateCall(call.CallHandle);
         if (ErrorNumber.OK != errno)
         {
             log.Error("Hangup Failed,errno=" + errno);
         }
     }
 }
コード例 #11
0
 public static int GetSpeakerVolume()
 {
     return(WrapperProxy.GetSpeakerVolume());
 }
コード例 #12
0
 public static int GetMicVolume()
 {
     return(WrapperProxy.GetMicVolume());
 }
コード例 #13
0
 public static void Unregister()
 {
     WrapperProxy.UnregisterClient();
 }
コード例 #14
0
        static MFWCore()
        {
            StartEventMonitor();
            mediaStatistics.CollectionChanged += (sender, args) =>
            {
                mediaStatisticsCallBack?.Invoke(mediaStatistics);
            };
            var errno = ErrorNumber.OK;

            //注册回调函数
            errno = WrapperProxy.InstallCallback(addEventCallback, dispatchEventsCallback, addLogCallback, addDeviceCallback,
                                                 displayMediaStatisticsCallback, displayCallStatisticsCallback, displayCodecCapabilities, addAppCallback);
            if (ErrorNumber.OK != errno)
            {
                var errMsg = "Register callback functions failed. Error number = " + errno;
                log.Error(errMsg);
                throw new Exception(errMsg);
            }
            //预初始化
            errno = WrapperProxy.PreInitialize();
            if (ErrorNumber.OK != errno)
            {
                var msg = "Pre-initialization failed. Error number = " + errno.ToString();
                log.Error(msg);
                throw new Exception(msg);
            }
            //参数设定 KVList
            #region Default Properties
            var defaultProperties = new Dictionary <PropertyKey, string>()
            {
                { PropertyKey.PLCM_MFW_KVLIST_KEY_MINSYS, "" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_SIP_ProxyServer, "" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_SIP_Transport, "TCP" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_SIP_ServerType, "standard" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_SIP_Register_Expires_Interval, "300" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_SIP_UserName, "" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_SIP_Domain, "" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_SIP_AuthorizationName, "soaktestuser" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_SIP_Password, "" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_SIP_CookieHead, "" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_SIP_Base_Cred, "" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_SIP_AnonymousToken_Cred, "YWxpY2U6c2FtZXRpbWU=" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_SIP_Anonymous_Cred, "anonymous" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_CallSettings_MaxCallNum, "6" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_CallSettings_NetworkCallRate, "384" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_CallSettings_AesEcription, "off" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_CallSettings_DefaultAudioStartPort, "3230" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_CallSettings_DefaultAudioEndPort, "3550" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_CallSettings_DefaultVideoStartPort, "3230" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_CallSettings_DefaultVideoEndPort, "3550" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_CallSettings_SIPClientListeningPort, "5060" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_CallSettings_SIPClientListeningTLSPort, "5061" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_EnableSVC, "true" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_LogLevel, "DEBUG" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_User_Agent, "MFW_SDK" },
                { PropertyKey.PLCM_MFW_KVLIST_ICE_UserName, "" },
                { PropertyKey.PLCM_MFW_KVLIST_ICE_Password, "" },
                { PropertyKey.PLCM_MFW_KVLIST_ICE_TCPServer, "0.0.0.0:3478" },
                { PropertyKey.PLCM_MFW_KVLIST_ICE_UDPServer, "0.0.0.0:3478" },
                { PropertyKey.PLCM_MFW_KVLIST_ICE_TLSServer, "0.0.0.0:3478" },
                { PropertyKey.PLCM_MFW_KVLIST_ICE_Enable, "false" },
                { PropertyKey.PLCM_MFW_KVLIST_ICE_AUTHTOKEN_Enable, "false" },
                { PropertyKey.PLCM_MFW_KVLIST_ICE_INIT_AUTHTOKEN, "" },
                { PropertyKey.PLCM_MFW_KVLIST_ICE_RTO, "100" },
                { PropertyKey.PLCM_MFW_KVLIST_ICE_RC, "7" },
                { PropertyKey.PLCM_MFW_KVLIST_ICE_RM, "16" },
                { PropertyKey.PLCM_MFW_KVLIST_QOS_ServiceType, "" },
                { PropertyKey.PLCM_MFW_KVLIST_QOS_Audio, "" },
                { PropertyKey.PLCM_MFW_KVLIST_QOS_Video, "" },
                { PropertyKey.PLCM_MFW_KVLIST_QOS_Fecc, "" },
                { PropertyKey.PLCM_MFW_KVLIST_QOS_Enable, "false" },
                { PropertyKey.PLCM_MFW_KVLIST_DBM_Enable, "false" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_REG_ID, "" },
                { PropertyKey.PLCM_MFW_KVLIST_LPR_Enable, "true" },
                { PropertyKey.PLCM_MFW_KVLIST_CERT_PATH, "./TLS Certificate/instance0/" },
                { PropertyKey.PLCM_MFW_KVLIST_CERT_CHECKFQDN, "false" },
                { PropertyKey.PLCM_MFW_KVLIST_HttpConnect_Enable, "false" },
                { PropertyKey.PLCM_MFW_KVLIST_SIP_HttpProxyServer, "" },
                { PropertyKey.PLCM_MFW_KVLIST_SIP_HttpProxyPort, "" },
                { PropertyKey.PLCM_MFW_KVLIST_SIP_HttpProxyUserName, "" },
                { PropertyKey.PLCM_MFW_KVLIST_SIP_HttpPassword, "" },
                { PropertyKey.PLCM_MFW_KVLIST_ICE_HttpProxyServer, "" },
                { PropertyKey.PLCM_MFW_KVLIST_ICE_HttpProxyPort, "" },
                { PropertyKey.PLCM_MFW_KVLIST_ICE_HttpProxyUserName, "" },
                { PropertyKey.PLCM_MFW_KVLIST_ICE_HttpPassword, "" },
                { PropertyKey.PLCM_MFW_KVLIST_MEDIA_HttpProxyServer, "" },
                { PropertyKey.PLCM_MFW_KVLIST_MEDIA_HttpProxyPort, "80" },
                { PropertyKey.PLCM_MFW_KVLIST_MEDIA_HttpProxyUserName, "" },
                { PropertyKey.PLCM_MFW_KVLIST_MEDIA_HttpPassword, "" },
                { PropertyKey.PLCM_MFW_KVLIST_PRODUCT, "PLCM_MFW_IBM" },
                { PropertyKey.PLCM_MFW_KVLIST_AutoZoom_Enable, "false" },
                { PropertyKey.PLCM_MFW_KVLIST_TLSOffLoad_Enable, "false" },
                { PropertyKey.PLCM_MFW_KVLIST_TLSOffLoad_Host, "" },
                { PropertyKey.PLCM_MFW_KVLIST_TLSOffLoad_Port, "0" },
                { PropertyKey.PLCM_MFW_KVLIST_HttpTunnel_Enable, "false" },
                { PropertyKey.PLCM_MFW_KVLIST_SIP_HttpTunnelProxyServer, "" },
                { PropertyKey.PLCM_MFW_KVLIST_SIP_HttpTunnelProxyPort, "443" },
                { PropertyKey.PLCM_MFW_KVLIST_MEDIA_HttpTunnelProxyServer, "" },
                { PropertyKey.PLCM_MFW_KVLIST_MEDIA_HttpTunnelProxyPort, "443" },
                { PropertyKey.PLCM_MFW_KVLIST_RTPMode, "RTP/AVP" },
                { PropertyKey.PLCM_MFW_KVLIST_TCPBFCPForced, "false" },
                { PropertyKey.PLCM_MFW_KVLIST_G729B_Enable, "false" },
                { PropertyKey.PLCM_MFW_KVLIST_SAML_Enable, "false" },
                { PropertyKey.PLCM_MFW_KVLIST_iLBCFrame, "30" },
                { PropertyKey.PLCM_MFW_KVLIST_BFCP_CONTENT_Enable, "true" },
                { PropertyKey.PLCM_MFW_KVLIST_SUPPORT_PORTRAIT_MODE, "" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_DisplayName, "" },
                { PropertyKey.PLCM_MFW_KVLIST_FECC_Enable, "true" },
                { PropertyKey.PLCM_MFW_KVLIST_Comfortable_Noise_Enable, "true" },
                { PropertyKey.PLCM_MFW_KVLIST_SIP_Header_Compact_Enable, "false" },
                { PropertyKey.PLCM_MFW_KVLIST_KEY_MAXSYS, "" },
                { PropertyKey.LocalAddr, "" },
                { PropertyKey.CalleeAddr, "" },
                { PropertyKey.AUDIO_INPUT_DEVICE, "" },
                { PropertyKey.AUDIO_OUTPUT_DEVICE, "" },
                { PropertyKey.AUDIO_OUTPUT_DEVICE_FOR_RINGTONE, "" },
                { PropertyKey.VIDEO_INPUT_DEVICE, "" },
                { PropertyKey.MONITOR_DEVICE, "" },
                { PropertyKey.SOUND_INCOMING, "incoming.wav" },
                { PropertyKey.SOUND_CLOSED, "closed.wav" },
                { PropertyKey.SOUND_RINGING, "ringing.wav" },
                { PropertyKey.SOUND_HOLD, "hold.wav" },
                { PropertyKey.ICE_AUTH_TOKEN, "" },
                { PropertyKey.LayoutType, "Presentation" }
            };
            #endregion

            propertyManager.SetProperties(defaultProperties);
            //初始化
            errno = WrapperProxy.Initialize();
            if (ErrorNumber.OK != errno)
            {
                var errMsg = "Initialize failed. Error number = " + errno;
                log.Error(errMsg);
                throw new Exception(errMsg);
            }
            var version = WrapperProxy.GetVersion();
            log.Info("**********************************************************************");
            log.Info("        PLCM MFW  App Initialized Successful ( version: " + version + " )");
            log.Info("**********************************************************************");

            //Get Devices
            var errNo = WrapperProxy.GetDevice(DeviceType.AUDIOINPUT);
            if (ErrorNumber.OK != errNo)
            {
                var errMsg = "Get audio input device failed. Error number = " + errNo;
                log.Error(errMsg);
                throw new Exception(errMsg);
            }
            errNo = WrapperProxy.GetDevice(DeviceType.VIDEOINPUT);
            if (ErrorNumber.OK != errNo)
            {
                var errMsg = "Get video input device failed. Error number = " + errNo;
                log.Error(errMsg);
                throw new Exception(errMsg);
            }
            errNo = WrapperProxy.GetDevice(DeviceType.AUDIOOUTPUT);
            if (ErrorNumber.OK != errNo)
            {
                var errMsg = "Get audio output device failed. Error number = " + errNo;
                log.Error(errMsg);
                throw new Exception(errMsg);
            }
            errNo = WrapperProxy.GetDevice(DeviceType.MONITOR);
            if (ErrorNumber.OK != errNo)
            {
                var errMsg = "Get monitor device failed. Error number = " + errNo;
                log.Error(errMsg);
                throw new Exception(errMsg);
            }
        }
コード例 #15
0
        private void MFWEventHandle(Event evt)
        {
            switch (evt.EventType)
            {
                #region Register
            case EventType.UNKNOWN: break;

            case EventType.SIP_REGISTER_SUCCESS: break;

            case EventType.SIP_REGISTER_FAILURE:
            {
                callView.ShowMessage(false, "注册失败", MessageBoxButtonsType.None, MessageBoxIcon.Error);
            }
            break;

            case EventType.SIP_REGISTER_UNREGISTERED:
            {
                callView.ShowMessage(false, "未注册", MessageBoxButtonsType.None, MessageBoxIcon.Error);
            }
            break;

                #endregion
                #region Call
            case EventType.SIP_CALL_INCOMING:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                call.CallType  = CallType.INCOMING;
                call.CallState = CallState.SIP_INCOMING_INVITE;

                var msg = string.Format("【{0}】呼入中,是否接听?", evt.CallerName);

                var callStateText = GetCallStateText(_currentCall, true);
                if (!string.IsNullOrEmpty(callStateText))
                {
                    msg += '\n' + callStateText;
                    msg += '\n' + "接听将挂断当前通话。";
                }
                Action answerAction = () =>
                {
                    log.Info(string.Format("接听呼叫{0}", evt.CallerName));
                    if (!string.IsNullOrEmpty(callStateText))
                    {
                        log.Info(string.Format("挂断呼叫{0}", _currentCall.CallName));
                        WrapperProxy.TerminateCall(_currentCall.CallHandle);
                    }

                    evt.Call    = call;
                    CurrentCall = call;
                    var localChannel = new Channel(call, 0, MediaType.LOCAL, false)
                    {
                        ChannelName = "本地视频"
                    };
                    call.AddChannel(localChannel);
                };
                Action hangupAction = () =>
                {
                    log.Info(string.Format("不接听呼叫{0}", evt.CallerName));
                    WrapperProxy.TerminateCall(evt.CallHandle);
                };
                callView.ShowMessage(true, msg, MessageBoxButtonsType.AnswerHangup, MessageBoxIcon.Question
                                     , answerAction, hangupAction);
            }
            break;

            case EventType.SIP_CALL_TRYING:
            {
                var callStateText = GetCallStateText(_currentCall, true);
                if (!string.IsNullOrEmpty(callStateText))
                {
                    log.Info(string.Format("挂断呼叫{0}", _currentCall.CallName));
                    WrapperProxy.TerminateCall(_currentCall.CallHandle);
                }
                var call = GetCall(evt.CallHandle, true, evt);
                call.CallType  = CallType.OUTGOING;
                call.CallState = CallState.SIP_OUTGOING_TRYING;
                evt.Call       = call;
                CurrentCall    = call;
                var localChannel = new Channel(call, 0, MediaType.LOCAL, false)
                {
                    ChannelName = "本地视频"
                };
                call.AddChannel(localChannel);
                var calleeName = evt.CalleeName;
                if (string.IsNullOrWhiteSpace(evt.CalleeName))
                {
                    calleeName = propertyManager.GetProperty(PropertyKey.CalleeAddr);
                }
                var msg = string.Format("尝试呼出【{0}】连接中...", calleeName);

                Action hangupAction = () =>
                {
                    log.Info(string.Format("挂断呼叫{0}", calleeName));
                    WrapperProxy.TerminateCall(evt.CallHandle);
                };
                callView.ShowMessage(false, msg, MessageBoxButtonsType.Hangup, MessageBoxIcon.Question
                                     , hangupAction);
            }
            break;

            case EventType.SIP_CALL_RINGING:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call       = call;
                call.CallType  = CallType.OUTGOING;
                call.CallState = CallState.SIP_OUTGOING_RINGING;

                if (call == CurrentCall)
                {
                    var calleeName = evt.CalleeName;
                    if (string.IsNullOrWhiteSpace(evt.CalleeName))
                    {
                        calleeName = propertyManager.GetProperty(PropertyKey.CalleeAddr);
                    }
                    var msg = string.Format("呼出【{0}】响铃中...", calleeName);

                    Action hangupAction = () =>
                    {
                        log.Info(string.Format("挂断呼叫{0}", calleeName));
                        WrapperProxy.TerminateCall(evt.CallHandle);
                    };
                    callView.ShowMessage(false, msg, MessageBoxButtonsType.Hangup, MessageBoxIcon.Information
                                         , hangupAction);
                }
            }
            break;

            case EventType.SIP_CALL_FAILURE:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call       = call;
                call.StopTime  = DateTime.Now;
                call.CallType  = CallType.OUTGOING;
                call.CallState = CallState.SIP_OUTGOING_FAILURE;
                call.Reason    = string.IsNullOrEmpty(evt.Reason) ? "unknown reason" : evt.Reason;
                if (call == CurrentCall)
                {
                    var msg = string.Format("呼出【{0}】失败,原因:{1}", call.CallName, call.Reason);
                    log.Info(msg);
                    callView.ShowMessage(false, msg, MessageBoxButtonsType.None, MessageBoxIcon.Error);
                }
            }
            break;

            case EventType.SIP_CALL_CLOSED:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call             = call;
                call.Reason          = string.IsNullOrEmpty(evt.Reason) ? "unknown reason" : evt.Reason;
                call.UnconnectedTime = DateTime.Now;
                call.StopTime        = DateTime.Now;
                call.CallState       = CallState.SIP_CALL_CLOSED;

                if (call == CurrentCall)
                {
                    var msg = string.Format("呼出【{0}】关闭,原因:{1}", call.CallName, call.Reason);
                    log.Info(msg);
                    callView.ShowMessage(false, msg, MessageBoxButtonsType.None, MessageBoxIcon.Information);
                }
            }
            break;

            case EventType.SIP_CALL_HOLD:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call       = call;
                call.CallState = CallState.SIP_CALL_HOLD;
                if (call == CurrentCall)
                {
                    var msg       = string.Format("呼叫【{0}】中断保持,是否需要恢复通话?", call.CallName);
                    var yesAction = new Action(() =>
                        {
                            log.Info(string.Format("呼叫【{0}】中断恢复", call.CallName));
                            var errno = WrapperProxy.ResumeCall(call.CallHandle);
                            if (errno != ErrorNumber.OK)
                            {
                                callView.ShowMessage(false, "恢复通话失败!", MessageBoxButtonsType.OK, MessageBoxIcon.Error);
                            }
                        });
                    Action noAction = () =>
                    {
                        log.Info(string.Format("挂断呼叫{0}", evt.CallerName));
                        WrapperProxy.TerminateCall(evt.CallHandle);
                    };
                    callView.ShowMessage(false, msg, MessageBoxButtonsType.YesNoCancel, MessageBoxIcon.Question
                                         , yesAction, noAction);
                }
            }
            break;

            case EventType.SIP_CALL_HELD:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call       = call;
                call.CallState = CallState.SIP_CALL_HELD;
                if (call == CurrentCall)
                {
                    var    msg          = string.Format("呼叫【{0}】被保持", call.CallName);
                    Action hangupAction = () =>
                    {
                        log.Info(string.Format("挂断呼叫{0}", evt.CallerName));
                        WrapperProxy.TerminateCall(evt.CallHandle);
                    };
                    callView.ShowMessage(false, msg, MessageBoxButtonsType.Hangup, MessageBoxIcon.Information, hangupAction);
                }
            }
            break;

            case EventType.SIP_CALL_DOUBLE_HOLD:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call       = call;
                call.CallState = CallState.SIP_CALL_DOUBLE_HOLD;
                if (call == CurrentCall)
                {
                    var msg       = string.Format("呼叫【{0}】双方中断保持,是否需要恢复通话?", call.CallName);
                    var yesAction = new Action(() =>
                        {
                            log.Info(string.Format("呼叫【{0}】中断恢复", call.CallName));
                            var errno = WrapperProxy.ResumeCall(call.CallHandle);
                            if (errno != ErrorNumber.OK)
                            {
                                callView.ShowMessage(false, "恢复通话失败!", MessageBoxButtonsType.OK, MessageBoxIcon.Error);
                            }
                        });
                    Action noAction = () =>
                    {
                        log.Info(string.Format("挂断呼叫{0}", evt.CallerName));
                        WrapperProxy.TerminateCall(evt.CallHandle);
                    };
                    callView.ShowMessage(false, msg, MessageBoxButtonsType.YesNoCancel, MessageBoxIcon.Question
                                         , yesAction, noAction);
                }
            }
            break;

            case EventType.SIP_CALL_UAS_CONNECTED:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call = call;
                log.Info(string.Format("呼入{0}接听通话中", call.CallName));
                call.ConnectedTime = DateTime.Now;
                call.CallType      = CallType.INCOMING;
                call.CallState     = CallState.SIP_INCOMING_CONNECTED;
                if (call == CurrentCall)
                {
                    callView.HideMessage();
                }
            }
            break;

            case EventType.SIP_CALL_UAC_CONNECTED:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call = call;
                log.Info(string.Format("呼出{0}接听通话中", call.CallName));
                call.ConnectedTime = DateTime.Now;
                call.CallType      = CallType.OUTGOING;
                call.CallState     = CallState.SIP_OUTGOING_CONNECTED;
                if (call == CurrentCall)
                {
                    callView.HideMessage();
                }
            }
            break;

                #endregion
                #region Content
            case EventType.SIP_CONTENT_INCOMING:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call = call;
                var contentChannel = call.GetContentChannel();
                if (null != contentChannel)
                {
                    call.RemoveChannel(contentChannel.ChannelID);
                }
                contentChannel = new Channel(call, evt.StreamId, MediaType.CONTENT);
                call.AddChannel(contentChannel);
                contentChannel.Size    = new Size(evt.WndWidth, evt.WndHeight);
                contentChannel.IsVideo = true;
            }
            break;

            case EventType.SIP_CONTENT_CLOSED:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call = call;
                var contentChannel = call.GetContentChannel();
                if (null != contentChannel)
                {
                    call.RemoveChannel(contentChannel.ChannelID);
                }
            }
            break;

            case EventType.SIP_CONTENT_SENDING:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call = call;
            }
            break;

            case EventType.SIP_CONTENT_IDLE:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call = call;
                call.IsContentSupported = true;
            }
            break;

            case EventType.SIP_CONTENT_UNSUPPORTED:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call = call;
                call.IsContentSupported = false;
            }
            break;
                #endregion

                #region Device

                /*
                 * case EventType.DEVICE_VIDEOINPUTCHANGED:
                 * {
                 *  string deviceName = evt.PlugDeviceName;
                 *  string deviceHandle = evt.DeviceHandle;
                 *  if (string.IsNullOrWhiteSpace(deviceName)
                 || string.IsNullOrWhiteSpace(deviceHandle))
                 || {
                 ||     return;
                 || }
                 || if (true == evt.PlugDeviceStatus)
                 || {
                 ||     var device = new Device(DeviceType.VIDEOINPUT, deviceHandle, deviceName);
                 ||     deviceManager.AddDevice(device);
                 || }
                 || else
                 || {
                 ||     deviceManager.RemoveDevice(deviceHandle);
                 || }
                 ||}
                 ||break;
                 ||case EventType.DEVICE_AUDIOINPUTCHANGED:
                 ||{
                 || string deviceName = evt.PlugDeviceName;
                 || string deviceHandle = evt.DeviceHandle;
                 || if (string.IsNullOrWhiteSpace(deviceName)
                 || string.IsNullOrWhiteSpace(deviceHandle))
                 || {
                 ||     return;
                 || }
                 || if (true == evt.PlugDeviceStatus)
                 || {
                 ||     var device = new Device(DeviceType.AUDIOINPUT, deviceHandle, deviceName);
                 ||     deviceManager.AddDevice(device);
                 || }
                 || else
                 || {
                 ||     deviceManager.RemoveDevice(deviceHandle);
                 || }
                 ||}
                 ||break;
                 ||case EventType.DEVICE_AUDIOOUTPUTCHANGED:
                 ||{
                 || string deviceName = evt.PlugDeviceName;
                 || string deviceHandle = evt.DeviceHandle;
                 || if (string.IsNullOrWhiteSpace(deviceName)
                 || string.IsNullOrWhiteSpace(deviceHandle))
                 || {
                 ||     return;
                 || }
                 || if (true == evt.PlugDeviceStatus)
                 || {
                 ||     var device = new Device(DeviceType.AUDIOOUTPUT, deviceHandle, deviceName);
                 ||     deviceManager.AddDevice(device);
                 || }
                 || else
                 || {
                 ||     deviceManager.RemoveDevice(deviceHandle);
                 || }
                 ||}
                 ||break;
                 ||case EventType.DEVICE_VOLUMECHANGED: break;
                 ||case EventType.DEVICE_MONITORINPUTSCHANGED:
                 ||{
                 || string deviceName = evt.PlugDeviceName;
                 || string deviceHandle = evt.DeviceHandle;
                 || if (string.IsNullOrWhiteSpace(deviceName)
                 || string.IsNullOrWhiteSpace(deviceHandle))
                 || {
                 ||     return;
                 || }
                 || if (true == evt.PlugDeviceStatus)
                 || {
                 ||     var device = new Device(DeviceType.MONITOR, deviceHandle, deviceName);
                 ||     deviceManager.AddDevice(device);
                 || }
                 || else
                 || {
                 ||     deviceManager.RemoveDevice(deviceHandle);
                 || }
                 ||}
                 ||break;
                 */
                #endregion

                #region Stream
            case EventType.STREAM_VIDEO_LOCAL_RESOLUTIONCHANGED:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call = call;
                var localChannel = call.GetLocalChannel();
                if (null != localChannel)
                {
                    localChannel.Size    = new Size(evt.WndWidth, evt.WndHeight);
                    localChannel.IsVideo = true;
                }
                if (call == CurrentCall)
                {
                    callView.HideMessage();
                }
            }
            break;

            case EventType.STREAM_VIDEO_REMOTE_RESOLUTIONCHANGED:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call = call;
                var channel = call.GetChannel(evt.StreamId);
                if (null != channel)
                {
                    channel.Size    = new Size(evt.WndWidth, evt.WndHeight);
                    channel.IsVideo = true;
                }
                if (call == CurrentCall)
                {
                    callView.HideMessage();
                }
            }
            break;
                #endregion

            case EventType.NETWORK_CHANGED: break;

            case EventType.MFW_INTERNAL_TIME_OUT: break;


            case EventType.REFRESH_ACTIVE_SPEAKER:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call             = call;
                call.ActiveSpeakerId = evt.ActiveSpeakerStreamId;
                if (call == CurrentCall)
                {
                    callView.HideMessage();
                }
            }
            break;

            case EventType.REMOTE_VIDEO_REFRESH:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call      = call;
                call.CallName = evt.CallerName;
                call.ClearRemoteChannels();
                call.ChannelNumber   = evt.RemoteVideoChannelNum;
                call.ActiveSpeakerId = evt.ActiveSpeakerStreamId;
                if (call == CurrentCall)
                {
                    callView.HideMessage();
                }
            }
            break;

            case EventType.REMOTE_VIDEO_CHANNELSTATUS_CHANGED:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call = call;
                call.AddChannel(evt.StreamId, MediaType.REMOTE);
                if (call.ActiveSpeakerId <= 0)
                {
                    call.ActiveSpeakerId = evt.StreamId;
                }
                if (call == CurrentCall)
                {
                    callView.HideMessage();
                }
            }
            break;

            case EventType.REMOTE_VIDEO_DISPLAYNAME_UPDATE:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call = call;
                call.SetChannelName(evt.StreamId, evt.RemoteChannelDisplayName);
                if (call == CurrentCall)
                {
                    callView.HideMessage();
                }
            }
            break;

            case EventType.SIP_CALL_MODE_CHANGED:
            {
                var call = GetCall(evt.CallHandle, true, evt);
                evt.Call      = call;
                call.CallMode = evt.CallMode;
                if (evt.CallMode == CallMode.AUDIOVIDEO_CALL)
                {
                    call.IsAudioOnly = false;
                }
                else
                {
                    call.IsAudioOnly        = true;
                    call.IsContentSupported = false;
                }
                if (call == CurrentCall)
                {
                    callView.HideMessage();
                }
            }
            break;

            case EventType.SIP_CALL_MODE_UPGRADE_REQ: break;

            case EventType.IS_TALKING_STATUS_CHANGED: break;

            case EventType.CERTIFICATE_VERIFY: break;

            case EventType.TRANSCODER_FINISH: break;

            case EventType.ICE_STATUS_CHANGED: break;

            case EventType.SUTLITE_INCOMING_CALL: break;

            case EventType.SUTLITE_TERMINATE_CALL: break;

            case EventType.NOT_SUPPORT_VIDEOCODEC: break;

            case EventType.BANDWIDTH_LIMITATION: break;

            case EventType.MEDIA_ADDRESS_UPDATED: break;

            case EventType.AUTODISCOVERY_STATUS_CHANGED: break;
            }
        }