/// <summary> /// 加载监控平台,加载通道管理模块,加载license管理模块 /// </summary> /// <returns></returns> public SmcErr Load() { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); SmcErr err = new SmcErr(); //开启连接监控平台线程 this.connectMonitorManageServiceThread = new Thread(new ThreadStart(ConnectMonitorManageServiceTimer)); this.connectMonitorManageServiceThread.Start(); logEx.Info("ConnectMonitorManageServiceTimer Run"); //初始话定时器 this.monitorManageServiceKeepLiveTimer.AutoReset = true; this.monitorManageServiceKeepLiveTimer.Elapsed += new ElapsedEventHandler(MonitorManageServiceKeepLiveTimer_Elapsed); //保活时间间隔,5秒 this.monitorManageServiceKeepLiveTimer.Interval = CgwConst.MONITOR_MANAGE_KEEPLIVE_WAIT_TIME; this.monitorManageServiceKeepLiveTimer.Start(); manageChannel = new MonitorChannelRelationManager(); try { IPAddressEx ip = new IPAddressEx(ConfigSettings.CgwServiceIp); } catch (System.Exception ex) { logEx.Error("CgwService configuration files is error ,The IP address format is error,Please Check this configuration files! " + ex.ToString()); err.SetErrorNo(CgwError.ERR_CGW_CONFIGURE_FORMAT); } if (err.IsSuccess()) { InitSotParam param = new InitSotParam(); param.cgwIp = ConfigSettings.CgwServiceIp; param.audioType = ConfigSettings.CgwAudioProtocol; param.channelCallPort = ConfigSettings.CgwChanelCallPort; param.rtpStartPort = ConfigSettings.CgwChannelRTPStartPort; param.rtpPortCount = ConfigSettings.CgwChannelRTPPortCount; err = manageChannel.Init(param); } if (err.IsSuccess()) { logEx.Info("CgwServiceLoad Successful !"); } else { logEx.Error("CgwServiceLoad failed,ErrNo :{0}", err.ErrNo); } return(err); }
/// <summary> /// 软终端初始化 /// </summary> /// <param name="addr"></param> /// <returns></returns> public SmcErr Init(InitSotParam param) { SmcErr err = new CgwError(); NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); try { SoftTerminalCallback handler = new SoftTerminalCallback(); handler.NlogHandler = new NLogCallback(this.WriteLog); handler.IFrameHandler = this.makeIFrameCallback; handler.errReportHandler = this.errReportCallback; bool isSuccess = this.softTerminalAdapter.RegistSotCallback(handler); if (!isSuccess) { logEx.Trace("Init Regist callback failed."); err.SetErrorNo(CgwError.ERR_CGW_CHANNEL_SOT_REGIST_CALLBACK_FAIL); return(err); } err = this.softTerminalAdapter.Init(param); if (!err.IsSuccess()) { logEx.Trace("Init failed."); return(err); } } catch (System.Exception ex) { logEx.Error(ex, "Init Exception."); } logEx.Trace("Init successfully."); return(err); }
/// <summary> /// 初始化 /// </summary> /// <param name="addr">融合网关ip</param> /// <returns>结果</returns> public SmcErr Init(InitSotParam param) { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); logEx.Info("channelRelationManager Init start."); SmcErr err = this.monitorChannelManager.Init(param); if (!err.IsSuccess()) { logEx.Error("channelRelationManager Init failed."); } else { logEx.Info("channelRelationManager Init successfully."); } return err; }
/// <summary> /// 软终端初始化 /// </summary> /// <param name="addr"></param> /// <returns></returns> public SmcErr Init(InitSotParam param) { SmcErr err = new CgwError(); NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); try { SoftTerminalCallback handler = new SoftTerminalCallback(); handler.NlogHandler = new NLogCallback(this.WriteLog); handler.IFrameHandler = this.makeIFrameCallback; handler.errReportHandler = this.errReportCallback; bool isSuccess = this.softTerminalAdapter.RegistSotCallback(handler); if (!isSuccess) { logEx.Trace("Init Regist callback failed."); err.SetErrorNo(CgwError.ERR_CGW_CHANNEL_SOT_REGIST_CALLBACK_FAIL); return err; } err = this.softTerminalAdapter.Init(param); if (!err.IsSuccess()) { logEx.Trace("Init failed."); return err; } } catch (System.Exception ex) { logEx.Error(ex, "Init Exception."); } logEx.Trace("Init successfully."); return err; }