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); } }