public BootstrapServiceDomain() { try { #region Initialize global variables ClientConnectionString = @"Data Source=" + AppDomain.CurrentDomain.BaseDirectory + "AllocateConferenceNumber.sdf"; strLocalDBPath = AppDomain.CurrentDomain.BaseDirectory + "AllocateConferenceNumber.sdf"; lstsSuperNodeInfo = new List<string>(); localSuperNodeInfo = new List<string>(); dictFlashUrl = new Dictionary<int, string>(); arr = new byte[5000]; #endregion if (!System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory.ToString() + "sqlceme35.dll")) { new WebClient().DownloadFile(VMuktiAPI.VMuktiInfo.ZipFileDownloadLink + "sqlceme35.dll.zip", AppDomain.CurrentDomain.BaseDirectory.ToString() + "sqlceme35.dll"); new WebClient().DownloadFile(VMuktiAPI.VMuktiInfo.ZipFileDownloadLink + "sqlceqp35.dll.zip", AppDomain.CurrentDomain.BaseDirectory.ToString() + "sqlceqp35.dll"); new WebClient().DownloadFile(VMuktiAPI.VMuktiInfo.ZipFileDownloadLink + "sqlcese35.dll.zip", AppDomain.CurrentDomain.BaseDirectory.ToString() + "sqlcese35.dll"); } if (!System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory.ToString() + "AllocateConferenceNumber.sdf")) { SqlCeEngine clientEngine = new SqlCeEngine(ClientConnectionString); clientEngine.CreateDatabase(); LocalSQLConn = new SqlCeConnection(); LocalSQLConn.ConnectionString = ClientConnectionString; LocalSQLConn.Open(); fncCreateSNNodeInfoTable(); fncCreateBuddyStatusTable(); fncCreateUserBuddyListTable(); fncCreateUserSuperNode_NodeInfoTable(); fncCreateUserSuperNodeInfoTable(); GetBuddyInfoFromServer(); } else { LocalSQLConn = new SqlCeConnection(); LocalSQLConn.ConnectionString = ClientConnectionString; LocalSQLConn.Open(); fncSNInsertBuddy(VMuktiAPI.VMuktiInfo.BootStrapIPs[0], "Online"); } awClientConnectionString = @"Data Source=" + AppDomain.CurrentDomain.BaseDirectory + "AllocateConferenceNumber.sdf"; strCurrentMachineIP = VMuktiAPI.VMuktiInfo.CurrentPeer.CurrentMachineIP; #region HttpServerHoster 4 Performance BootStrapDelegates objBSDel = new BootStrapDelegates(); objBSDel.EntHttpAddBuddy += new BootStrapDelegates.DelsvcHttpAddBuddy(BootstrapServiceDomain_EntHttpAddBuddy); objBSDel.EntHttpRemoveBuddy += new BootStrapDelegates.DelsvcRemoveAddBuddy(BootstrapServiceDomain_EntHttpRemoveBuddy); objBSDel.EntHttpBsGetSuperNodeIP += new BootStrapDelegates.DelsvcHttpBsGetSuperNodeIP(BootstrapServiceDomain_EntHttpBsGetSuperNodeIP); objBSDel.EntHttpBSJoin += new BootStrapDelegates.DelHttpBSJoin(BootstrapServiceDomain_EntHttpBSJoin); objBSDel.EntHttpBSUnJoin += new BootStrapDelegates.DelsvcHttpBSUnJoin(BootstrapServiceDomain_EntHttpBSUnJoin); objBSDel.EntHttpGetSuperNodeBuddyList += new BootStrapDelegates.DelsvcHttpGetSuperNodeBuddyList(BootstrapServiceDomain_EntHttpGetSuperNodeBuddyList); objBSDel.EntHttpBSAuthorizedUser += new BootStrapDelegates.DelsvcHttpBSAuthorizedUser(BootstrapServiceDomain_EntHttpBSAuthorizedUser); objBSDel.EntsvcGetNodeNameByIP += new BootStrapDelegates.DelsvcGetNodeNameByIP(BootstrapServiceDomain_EntsvcGetNodeNameByIP); objBSDel.EntHTTPGetOfflineNodeName += new BootStrapDelegates.DelsvcGetOfflineNodeName(BootstrapServiceDomain_EntHTTPGetOfflineNodeName); objBSDel.EntsvcGetAllBuddies += new BootStrapDelegates.DelsvcGetAllBuddies(BootstrapServiceDomain_EntsvcGetAllBuddies); objBSDel.EntsvcUpdateVMuktiVersion += new BootStrapDelegates.DelsvcUpdateVMuktiVersion(objBSDel_EntsvcUpdateVMuktiVersion); objHttpBootStrap = objBSDel; BasicHttpServer bhsHttpBootStrap = new BasicHttpServer(ref objHttpBootStrap, "http://" + VMuktiInfo.BootStrapIPs[0] + ":80/HttpBootStrap"); bhsHttpBootStrap.AddEndPoint<IHTTPBootStrapService>("http://" + VMuktiInfo.BootStrapIPs[0] + ":80/HttpBootStrap"); bhsHttpBootStrap.OpenServer(); #endregion #region HttpDataBase Server try { BootStrapDataBaseDelegates objBSDBDel = new BootStrapDataBaseDelegates(); objBSDBDel.EntHttpsvcjoin += new BootStrapDataBaseDelegates.DelHttpsvcJoin(objBSDBDel_EntHttpsvcjoin); objBSDBDel.EntHttpExecuteDataSet += new BootStrapDataBaseDelegates.DelHttpExecuteDataSet(objBSDBDel_EntHttpExecuteDataSet); objBSDBDel.EntHttpExecuteStoredProcedure += new BootStrapDataBaseDelegates.DelHttpExecuteStoredProcedure(objBSDBDel_EntHttpExecuteStoredProcedure); objBSDBDel.EntHttpExecuteNonQuery += new BootStrapDataBaseDelegates.DelHttpExecuteNonQuery(objBSDBDel_EntHttpExecuteNonQuery); objBSDBDel.EntHttpExecuteReturnNonQuery += new BootStrapDataBaseDelegates.DelHttpExecuteReturnNonQuery(objBSDBDel_EntHttpExecuteReturnNonQuery); objHttpDatabaseBootStrap = objBSDBDel; bhsHttpDataBase = new BasicHttpServer(ref objHttpDatabaseBootStrap, "http://" + VMuktiInfo.BootStrapIPs[0] + ":80/HttpDataBase"); bhsHttpDataBase.AddEndPoint<IHttpBootStrapDataBaseService>("http://" + VMuktiInfo.BootStrapIPs[0] + ":80/HttpDataBase"); bhsHttpDataBase.OpenServer(); } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "SuperNoeServiceDomain()--HttpDataBase Server()", "Domains\\SuperNodeServiceDomain.cs"); } #endregion #region HTTP Server For File Transfer Service 4 Performance HTTPFileTransferDelegates objFileTransferDel = new HTTPFileTransferDelegates(); objFileTransferDel.EntsvcHTTPFileTransferServiceJoin += new HTTPFileTransferDelegates.DelsvcHTTPFileTransferServiceJoin(BootstrapServiceDomain_EntsvcHTTPFileTransferServiceJoin); objFileTransferDel.EntsvcHTTPFileTransferServiceUploadFile += new HTTPFileTransferDelegates.DelsvcHTTPFileTransferServiceUploadFile(BootstrapServiceDomain_EntsvcHTTPFileTransferServiceUploadFile); objFileTransferDel.EntsvcHTTPFileTransferServiceUploadFileToInstallationDirectory += new HTTPFileTransferDelegates.DelsvcHTTPFileTransferServiceUploadFileToInstallationDirectory(BootstrapServiceDomain_EntsvcHTTPFileTransferServiceUploadFileToInstallationDirectory); objFileTransferDel.EntsvcHTTPFileTransferServiceDownloadFile += new HTTPFileTransferDelegates.DelsvcHTTPFileTransferServiceDownloadFile(BootstrapServiceDomain_EntsvcHTTPFileTransferServiceDownloadFile); object objHTTPFileTransfer = objFileTransferDel; bhsFileTransferServer = new BasicHttpServer(ref objHTTPFileTransfer, "http://" + VMuktiInfo.BootStrapIPs[0] + ":80/VMukti/HttpFileTransferService"); bhsFileTransferServer.AddEndPoint<IHTTPFileTransferService>("http://" + VMuktiInfo.BootStrapIPs[0] + ":80/VMukti/HttpFileTransferService"); bhsFileTransferServer.OpenServer(); #endregion #region Http Server For Flash Video HttpFlashVideoDelegates objFlashVideoDel = new HttpFlashVideoDelegates(); objFlashVideoDel.EntsvcHttpBSFVUnJoin += new HttpFlashVideoDelegates.DelsvcHttpBSFVUnJoin(objFlashVideo_EntsvcHttpBSFVUnJoin); objFlashVideoDel.EntsvcHttpBSFVJoin += new HttpFlashVideoDelegates.DelsvcHttpBSFVJoin(objFlashVideo_EntsvcHttpBSFVJoin); objFlashVideoDel.EntsvcHttpBSFVGetUrl += new HttpFlashVideoDelegates.DelsvcHttpBSFVGetUrl(objFlashVideo_EntsvcHttpBSFVGetUrl); objFlashVideoDel.EntsvcHttpBSFVCreateFolder += new HttpFlashVideoDelegates.DelsvcHttpBSFVCreateFolder(objFlashVideo_EntsvcHttpBSFVCreateFolder); object objFlashVideo = objFlashVideoDel; bhsFlashVideo = new BasicHttpServer(ref objFlashVideo, "http://" + VMuktiInfo.BootStrapIPs[0] + ":80/VMukti/HttpFlashVideo"); bhsFlashVideo.AddEndPoint<IHttpBootStrapFlashVideo>("http://" + VMuktiInfo.BootStrapIPs[0] + ":80/VMukti/HttpFlashVideo"); bhsFlashVideo.OpenServer(); #endregion #region NetP2PServerHoster npsBootStrapServer = new NetPeerServer("net.tcp://" + VMuktiInfo.BootStrapIPs[0] + ":6000/NetP2PBootStrap"); npsBootStrapServer.AddEndPoint("net.tcp://" + VMuktiInfo.BootStrapIPs[0] + ":6000/NetP2PBootStrap"); npsBootStrapServer.OpenServer(); //MessageBox.Show("netp2p server hosted"); #endregion #region NetP2PConsoleServerHoster npsConsoleServer = new NetPeerServer("net.tcp://" + VMuktiAPI.VMuktiInfo.BootStrapIPs[0] + ":6000/NetP2PConsole"); npsConsoleServer.AddEndPoint("net.tcp://" + VMuktiAPI.VMuktiInfo.BootStrapIPs[0] + ":6000/NetP2PConsole"); npsConsoleServer.OpenServer(); #endregion #region CallCenter Services if (VMuktiAPI.VMuktiInfo.VMuktiVersion.ToString() == "1.1") { #region NetP2PPrictiveServerHoster npsBootStrapPredictviveServer = new NetPeerServer("net.tcp://" + VMuktiInfo.BootStrapIPs[0] + ":6000/NetP2PBootStrapPredictive"); npsBootStrapPredictviveServer.AddEndPoint("net.tcp://" + VMuktiInfo.BootStrapIPs[0] + ":6000/NetP2PBootStrapPredictive"); npsBootStrapPredictviveServer.OpenServer(); #endregion #region Hosting DashBoard Server npsBootStrapDashBoardService = new NetPeerServer("net.tcp://" + VMuktiInfo.BootStrapIPs[0] + ":6000/NetP2PBootStrapDashBoard"); npsBootStrapDashBoardService.AddEndPoint("net.tcp://" + VMuktiInfo.BootStrapIPs[0] + ":6000/NetP2PBootStrapDashBoard"); npsBootStrapDashBoardService.OpenServer(); #endregion # region Hosting Active Agent Server npsBootStrapActiveAgentReportService = new NetPeerServer("net.tcp://" + VMuktiInfo.BootStrapIPs[0] + ":6000/NetP2PBootStrapActiveAgentReport"); npsBootStrapActiveAgentReportService.AddEndPoint("net.tcp://" + VMuktiInfo.BootStrapIPs[0] + ":6000/NetP2PBootStrapActiveAgentReport"); npsBootStrapActiveAgentReportService.OpenServer(); #endregion #region Server For Uploading Recorded Calls npsRecordingServer = new NetPeerServer("net.tcp://" + VMuktiInfo.BootStrapIPs[0] + ":6000/NetP2PBootStrapRecordedFiles"); npsRecordingServer.AddEndPoint("net.tcp://" + VMuktiInfo.BootStrapIPs[0] + ":6000/NetP2PBootStrapRecordedFiles"); npsRecordingServer.OpenServer(); #endregion #region Client For Uploading Recorded Calls 4 Performance NetPeerClient npcRecordingClient = new NetPeerClient(); object objP2PRecording = new NetP2PBootStrapRecordedFileDelegate(); ((NetP2PBootStrapRecordedFileDelegate)objP2PRecording).EntsvcRecordedFileJoin += new NetP2PBootStrapRecordedFileDelegate.delsvcRecordedFileJoin(objP2PRecording_EntsvcRecordedFileJoin); ((NetP2PBootStrapRecordedFileDelegate)objP2PRecording).EntsvcSendRecordedFiles += new NetP2PBootStrapRecordedFileDelegate.delsvcSendRecordedFiles(objP2PRecording_EntsvcSendRecordedFiles); ((NetP2PBootStrapRecordedFileDelegate)objP2PRecording).EntsvcRecordedFileUnJoin += new NetP2PBootStrapRecordedFileDelegate.delsvcRecordedFileUnJoin(objP2PRecording_EntsvcRecordedFileUnJoin); //objNetP2PRecording = objP2PRecording; clientNetP2pChannelRecording = (INetP2PBootStrapRecordedFileChannel)npcRecordingClient.OpenClient<INetP2PBootStrapRecordedFileChannel>("net.tcp://" + VMuktiInfo.BootStrapIPs[0] + ":6000/NetP2PBootStrapRecordedFiles", "P2PRecordedFiles", ref objP2PRecording); VMukti.Business.CommonMessageContract.clsMessageContract objContract = new VMukti.Business.CommonMessageContract.clsMessageContract(); objContract.uname = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName; objContract.fName = ""; objContract.fExtension = ""; objContract.fLength = 0; objContract.fStream = new MemoryStream(); clientNetP2pChannelRecording.svcRecordedFileJoin(objContract); #endregion } #endregion #region Disaster Recovery //fncMakeAllBuddyOffline(); #endregion } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "BootstrapServiceDomain()", "Domains\\BootstrapServiceDomain.cs"); } }
// End Meet Code. #region IDisposable Members public void Dispose() { System.Diagnostics.Debug.WriteLine("Dispose is calling......"); try { if (objHttpBootStrap != null) { objHttpBootStrap = null; } if (npsBootStrapServer != null) { npsBootStrapServer.CloseServer(); npsBootStrapServer = null; } if (npsBootStrapPredictviveServer != null) { npsBootStrapPredictviveServer.CloseServer(); npsBootStrapPredictviveServer = null; } if (npsBootStrapPBXServer != null) { npsBootStrapPBXServer.CloseServer(); npsBootStrapPBXServer = null; } if (npsBootStrapDashBoardService != null) { npsBootStrapDashBoardService.CloseServer(); npsBootStrapDashBoardService = null; } if (npsBootStrapActiveAgentReportService != null) { npsBootStrapActiveAgentReportService.CloseServer(); npsBootStrapActiveAgentReportService = null; } if (npsRecordingServer != null) { npsRecordingServer.CloseServer(); npsRecordingServer = null; } if (strCurrentMachineIP != null) { strCurrentMachineIP = null; } if (appPath != null) { appPath = null; } if (awClientConnectionString != null) { awClientConnectionString = null; } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "Dispose()", "Domains\\BootstrapServiceDomain.cs"); } }