/// <summary> /// 线程加载监控平台 /// </summary> private static void LoadMonitorTimer_Elapsed() { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); System.Threading.Thread.Sleep(1000); SmcErr smcErr = new SmcErr(); try { smcErr = CgwService.Instance().Load(); if (false == smcErr.IsSuccess()) { logEx.Error("CGW service Start failed! Errno :{0}", smcErr.ErrNo); NLog.LogManager.Flush(); System.Diagnostics.Process.GetCurrentProcess().Kill(); } else { logEx.Info("CGW service Start Success"); } } catch (Exception ex) { logEx.Fatal(ex, "CGW service LoadMonitor Failed!"); NLog.LogManager.Flush(); } }
/// <summary> /// 初始化融合网管服务 /// </summary> public void InitService() { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); //初始化监控平台 SmcErr err = new SmcErr(); err = MonitorChannelBll.Instance().LoadMonitor(); if (err.IsSuccess()) { logEx.Trace("Load VideoMonitor Successful !"); } else { logEx.Fatal("Load VideoMonitor Failed, ErrNo : {0}!", err.ErrNo); } }
/// <summary> /// 线程Unload cgw /// </summary> /// <returns></returns> public SmcErr StopAllStream() { SmcErr err = new SmcErr(); NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); //Stop VideoData err = MonitorChannelBll.Instance().StopAllStream(); if (err.IsSuccess()) { logEx.Info("UnLoad CgwService Successful !"); } else { logEx.Fatal("UnLoad CgwService Failed, ErrNo : {0}!", err.ErrNo); } return(err); }
/// <summary> /// 线程加载cgw /// </summary> /// <returns></returns> public SmcErr Load() { SmcErr err = new SmcErr(); NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); //初始化监控平台 err = MonitorChannelBll.Instance().Load(); if (err.IsSuccess()) { logEx.Trace("Load CgwService Successful !"); isLoadSuccess = true; } else { logEx.Fatal("Load CgwService Failed, ErrNo : {0}!", err.ErrNo); } return(err); }
/// <summary> /// 线程加载cgw /// </summary> /// <returns></returns> public SmcErr Load() { SmcErr err = new SmcErr(); NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); //初始化监控平台 err = VideoMonitorManage.Instance().Load(); VideoMonitorManage.Instance().SetDataCallBackFunc(DataCallBackFunc); if (err.IsSuccess()) { logEx.Trace("Load CgwMonitorManage Successful !"); isLoadSuccess = true; } else { logEx.Fatal("Load CgwMonitorManage Failed, ErrNo : {0}!", err.ErrNo); } return(err); }
static void Main(string[] args) { SmcErr smcErr = new SmcErr(); NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); try { logEx.Info("Enter: Start Cgw Service"); CgwServiceInit cgwService = new CgwServiceInit(); smcErr = CgwService.Instance().InitService(); if (smcErr.IsSuccess()) { cgwService.InitServiceInfo(); string LocalServiceStartMode = CommonFunction.GetAppSetting("LocalServiceStartMode"); if (string.IsNullOrEmpty(LocalServiceStartMode)) { LocalServiceStartMode = "1"; } CgwService.Instance().LicenseInit(); Thread dbConnectionThread = new Thread(new ThreadStart(LoadMonitorTimer_Elapsed)); dbConnectionThread.Start(); ServiceRun.StarUpService(LocalServiceStartMode, "HUAWEI SMC 2.0 ConvergeGateway", cgwService); //logEx.Info("CGW service Start Successful!"); } else { logEx.Error("CGW service Start failed! Errno :{0}", smcErr.ErrNo); NLog.LogManager.Flush(); System.Diagnostics.Process.GetCurrentProcess().Kill(); } } catch (System.Exception e) { logEx.Fatal(e, "CGW service Start Failed!"); NLog.LogManager.Flush(); } }
/// <summary> /// 线程加载监控平台 /// </summary> private static void LoadMonitorTimer_Elapsed() { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); System.Threading.Thread.Sleep(CgwConst.Thread_Sleep_Time); SmcErr smcErr = new SmcErr(); try { smcErr = MonitorManageService.Instance().Load(); if (false == smcErr.IsSuccess()) { logEx.Error("MonitorManageService Start failed! Errno :{0}", smcErr.ErrNo); NLog.LogManager.Flush(); System.Diagnostics.Process.GetCurrentProcess().Kill(); } } catch (Exception ex) { logEx.Fatal(ex, "MonitorManageService LoadMonitor Failed!"); NLog.LogManager.Flush(); } }
/// <summary> /// 线程加载cgw /// </summary> /// <returns></returns> public SmcErr Load() { SmcErr err = new SmcErr(); NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); //初始化监控平台 err = VideoMonitorManage.Instance().Load(); VideoMonitorManage.Instance().SetDataCallBackFunc(DataCallBackFunc); if (err.IsSuccess()) { logEx.Trace("Load CgwMonitorManage Successful !"); isLoadSuccess = true; } else { logEx.Fatal("Load CgwMonitorManage Failed, ErrNo : {0}!", err.ErrNo); } return err; }
/// <summary> /// 监控平台加载器,轮询加载,直到成功 /// </summary> /// <param name="loginInfo"></param> private void LoginThread(Object loginInfoObj) { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); logEx.Trace("Enter: eLTEVideoMonitor.LoginThread()."); try { eLTELoginInfo loginInfo = loginInfoObj as eLTELoginInfo; if (loginInfo == null) { logEx.Error("loginInfoObj is Null."); return; } if (loginInfo.NotFirstLogin == true) { //登陆失败,等待一分后再次尝试登陆 Thread.Sleep(5000); } //本机IP //string localIP = GetLocalIP(ip, iPort, ilocalPort); if (string.IsNullOrEmpty(localIP)) { localIP = GetLocalIP(ip, iPort, ilocalPort); } logEx.Trace("Call eLTEVideoMonitor.Login({0},{1},{2},{3}).", loginInfo.Ip, loginInfo.Port, loginInfo.User, localIP); //设置登录服务器IP、本地IP、用户名、密码、sip端口等信息 ELTE_RESULT result = (ELTE_RESULT)lteSdkClient.Set_Login_Info(loginInfo.Ip, localIP, loginInfo.User, loginInfo.Pwd, loginInfo.Port.ToString(), Convert.ToInt32(loginInfo.User)); if (result != ELTE_RESULT.RET_SUCCESS) { logEx.Error("Set_Login_Info failed.Monitor id:{0}.ip:{1}, port:{2}, user:{3}", this.monitorId, loginInfo.Ip, loginInfo.Port, loginInfo.User); } //发起视频回传成功后,在状态变化事件中处理视频接收 if (callP2pvideo == null) { callP2pvideo = P2pStatusDelegateFun; eLTEInterface.SetP2pVideoCallStaCallBack(callP2pvideo); callResStatus = CallbackResStatusDelegateFun; eLTEInterface.SetResStaCallBack(callResStatus); callUserStatus = CallUserStatusDelegateFun; eLTEInterface.SetUserStaCallBack(callUserStatus); callProvisionAllResync = CallProvisionAllDelegateFun; eLTEInterface.SetProvisionAllResyncCallBack(callProvisionAllResync); callModuleStatus = CallModuleStatusDelegateFun; eLTEInterface.SetModStaCallBack(callModuleStatus); //设置rtp转码回调函数 frameDataCallBack = FrameDataCallBackFun; //初始化rtp转码模块 rtpAdapter.ESDK_RTP_Init(); //设置NETSOURCE日志目录 IVS_NETSOURCE_RESULT iNet = NetSourcedInterface.IVS_NETSOURCE_Init(AppDomain.CurrentDomain.BaseDirectory + "\\logs"); if (iNet != IVS_NETSOURCE_RESULT.SUCCESS) { logEx.Error("SipStackAdapter.IVS_NETSOURCE_Init Failed."); } } //初始化上下文,启动SDK result = (ELTE_RESULT)lteSdkClient.SDK_START(); if (result != ELTE_RESULT.RET_SUCCESS) { logEx.Fatal("eLTEVideoMonitor.SDK_START failed.Monitor id:{0}.ip:{1}, port:{2}, user:{3},ErrorNo:{4}", this.monitorId, loginInfo.Ip, loginInfo.Port, loginInfo.User,(int)result); //服务器端返回错误, 操作被调度机拒绝 if ((int)(result) == -40097) { logEx.Fatal("Login to eLTEVideoMonitor failed,elte remote failed,elte refuse to connect."); } } else { isLoginSuccess = true; logEx.Info("eLTEVideoMonitor.SDK_START success.Monitor id:{0}.ip:{1}, port:{2}, user:{3}.", this.monitorId, loginInfo.Ip, loginInfo.Port, loginInfo.User); } } catch (System.Exception ex) { logEx.Error("Load eLTEVideoMonitor failed. Exception message:{0}.", ex.Message); } }
/// <summary> /// 线程Unload cgw /// </summary> /// <returns></returns> public SmcErr StopAllStream() { SmcErr err = new SmcErr(); NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); //Stop VideoData err = MonitorChannelBll.Instance().StopAllStream(); if (err.IsSuccess()) { logEx.Info("UnLoad CgwService Successful !"); } else { logEx.Fatal("UnLoad CgwService Failed, ErrNo : {0}!", err.ErrNo); } return err; }
/// <summary> /// 线程加载cgw /// </summary> /// <returns></returns> public SmcErr Load() { SmcErr err = new SmcErr(); NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); //初始化监控平台 err = MonitorChannelBll.Instance().Load(); if (err.IsSuccess()) { logEx.Trace("Load CgwService Successful !"); isLoadSuccess = true; } else { logEx.Fatal("Load CgwService Failed, ErrNo : {0}!", err.ErrNo); } return err; }